Skip to content

Add get_nvr_events and inject_events_into_camera#103

Merged
mezz64 merged 4 commits into
mezz64:masterfrom
ptarjan:claude/add-nvr-event-methods-01JJYTcD6PJAVCX9iCck2EWi
Dec 18, 2025
Merged

Add get_nvr_events and inject_events_into_camera#103
mezz64 merged 4 commits into
mezz64:masterfrom
ptarjan:claude/add-nvr-event-methods-01JJYTcD6PJAVCX9iCck2EWi

Conversation

@ptarjan
Copy link
Copy Markdown
Contributor

@ptarjan ptarjan commented Dec 8, 2025

Pull out the get_nvr_events and inject_events_into_camera from home-assistant/core#158279

These functions extend the event detection capabilities to support NVRs
with non-standard notification methods (record, email, beep) in addition
to the existing 'center' and 'HTTP' methods.

- get_nvr_events: Fetches events from NVR with broader notification support
- inject_events_into_camera: Injects discovered events into HikCamera
- HikCamera.inject_events: New method to inject events into camera's state

Based on home-assistant/core#158279
Tests cover:
- Parsing NVR events with various notification methods (record, email, beep, center)
- Skipping videoloss events (used for watchdog)
- Handling connection errors gracefully
- Handling non-200 responses
- Handling invalid XML
- Injecting events into camera event_states
- Preventing duplicate channel events
@ptarjan
Copy link
Copy Markdown
Contributor Author

ptarjan commented Dec 17, 2025

Gentle ping

Comment thread pyhik/hikvision.py Outdated
Comment thread pyhik/hikvision.py
Instead of a separate get_nvr_events function, extend the existing
get_event_triggers method to accept a notification_methods parameter.
This allows users to specify which notification methods to accept
(defaults to {'center', 'HTTP'} for backwards compatibility).

For NVRs, users can pass VALID_NOTIFICATION_METHODS which includes
'record', 'email', and 'beep' in addition to the defaults.

Changes:
- Add notification_methods parameter to get_event_triggers()
- Remove duplicate get_nvr_events function
- Export VALID_NOTIFICATION_METHODS constant for easy use
- Update tests to cover new parameter functionality
Comment thread pyhik/hikvision.py
@mezz64 mezz64 merged commit 1e2d25f into mezz64:master Dec 18, 2025
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.

3 participants