Skip to content

fix: handle missing playback/hls gracefully in WebsocketEvent#1145

Open
KTibow wants to merge 1 commit into
bachya:devfrom
KTibow:fix/video-links-keyerror
Open

fix: handle missing playback/hls gracefully in WebsocketEvent#1145
KTibow wants to merge 1 commit into
bachya:devfrom
KTibow:fix/video-links-keyerror

Conversation

@KTibow

@KTibow KTibow commented Jun 20, 2026

Copy link
Copy Markdown

Summary

SimpliSafe has started sending playback/flv instead of playback/hls for some camera models (confirmed on SS001). The hardcoded playback/hls key access in WebsocketEvent.__post_init__ causes a KeyError that crashes the entire websocket loop, meaning no further events are received.

This fix:

  • Uses .get() for playback/hls and playback/flv to handle missing keys gracefully
  • Adds a new flv_url field alongside hls_url for FLV-only video links
  • Keeps image_url and clip_url as direct [] access (these are actively used and a missing key there indicates a real API change)
  • Adds a test fixture and test case for FLV-only video events

Testing

Verified with 23 passing tests including the new test_create_motion_event_flv test case.

tests/test_websocket.py::test_create_motion_event PASSED
tests/test_websocket.py::test_create_motion_event_flv PASSED
...
23 passed in 8.07s

Fixes #1144

Disclosure

Drafted by Kimi K2.6 with human oversight

@codecov

codecov Bot commented Jun 20, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 100.00%. Comparing base (ff16fe5) to head (09fa528).

Additional details and impacted files
@@            Coverage Diff            @@
##               dev     #1145   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files           16        16           
  Lines         1020      1021    +1     
=========================================
+ Hits          1020      1021    +1     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@KTibow KTibow force-pushed the fix/video-links-keyerror branch from 9cf4037 to 383509d Compare June 20, 2026 18:27
SimpliSafe has started sending playback/flv instead of playback/hls for
some camera models. The hardcoded playback/hls key access causes a
KeyError that crashes the entire websocket loop.

- Use .get() for playback/hls and playback/flv to handle missing keys
- Add flv_url field alongside hls_url for FLV-only video links
- Keep image_url and clip_url as direct [] access (these are actively
  used and a missing key there indicates a real API change)
- Add test fixture and test case for FLV-only video events

Fixes bachya#1144
@KTibow KTibow force-pushed the fix/video-links-keyerror branch from 383509d to 09fa528 Compare June 20, 2026 18:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Incorrect assumption about playback/hls crashes when just listening for events

1 participant