home-assistant / mobile-apps-fcm-push

Push Notification Sender for Home Assistant official mobile apps

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Command clear_notification counting toward push notification rate limits

gregg098 opened this issue · comments

Home Assistant Android version:
1.11.2-5-ge22ccac-226-full

Android version:
10

Phone model:
Samsung Galaxy S10+

Home Assistant version:
0.113.3

Last working Home Assistant release (if known):
Unknown

Description of problem:
I just migrated my notifications from Pushover to the Home Assistant companion app, but reached my rate limit in just an hour or two. I have sent myself quite a few test notifications, but not 300 in the last day.

A good majority of these are simple notifications in two parts:
For example:

  1. A Node Red flow that sees a door open, starts a timer, then sends a notification if the timer expires.
  2. A Node Red flow that sees that door shut and send a clear_notification command with the same tag.

To troubleshoot, I set up some debug nodes in Node Red, and also set Home Assistant logging to homeassistant.components.mobile_app.notify: info. While watching the logs and debug nodes, I noticed that a few clear_notification commands were sent and the corresponding log entry showed that my notification count went up, despite not actually getting a push to my phone.

The notification details page (HERE) says that clear_notification command does NOT count against the limit.

Traceback (if applicable):
Here are logs from a test event I did to get logs. No push notification was sent, just a clear_notification command since a condition was met.

2020-08-01 14:21:21 INFO (MainThread) [homeassistant.components.mobile_app.notify] mobile_app push notification rate limits for wifephone: 101 sent, 300 allowed, 0 errors, resets in 2:38:38

Here is a debug node event for that same event:

{"data":{"event_type":"state_changed","entity_id":"switch.os_security_lights_primary","event":{"entity_id":"switch.os_security_lights_primary","old_state":{"entity_id":"switch.os_security_lights_primary","state":"on","attributes":{"node_id":9,"value_index":0,"value_instance":1,"value_id":"72057594193723392","friendly_name":"Security Lights"},"last_changed":"2020-08-01T21:21:18.266131+00:00","last_updated":"2020-08-01T21:21:18.266131+00:00","context":{"id":"4df716750aa84ad38cfaf871e2ddb6be","parent_id":null,"user_id":"fa8d71c4a4e34d53ac2f69e73921f97a"}},"new_state":{"entity_id":"switch.os_security_lights_primary","state":"off","attributes":{"node_id":9,"value_index":0,"value_instance":1,"value_id":"72057594193723392","friendly_name":"Security Lights"},"last_changed":"2020-08-01T21:21:21.094350+00:00","last_updated":"2020-08-01T21:21:21.094350+00:00","context":{"id":"576405a85f164fedb825801d15596eee","parent_id":null,"user_id":"fa8d71c4a4e34d53ac2f69e73921f97a"},"timeSinceChangedMs":13}}},"_msgid":"b80c2f2b.8d37f","message":"clear_notification","tag":"security_lights_on","_event":"node:ee32b2cc.337a1"}

The previous entry for her phone showed "100 sent."

Screenshot of problem:

Additional information:
In the process of debugging, I did figure out that I had a couple of flows in Node Red that were likely spamming the notification system with clear_notification events. I did fix these issues, which greatly reduced the commands into the system, but again, I still have not actually received 300 push notifications on my phone.

Still seeing the same behavior. With the latest Home Assistant companion app for Android installed (beta-492-df47e80), I can now see a notification history. I took the attached screenshot when it said I had used ~60 / 300 notifications for the day already. As you can see from the history, its mostly "clear_notification" requests counting toward the daily rate limit even though those commands should not get counted. Since the daily reset when I took this, I had only actually received maybe 2 or 3 notifications.

Just to be clear, all notifications are working fine, its just counting commands that shouldn't be.

Screenshot_20201104-212113_Home Assistant