@bachya - update from a little more time with the newest version…
The polling overriding the the state from the webhook is definitely solved (as would be expected for disabling the REST API polling on the V2 systems).
The HA state is being updated maybe 50% of the time from the webhooks. For example, this morning after disabling the alarm at the keypad, HA continued to show armed_home and the automation for morning routines was never triggered.
Similar thing leaving this morning - the armed_away at the keypad did not update the app.
I am see this chunk of logs repeatedly:
2021-11-24 08:53:59 ERROR (MainThread) [custom_components.simplisafe] Error fetching 447616 data: SimpliSafe error while updating: 401, message='Unauthorized', url=URL('https://api.simplisafe.com/v1/users/447616/subscriptions?activeOnly=true')
2021-11-24 08:54:38 ERROR (MainThread) [simplipy] Giving up _async_request(...) after 4 tries (aiohttp.client_exceptions.ClientResponseError: 401, message='Unauthorized', url=URL('https://api.simplisafe.com/v1/users/447616/subscriptions?activeOnly=true'))
2021-11-24 08:55:17 ERROR (MainThread) [simplipy] Giving up _async_request(...) after 4 tries (aiohttp.client_exceptions.ClientResponseError: 401, message='Unauthorized', url=URL('https://api.simplisafe.com/v1/users/447616/subscriptions?activeOnly=true'))
2021-11-24 08:55:56 ERROR (MainThread) [simplipy] Giving up _async_request(...) after 4 tries (aiohttp.client_exceptions.ClientResponseError: 401, message='Unauthorized', url=URL('https://api.simplisafe.com/v1/users/447616/subscriptions?activeOnly=true'))
2021-11-24 08:56:35 ERROR (MainThread) [simplipy] Giving up _async_request(...) after 4 tries (aiohttp.client_exceptions.ClientResponseError: 401, message='Unauthorized', url=URL('https://api.simplisafe.com/v1/users/447616/subscriptions?activeOnly=true'))
2021-11-24 08:57:13 ERROR (MainThread) [simplipy] Giving up _async_request(...) after 4 tries (aiohttp.client_exceptions.ClientResponseError: 401, message='Unauthorized', url=URL('https://api.simplisafe.com/v1/users/447616/subscriptions?activeOnly=true'))
2021-11-24 08:57:51 ERROR (MainThread) [simplipy] Giving up _async_request(...) after 4 tries (aiohttp.client_exceptions.ClientResponseError: 401, message='Unauthorized', url=URL('https://api.simplisafe.com/v1/users/447616/subscriptions?activeOnly=true'))
2021-11-24 08:58:29 ERROR (MainThread) [simplipy] Giving up _async_request(...) after 4 tries (aiohttp.client_exceptions.ClientResponseError: 401, message='Unauthorized', url=URL('https://api.simplisafe.com/v1/users/447616/subscriptions?activeOnly=true'))
I’m staring to wonder if the V2 systems have just run their course… In your opinion, is the upgrade to V3 worth it?
Interesting… Do those log entries correspond to the timeframe in which you checked in the morning?
Not to cop out, but I think it’s worth it. I’m very glad we upgraded. I have the expectation that going forward, all the updates, bug fixes, etc. are going to go to the V3 systems. I know it’s not trivial, cost-wise, but I really would recommend it.
@bachya - not exactly at the moment when I change the state on the keypad. They seem to be happening about once per hour.
I don’t want to ask you to go on a wild goose chase on a legacy system that might not be worth the updates.
I might mess around with the events thing a bit to see if I can hack some solution there before jumping ship on V2. Could you point me to an example in your SS library of how SS uses the new code to authenticate to its API? Any code I’ve written to SimpliSafe used their old authentication sequence.
I have seriously considered moving to the V3 system, but am holding back because I’m exploiting a weakness in the V2 system. I use a Pi and rtl_433 to eavesdrop on the V2 communications from the sensors to the base station. Doing this allows me to pull the SimpliSafe sensors into Home Assistant. Has someone figured out a way to do this with the V3 sensors? My understanding is the V3 system encrypts wireless transmissions. Looking for a solution that doesn’t have me installing two door sensors on every door.
I ultimately decided to upgrade to Gen3. I figured the problems with Gen2 will keep popping up and at some point it probably won’t make sense for HA to support Gen2. @DaveCo1701 - @bachya can keep me honest but I think the HA integration does pick up individual sensors for Gen3 systems.
@ChitFam - my hack until I get the Gen3 system is to use @bachya 's simplipy library. I have a script that runs every 30 seconds to check the events list. The logic looks like:
systems = await simplisafe.async_get_systems()
for system in systems.values():
# Print system events:
events = await system.async_get_events()
for event in events:
if event["messageSubject"] == "SimpliSafe System Armed (home mode)":
msg = "armed_home"
break
if event["messageSubject"] == "SimpliSafe System Armed (away mode)":
msg = "armed_away"
break
if event["messageSubject"] == "SimpliSafe System Disarmed":
msg = "disarmed"
break
The msg is then sent to a Mosquito MQTT broker. HA subscribes to the topic to update a sensor. So HA is getting the most recent alarm state from the events every 30 seconds. I’m ignoring the state reported by HA for the alarm because it’s usually un reliable. The REST state polling doesn’t work because it’s cached data for Gen2 and the websockets update on events are unreliable for my system.
I considered using the recent event available in HA on the alarm sensor (i.e., update a new sensor based off that event without needing the custom script/MQTT). The only problem there is if there were other events (e.g., power outage) that I could see causing issues. The MQTT method is a little more robust and ensures proper state is always set.
I started looking at how I could tweak the SimpliSafe component to do this natively, but that was a bit over my head for a quick fix
Correct, with one caveat: The values are updated via a 20-second polling interval. In our house, unfortunately, that doesn’t really help me with anything useful… @DaveCo1701 is exploiting a workaround that allows them real-time access to sensor values via sniffing the RF signals.
Yeah, 20 second delay wouldn’t be good for triggering actions (e.g., when door opened, turned on light). But I guess it could be good for monitoring/alerting - (e.g., if weather is raining and window is open, send me an alert)
hi, im a beginner using HA… is there any way to reduce this 20-second refresh rate… im actually trying to automate to turn on front light when Front Door Entry Sensor is open… but it take too much time to trigger. thanks!!!
@Jisg.apps - there is no way in the UI. You’d have to edit the polling code to change the frequency. Even at that, I don’t think you’ll ever get the outcome you want. Even at a frequency of 3 seconds polling, it takes time to make the HTTP requests so you’re still looking at several seconds for the action to run in HA. Something like a door opening trigger for turning on a light needs to be close to instant.
Could you put a Z-Wave motion sensor near the front door to turn on a light based on motion? That would trigger much faster. Or, look for another Z-wave door sensor that could talk directly to HA to trigger a light.
I am not sure if this thread is still alive, but I am having a similar issue with the latest version of the application. HomeAssistant doesn’t pull the API for hours and hours, making the integration almost worthless other than just arming and disarming. Is there a way to configure to pull the rest api every XX seconds?