home-assistant / core

:house_with_garden: Open source home automation that puts local control and privacy first.
https://www.home-assistant.io
Apache License 2.0
69.77k stars 28.91k forks source link

Simplisafe events dont seem to work in developer tools or automations #115234

Open freshfieldx opened 2 months ago

freshfieldx commented 2 months ago

The problem

I have tried creating an automation that uses camera motion events, but I can't get it to trigger. Ive tried various formats based on previous issues involving these events. I appreciate the API isnt the best!

What version of Home Assistant Core has the issue?

2024.4.2

What was the last working version of Home Assistant Core?

No response

What type of installation are you running?

Home Assistant OS

Integration causing the issue

Simplisafe

Link to integration documentation on our website

https://www.home-assistant.io/integrations/simplisafe/

Diagnostics information

No response

Example YAML snippet

This doesnt trigger:

alias: Camera Event
description: ""
trigger:
  - platform: event
    event_data:
      last_event_type: camera_motion_detected
      last_event_sensor_name: Front Door
    event_type: SIMPLISAFE_EVENT
condition: []
action:
  - service: persistent_notification.create
    data_template:
      title: Camera motion
      message: "{{trigger.event.data}}"
mode: single

Anything in the logs that might be useful for us?

I can see the events in the log:

2024-04-08 19:40:40.843 DEBUG (MainThread) [simplipy] Data received from /subscriptions/2475946/events: {'numEvents': 1, 'lastEventTimestamp': 1712600611, 'events': [{'eventId': 42251680117, 'eventTimestamp': 1712600611, 'eventCid': 1170, 'zoneCid': '0', 'sensorType': 15, 'sensorSerial': '0146ab6', 'account': '0005F28E', 'userId': 2446180, 'sid': 2475946, 'info': 'Camera Detected Motion', 'pinName': '', 'sensorName': 'Front Door', 'messageSubject': 'Camera Detected Motion', 'messageBody': 'Camera Detected Motion on 08/04/2024 at 19:23', 'eventType': 'activityCam', 'timezone': 8, 'locationOffset': 60, 'videoStartedBy': 

etc

Additional information

If I listen to SIMPLISAFE_EVENT I don't see anything showing when the log above was created

home-assistant[bot] commented 2 months ago

Hey there @bachya, mind taking a look at this issue as it has been labeled with an integration (simplisafe) you are listed as a code owner for? Thanks!

Code owner commands Code owners of `simplisafe` can trigger bot actions by commenting: - `@home-assistant close` Closes the issue. - `@home-assistant rename Awesome new title` Renames the issue. - `@home-assistant reopen` Reopen the issue. - `@home-assistant unassign simplisafe` Removes the current integration label and assignees on the issue, add the integration domain after the command. - `@home-assistant add-label needs-more-information` Add a label (needs-more-information, problem in dependency, problem in custom component) to the issue. - `@home-assistant remove-label needs-more-information` Remove a label (needs-more-information, problem in dependency, problem in custom component) on the issue.

(message by CodeOwnersMention)


simplisafe documentation simplisafe source (message by IssueLinks)

freshfieldx commented 2 months ago

I should also add that I've been seeing this in my logs for a while:

Logger: homeassistant.components.simplisafe Source: components/simplisafe/init.py:507 integration: SimpliSafe (documentation, issues) First occurred: 19:48:28 (4 occurrences) Last logged: 20:20:16

Unknown exception while connecting to websocket: 'playback/hls'

freshfieldx commented 2 months ago

Also, as a test to rule out some issues on my RPi I have tried loading a backup on a new VM to see if it works and it still didnt

bachya commented 2 months ago

I unfortunately don't have an SS camera to test with. It would be useful to see debug-level logs (for both homeassistant.components.simplisafe and simplipy) surrounding one of these events.

Mmozar commented 2 months ago

I have the same issue as freshfieldx and can now confirm I have the same error: Unknown exception while connecting to websocket: 'playback/hls' My automations on camera motion that had run for a year stopped working in Feb or March 2024. Also the doorbell_detected event is no longer seen as that automation stopped triggering in the same timeframe.
I tried to download the logs but can’t seem to get them on mobile device. Do I need a PC/Mac to do so?

bachya commented 2 months ago

Do I need a PC/Mac to do so?

It's generally easier on a desktop than mobile.

Diagnostics instructions: https://www.home-assistant.io/integrations/diagnostics/

Debug-level logging instructions: https://www.home-assistant.io/docs/configuration/troubleshooting/#enabling-debug-logging

Mmozar commented 2 months ago

config_entry-simplisafe-851fef1ff608217a08ac9cc71a34f4b3.json

Mmozar commented 2 months ago

Emailed the log compressed is still 37MB

bachya commented 2 months ago

Emailed the log compressed is still 37MB

I don't need your entire log. If you can focus on just SimpliSafe-related entries (and specifically those before and after the time in which this error message occurs), I should be able to deduce what's going on.

Mmozar commented 2 months ago

home-assistant_simplisafe_2024-04-17T19-38-21.933Z.log.zip https://drive.google.com/file/d/1zXJwQtCmR9ptG7jYKSaPhjFbpqd5_Q-m/view?usp=drive_web

Doorbell rang at 12:18PM and motion then as well from Front Door. Many Front Door events until 1PM and many Garage cameras starting around 1PM. Hope this helps - great integration thanks for all you have done!

On Wed, Apr 17, 2024 at 2:46 PM Aaron Bach @.***> wrote:

Do I need a PC/Mac to do so?

It's generally easier on a desktop than mobile.

Diagnostics instructions: https://www.home-assistant.io/integrations/diagnostics/

Debug-level logging instructions: https://www.home-assistant.io/docs/configuration/troubleshooting/#enabling-debug-logging

— Reply to this email directly, view it on GitHub https://github.com/home-assistant/core/issues/115234#issuecomment-2061982132, or unsubscribe https://github.com/notifications/unsubscribe-auth/AUVMSOFOJJXXE2BMACEBTJLY527QFAVCNFSM6AAAAABF5ILBCWVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDANRRHE4DEMJTGI . You are receiving this because you commented.Message ID: @.***>

Mmozar commented 2 months ago

home-assistant_simplisafe_log.txt

Doorbell rang at 12:18PM and motion then as well from Front Door. Many Front Door events until 1PM and many Garage cameras starting around 1PM. Hope this helps - great integration thanks for all you have done!

freshfieldx commented 2 months ago

Apologies for the delayed reply, im seeing entries like this (From SS Doorbell)in the full log, but no events...

2024-04-18 08:12:46.004 DEBUG (MainThread) [simplipy] Data received from /subscriptions/2475946/events: {'numEvents': 1, 'lastEventTimestamp': 1713424356, 'events': [{'eventId': 42631846887, 'eventTimestamp': 1713424356, 'eventCid': 1170, 'zoneCid': '0', 'sensorType': 15, 'sensorSerial': '0146ab6', 'account': '0005F28E', 'userId': REDACTED, 'sid': 2475946, 'info': 'Camera Detected Motion', 'pinName': '', 'sensorName': 'Front Door', 'messageSubject': 'Camera Detected Motion', 'messageBody': 'Camera Detected Motion on 18/04/2024 at 08:12', 'eventType': 'activityCam', 'timezone': 8, 'locationOffset': 60, 'videoStartedBy': 'b586fb9fa731c999f5d5990260146ab6', 'video': {'b586fb9fa731c999f5d5990260146ab6': {'clipId': 29688898057, 'preroll': 5, 'postroll': 60, 'cameraName': 'Front Door', 'cameraModel': 'SS002', 'aspectRatio': '16:9', 'duration': 65, 'recordingType': 'TEP', 'account': '', 'region': 'us-east-1', '_links': {'_self': {'href': 'https://chronicle.us-east-1.prd.cam.simplisafe.com/v1/recordings/29688898057', 'method': 'GET'}, 'playback/flv': {'href': 'https://media.simplisafe.com/v1/b586fb9fa731c999f5d5990260146ab6/flv?ts=1713424351&postroll=60', 'method': 'GET'}, 'preview/mjpg': {'href': 'https://media.simplisafe.com/v1/b586fb9fa731c999f5d5990260146ab6/mjpg?ts=1713424351&duration=65', 'method': 'GET'}, 'snapshot/mjpg': {'href': 'https://media.simplisafe.com/v1/b586fb9fa731c999f5d5990260146ab6/mjpg?ts=1713424351&duration=10', 'method': 'GET'}, 'snapshot/jpg': {'href': 'https://media.simplisafe.com/v1/b586fb9fa731c999f5d5990260146ab6/snapshot?ts=1713424351', 'method': 'GET'}, 'download/mp4': {'href': 'https://media.simplisafe.com/v1/b586fb9fa731c999f5d5990260146ab6/mp4?ts=1713424351&duration=65', 'method': 'GET'}, 'share': {'href': 'https://media.simplisafe.com/v1/b586fb9fa731c999f5d5990260146ab6/share?ts=1713424351&duration=65', 'method': 'POST'}}}}}]}
freshfieldx commented 2 months ago

Just to add, my test automation has started periodically creating a notification:

{'last_event_changed_by': '', 'last_event_type': 'camera_motion_detected', 'last_event_info': '"Front Door" Camera Detected Motion', 'last_event_sensor_name': 'Front Door', 'last_event_sensor_serial': '0146ab6', 'last_event_sensor_type': 'DOORBELL', 'system_id': 2475946, 'last_event_timestamp': datetime.datetime(2024, 4, 22, 8, 50, 5, tzinfo=datetime.timezone.utc)}

The camera picks up motion throughout the day, but the notification pops up once every few days.

bachya commented 2 months ago

@freshfieldx To be clear, you're now getting this event, but only some of the time?

freshfieldx commented 2 months ago

Yes, very intermittent

Regards

Brian Rainey

t: 07789714159


From: Aaron Bach @.> Sent: Monday, April 22, 2024 5:43:51 PM To: home-assistant/core @.> Cc: Brian Rainey @.>; Mention @.> Subject: Re: [home-assistant/core] Simplisafe events dont seem to work in developer tools or automations (Issue #115234)

@freshfieldxhttps://github.com/freshfieldx To be clear, you're now getting this event, but only some of the time?

— Reply to this email directly, view it on GitHubhttps://github.com/home-assistant/core/issues/115234#issuecomment-2070183877, or unsubscribehttps://github.com/notifications/unsubscribe-auth/AO2CM2EPIW4HSJT3NYMZLELY6U44PAVCNFSM6AAAAABF5ILBCWVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDANZQGE4DGOBXG4. You are receiving this because you were mentioned.Message ID: @.***>

bachya commented 2 months ago

Unfortunately, that leads me to believe that it's something going on with the SimpliSafe websocket (and not something I can control). If you can provide more debug-level logs around the times you expect an event to occur, we may be able to diagnose further. Be on the lookout for simplipy messages containing:

freshfieldx commented 2 months ago

Ok, I will take a look.

Are these unrelated:

Logger: homeassistant.components.simplisafe Source: components/simplisafe/init.py:507 integration: SimpliSafe (documentation, issues) First occurred: 18:17:08 (7 occurrences) Last logged: 19:02:13

Unknown exception while connecting to websocket: 'playback/hls'

bachya commented 2 months ago

Ok, I will take a look.

Are these unrelated:

Logger: homeassistant.components.simplisafe Source: components/simplisafe/init.py:507 integration: SimpliSafe (documentation, issues) First occurred: 18:17:08 (7 occurrences) Last logged: 19:02:13

Unknown exception while connecting to websocket: 'playback/hls'

Hard to tell. Depending on what we can dig out of the simplipy logs, I'll see what we can learn.

freshfieldx commented 2 months ago
2024-04-22 20:13:12.290 INFO (MainThread) [simplipy] Websocket watchdog triggered – sleeping for 300.0 seconds
2024-04-22 20:13:12.290 DEBUG (MainThread) [simplipy] Listen completed; cleaning up
2024-04-22 20:13:12.290 ERROR (MainThread) [homeassistant.components.simplisafe] Unknown exception while connecting to websocket: 'playback/hls'
2024-04-22 20:13:12.291 INFO (MainThread) [homeassistant.components.simplisafe] Reconnecting to websocket
2024-04-22 20:13:12.291 DEBUG (MainThread) [homeassistant.components.simplisafe] Websocket reconnection task successfully canceled
2024-04-22 20:13:12.393 INFO (MainThread) [simplipy] Disconnected from websocket server
2024-04-22 20:13:12.833 INFO (MainThread) [custom_components.wiser.coordinator] Hub update completed for WiserHeat028B2B
2024-04-22 20:13:12.886 INFO (MainThread) [simplipy] Connected to websocket server
2024-04-22 20:13:12.886 INFO (MainThread) [simplipy] Websocket watchdog triggered – sleeping for 300.0 seconds
2024-04-22 20:13:12.887 DEBUG (MainThread) [simplipy] Sending data to websocket server: {'datacontenttype': 'application/json', 'type': 'com.simplisafe.connection.identify', 'time': '2024-04-22T19:13:12.887Z', 'id': 'ts:1713813192887', 'specversion': '1.0', 'source': 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/15.0 Safari/605.1.15', 'data': {'auth': {'schema': 'bearer', 'token': 'REDACTED'}, 'join': ['uid:REDACTED']}}
2024-04-22 20:13:12.892 DEBUG (MainThread) [simplipy] Received data from websocket server: {'id': 'ts:1713813192825', 'time': '2024-04-22T19:13:12.000Z', 'type': 'com.simplisafe.service.hello', 'source': 'service', 'specversion': '1.0', 'datacontenttype': 'application/json', 'data': {'key': 'BXYahcnVVJk', 'timeouts': {'heartbeat': 45000, 'inactivity': 30000}}}
2024-04-22 20:13:12.893 INFO (MainThread) [simplipy] Websocket watchdog triggered – sleeping for 300.0 seconds
2024-04-22 20:13:12.996 DEBUG (MainThread) [simplipy] Received data from websocket server: {'id': 'ts:1713813192935', 'time': '2024-04-22T19:13:12.000Z', 'type': 'com.simplisafe.service.registered', 'source': 'service', 'specversion': '1.0', 'datacontenttype': 'application/json'}
2024-04-22 20:13:12.996 INFO (MainThread) [simplipy] Websocket watchdog triggered – sleeping for 300.0 seconds
2024-04-22 20:13:12.998 DEBUG (MainThread) [simplipy] Received data from websocket server: {'id': 'ts:1713813192936', 'time': '2024-04-22T19:13:12.000Z', 'type': 'com.simplisafe.namespace.subscribed', 'source': 'service', 'specversion': '1.0', 'datacontenttype': 'application/json', 'data': {'namespace': 'uid:2446180'}}
2024-04-22 20:13:12.998 INFO (MainThread) [simplipy] Websocket watchdog triggered – sleeping for 300.0 seconds

These logs are from a camera motion that didnt create an event.

bachya commented 2 months ago

Unfortunately, that payload confirms my fear: the websocket is alive and connecting/reconnected as expected, but we aren't seeing anything camera-related. I don't see anything indicating that we got the event and just didn't know how to parse it (which would be suggested by Encountered unknown websocket event type).

Mmozar commented 2 months ago

Do you think SimpliSafe is changing the API or is it likely something else?

bachya commented 2 months ago

I can't say for sure, but I think the most likely possibility is that SimpliSafe's API is flaky—that's something I've grappled with from the integration's very first days. I've reached out to them multiple times with attempts to collaborate, but they appear solidly disinterested.

epauldc29 commented 3 weeks ago

Hey Bachya, It Seems there is an issue where a Code box now shows up for the integration. Any thoughts on how to resolve - the only way to arm or disarm is to manually enter the auth code in the code box:

image
bachya commented 3 weeks ago

Hey Bachya, It Seems there is an issue where a Code box now shows up for the integration. Any thoughts on how to resolve - the only way to arm or disarm is to manually enter the auth code in the code box:

image

This issue is due to a change in the underlying architecture of alarm control panels in general. It's been fixed here (due out in the next beta): https://github.com/home-assistant/core/issues/118759