Custom alarm fired multiple times

Luiz Kill2 years ago

Hi folks. I've set a custom alarm using the 'batteryLevel' attribute, like this:

batteryLevel < 20 ? "lowBattery" : null

How can I limit the number of times it fires the notification? Just as it is I get multiple notifications as devices move and send data continually.

Anton Tananaev2 years ago

There's no way to limit it, as far as I know. You will receive an alarm every time it's triggered.

Luiz Kill2 years ago

Is there a way to create an attribute using sql? Maybe I could check in the db that the alarm for today has been already generated. If I could then reference this attribute in the alarm it would fire only one time per day.

Anton Tananaev2 years ago

Computed attributes don't really have access to historical data.

Luiz Kill2 years ago

Well, I guess it's better to see the volume of notification as a stronger reminder to charge the device. :)

Thanks!