api to send an alarm included, refactor to avoid repetition of code was made