Yep – per the example above, trigger.event.data
will contain the entire event payload.
Can someone offer some insight here? I created an automation to play media over speakers when the doorbell rings. I confirmed the automation works by manually firing the doorbell_detected
event. However, ringing the physical doorbell doesn’t trigger the automation. Here’s the log when I press the doorbell:
2021-01-23 10:34:30 INFO (MainThread) [engineio.client] Received packet MESSAGE data 2/v1/user/2396302,["event",{"eventTimestamp":1611416066,"eventCid":1170,"zoneCid":"1","sensorType":12,"sensorSerial":"","account":"account","userId":userid,"sid":sid,"info":"\"Front Door\" Camera Detected Motion","pinName":"","sensorName":"Front Door","messageSubject":"Camera Detected Motion","messageBody":"\"Front Door\" Camera Detected Motion on 1-23-21 at 10:34 am","eventType":"activityCam","timezone":0,"locationOffset":-300,"internal":{"isSubscribed":true,"shouldNotify":true,"type":"doorbellPir","mainCamera":"camera","mainCameraName":"Front Door","mainCameraFirmwareVersion":"2.6.1.154","micEnable":true,"cameraSupportedFeatures":{"providers":{"webrtc":"none","recording":"simplisafe","live":"simplisafe"},"audioEncodings":["speex"],"resolutions":["480p","720p","1080p"],"id":"id","pir":true,"videoAnalytics":true,"privacyShutter":false,"microphone":true,"fullDuplexAudio":false,"wired":true,"networkSpeedTest":false,"speaker":true,"spotlight":false,"colorNightMode":false,"videoFlip":false,"doorbell":true,"videoAnalyticsZones":true,"pairedToBasestation":false,"siren":false,"videoEncoding":"h264"},"dispatcher":"cops"},"senderId":"","eventId":13030087599,"serviceFeatures":{"monitoring":true,"alerts":true,"online":true,"video":true,"hazard":false},"copsVideoOptIn":true,"video":{"key":{"clipId":7281077853,"preroll":5,"postroll":60,"cameraName":"Front Door"}},"videoStartedBy":1}]
2021-01-23 10:34:30 INFO (MainThread) [socketio.client] Received event "event" [/v1/user/#]
2021-01-23 10:34:32 INFO (MainThread) [simplipy] Watchdog triggered – sleeping for 900 seconds
It seems like the system is receiving information that the doorbell is being pushed, but the doorbell_detected
event doesn’t fire.
Here’s my automation, which does work when I manually trigger doorbell_detected
in the Developer Tools:
alias: Doorbell
description: ''
trigger:
- platform: event
event_type: doorbell_detected
event_data: {}
condition: []
action:
- service: media_player.play_media
data:
entity_id: media_player.office_speaker
media_content_id: /local/doorbell.mp3
media_content_type: music
entity_id: media_player.office_speaker
mode: single
Quick check-in: my day job has been commanding the majority of my attention, but I haven’t forgotten this; will get back to you as soon as I can!
Following up. I’m looking at your logs and notice only one from the simplipy
logger (the first two use the engine.client
and socketio.client
loggers, respectively). Do you see any other simplipy
or home assistant.components.simplisafe
entries around the time you press the doorbell?
Also, what happens when you listen for the SIMPLISAFE_EVENT
event in Home Assistant (using the “Events” developer tool in Home Assistant) and press the doorbell?
Here’s what happens when I listen for the event:
{
"event_type": "SIMPLISAFE_EVENT",
"data": {
"last_event_changed_by": "",
"last_event_type": "doorbell_detected",
"last_event_info": "Someone is at your \"Front Door\"",
"last_event_sensor_name": "Front Door",
"last_event_sensor_serial": "",
"last_event_sensor_type": "doorbell",
"system_id": [systemid],
"last_event_timestamp": "2021-01-28T22:01:32+00:00"
},
"origin": "LOCAL",
"time_fired": "2021-01-28T22:01:37.478539+00:00",
"context": {
"id": "[id]",
"parent_id": null,
"user_id": null
}
}
My doorbell automation didn’t fire, and I don’t see anything from simplipy in the log, just the same engineio.client
message. Additionally, I tried the untested log automation you posted in post #13, and I don’t get any entries in the log. According to the automation, it triggered about 30 minutes ago, but the matching log entry is another Watchdog entry like the one I posted above. In fact, when I search the log file in Notepad++ for all instances of simplipy
, it’s nothing but Watchdog expired – calling async_reconnect
and Watchdog triggered – sleeping for 900 seconds
.
I was going to paste my log automation, but when I select edit as YAML it throws an error. That makes me think there’s something wrong with that automation, although it should be unrelated to why I’m not seeing the doorbell_detected event fire.
EDIT: This character caused the error. I’ve deleted it to see if it somehow allows the log automation to work properly and maybe give me some data.
I don’t think your automation is looking for the right thing. Instead of this:
trigger:
- platform: event
event_type: doorbell_detected
event_data: {}
…try this:
trigger:
- platform: event
event_type: SIMPLISAFE_EVENT
event_data:
last_event_type: doorbell_detected
That makes sense. I was wondering how to implement SIMPLISAFE_EVENT
. The fact that the documentation refers to it and doorbell_detected
as event_type
had me confused. I’ll try it with the updated code and see if it works.
EDIT: I’m also going to figure out how to edit documentation in Github to update the SIMPLISAFE_EVENT
section with the correct attributes (last_event_type
vs event_type
, etc.)
trigger:
- platform: event
event_type: SIMPLISAFE_EVENT
event_data:
last_event_type: doorbell_detected
I am still trying to get mine to do what I need. Hopefully, your reply can help me get there. I want to trigger on the specific motion.
I.e
“last_event_type”: “motion_detected”,
“last_event_info”: “Secret Alert: Entry Sensor Garage Opened”,
“last_event_sensor_name”: “Garage”,
Do I put the name as a sub to your code?
Garage
trigger:
- platform: event
event_type: SIMPLISAFE_EVENT
event_data:
last_event_type: motion_detect
last_event_sensor_name: Garage
I have several motion and entry that have secret alerts and want to trigger on specific ones.
Thanks again for your help.
That looks correct.
I have the following that works manually, but does not trigger from simplisafe.
- id: '16100184557111'
alias: Simplisafe front door
description: ''
trigger:
- platform: event
event_type: SIMPLISAFE_EVENT
event_data:
motion_detected:
last_event_sensor_name: Front Door
condition: []
action:
- service: notify.pixel_xl_4
data:
message: Front door motion_detected
mode: single
I did receive a notification from Simplisafe and home assistant sees the event
from the developers tools
{
"event_type": "SIMPLISAFE_EVENT",
"data": {
"last_event_changed_by": "",
"last_event_type": "motion_detected",
"last_event_info": "Secret Alert: Motion Sensor Front Door Triggered",
"last_event_sensor_name": "Front Door",
"last_event_sensor_serial": "007bf4db",
"last_event_sensor_type": "motion",
"system_id": 2785102,
"last_event_timestamp": "2021-01-30T00:42:58+00:00"
},
"origin": "LOCAL",
"time_fired": "2021-01-30T00:43:03.051279+00:00",
"context": {
"id": "7610711076408473e5f7cfcc7678e00c",
"parent_id": null,
"user_id": null
}
}
Am I missing quotes?
You can see from the data that it’s not
that’s written when motion is detected. Instead, it’s
I would try your automation like this:
trigger:
- platform: event
event_type: SIMPLISAFE_EVENT
event_data:
last_event_type: motion_detected
last_event_sensor_name: Front Door
See if that works for you. I’m not sure, but it might need to be some sort of AND condition, otherwise the event might fire if only motion is detected somewhere. I’m still learning myself.
Thanks. What you wrote is what i should have had in the first place? I’ll try it in the morning and edit this reply. I tried it with the change and it still didn’t send the notification. Not sure if it is an automation issue or an issue with SimpliSafe. I’m back to not seeing all of the alerts in Home Assistant. May be an issue with the SimpliSafe server again as Home Assistant did not see the event. I did get a notification from SimpliSafe.
I guess this is where this thread started about the “unreliable” of late. Not all the information is sent from the simplisafe servers. Not sure what I can do on my end to make it work better with Home Assistant. I’ll see if the trigger works next time Home Assistant sees it. At least this will test that the automation is configured correctly.
Yes, what I wrote after “I would try your automation like this:” is what I recommend you try. Please report back if it works so that we know we’re on the right track.
I get nothing from home assistant. My events for Simplisafe 8n home assistant also stopped when listening in the developers tools.
I’m trying to figure this out myself. When I first started troubleshooting my doorbell_detected
issue above, I listened to SIMPLISAFE_EVENT
in dev tools and got nothing, even when ringing the doorbell. Now, I do, and I don’t know what if anything I did differently. I do know the connection to Simplisafe frequently times out (the original point of this discussion), and that might be causing your lack of events in dev tools. Sorry I can’t be more help than that. @bachya usually passes through a few times a week to set us all straight.
I think this maybe the issue. Somedays when listening I see info and other days I do not. Yesterday it worked for a couple of hours and then it stopped. I have never gotten an automation to trigger automatically.
Error log:
Logger: homeassistant.components.simplisafe
Source: helpers/update_coordinator.py:166
Integration: SimpliSafe (documentation, issues)
First occurred: 5:15:14 AM (1 occurrences)
Last logged: 5:15:14 AM
Error fetching [email protected] data: SimpliSafe error while updating: There was an error while requesting /ss3/subscriptions/2785102/settings/normal: 502, message='Bad Gateway', url=URL('https://api.simplisafe.com/v1/ss3/subscriptions/2785102/settings/normal?forceUpdate=true')
Maybe this is why I am getting no info?
I finally got everything running with @bachya help. Aaron had me create a simple sensor in the automation ui to test the event.
- id: '1614207165643'
alias: Simplisafe Test
description: ''
trigger:
- platform: event
event_type: SIMPLISAFE_EVENT
condition: []
action:
- service: persistent_notification.create
data:
message: Simplisafe Sensor Tripped
mode: single
This worked everytime and created a persistent_notification on the side bar.
I turned on the log files in configuration.yaml to see if I was getting any errors (I was not).
logger:
default: info
logs:
homeassistant.components.simplisafe: debug
simplipy: debug
I monitored the event in developers tools event to subscribe to: SIMPLISAFE_EVENT
I captured some of the logs here to see what is being sent:
{
"event_type": "SIMPLISAFE_EVENT",
"data": {
"last_event_changed_by": "",
"last_event_type": "secret_alert_triggered",
"last_event_info": "Secret Alert: Motion Sensor Front Door Triggered",
"last_event_sensor_name": "Front Door",
"last_event_sensor_serial": "007bf4db",
"last_event_sensor_type": "motion",
"system_id": 2785102,
"last_event_timestamp": "2021-02-25T01:34:11+00:00"
},
"origin": "LOCAL",
"time_fired": "2021-02-25T01:34:15.541359+00:00",
"context": {
"id": "eb854372ccee6d7def5bb89e75149b86",
"parent_id": null,
"user_id": null
}
}
I then modified (slightly my original automation) to:
- id: '16100184557111'
alias: Simplisafe front door
description: ''
trigger:
- platform: event
event_data:
last_event_type: secret_alert_triggered
last_event_sensor_name: Front Door
event_type: SIMPLISAFE_EVENT
condition: []
action:
- service: notify.pixel_xl_4
data:
message: Front door motion_detected
mode: single
I finally got all the secret alerts working in home assistant automation. Hopefully this can help others getting the secret alerts to trigger automations.
Hi all – FYI, I recently pushed a PR that overhauls simplisafe-python
's retry mechanism, which should really help here. I can’t control the SimpliSafe cloud’s unreliability, but this new PR will be more vigorous about retrying requests (getting sensor updates, arming/disarming, etc.) when the cloud fails.
This should land in 2021.3.0.
Following up: the PR I mention above was released in 2021.3.0. I’ve been running it for several days and haven’t seen a single SimpliSafe ERROR
-level message in the logs (you might see a WARNING
about needing to retry API calls every so often, but the integration should recover).