Add support for OpenWebNet Camera/Multimedia system (WHO 7)#46
Add support for OpenWebNet Camera/Multimedia system (WHO 7)#46
Conversation
Co-authored-by: jotonedev <32454983+jotonedev@users.noreply.github.com>
Co-authored-by: jotonedev <32454983+jotonedev@users.noreply.github.com>
Co-authored-by: jotonedev <32454983+jotonedev@users.noreply.github.com>
Co-authored-by: jotonedev <32454983+jotonedev@users.noreply.github.com>
There was a problem hiding this comment.
Pull Request Overview
This PR adds comprehensive support for the OpenWebNet Camera/Multimedia system (WHO = 7), enabling control of video door entry systems and cameras. The implementation includes all 32 commands from the OpenWebNet specification for video control, zoom, positioning, and image adjustments.
Key Changes:
- New
Cameraclass with support for all WHO=7 commands including video control, zoom, positioning, and image adjustments - Proper handling of two message formats: commands with WHERE parameter (using
NormalMessage) and without WHERE (usingGenericMessage) - Complete documentation, working examples, and comprehensive unit tests
Reviewed Changes
Copilot reviewed 8 out of 8 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| pyown/items/camera/camera.py | Core camera implementation with Camera class, WhatCamera enum (32 commands), and CameraEvents enum |
| pyown/items/camera/init.py | Module exports for camera components |
| pyown/items/init.py | Integration of camera module into items package |
| tests/items/test_camera.py | Unit tests validating message formats, command values, and class structure |
| examples/camera_01/main.py | Working example demonstrating camera control usage |
| examples/camera_01/README.md | Example documentation |
| docs/api/items/camera.md | Complete API documentation with usage examples |
| CAMERA_IMPLEMENTATION.md | Detailed implementation summary and design decisions |
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
pyown/items/camera/camera.py
Outdated
| dial_map = { | ||
| (1, 1): WhatCamera.DISPLAY_DIAL_11, | ||
| (1, 2): WhatCamera.DISPLAY_DIAL_12, | ||
| (1, 3): WhatCamera.DISPLAY_DIAL_13, | ||
| (1, 4): WhatCamera.DISPLAY_DIAL_14, | ||
| (2, 1): WhatCamera.DISPLAY_DIAL_21, | ||
| (2, 2): WhatCamera.DISPLAY_DIAL_22, | ||
| (2, 3): WhatCamera.DISPLAY_DIAL_23, | ||
| (2, 4): WhatCamera.DISPLAY_DIAL_24, | ||
| (3, 1): WhatCamera.DISPLAY_DIAL_31, | ||
| (3, 2): WhatCamera.DISPLAY_DIAL_32, | ||
| (3, 3): WhatCamera.DISPLAY_DIAL_33, | ||
| (3, 4): WhatCamera.DISPLAY_DIAL_34, | ||
| (4, 1): WhatCamera.DISPLAY_DIAL_41, | ||
| (4, 2): WhatCamera.DISPLAY_DIAL_42, | ||
| (4, 3): WhatCamera.DISPLAY_DIAL_43, | ||
| (4, 4): WhatCamera.DISPLAY_DIAL_44, | ||
| } |
There was a problem hiding this comment.
The dial_map dictionary is recreated on every call to display_dial(). Consider moving this to a class-level constant to avoid unnecessary allocations on repeated calls.
☂️ Python Coverage
Overall Coverage
New Files
Modified Files
|
There was a problem hiding this comment.
Pull Request Overview
Copilot reviewed 8 out of 8 changed files in this pull request and generated no new comments.
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
Overview
This PR adds complete support for the OpenWebNet Camera/Multimedia system (WHO = 7) to control video door entry systems and cameras through the OpenWebNet protocol.
Implementation Details
New Camera Module
Added a new
cameramodule underpyown/items/with:Cameraclass: Main class for controlling camera devices, inheriting fromBaseItemWhatCameraenum: Defines all 32 camera commands from the OpenWebNet specificationCameraEventsenum: Event types for callback registrationSupported Commands
The implementation includes all commands from the WHO 7 specification:
Video Control:
receive_video()- Activate camera to receive video (WHAT=0)free_resources()- Free audio/video resources (WHAT=9)Zoom & Positioning:
zoom_in(),zoom_out()- Zoom controlsincrease_x_coordinate(),decrease_x_coordinate()- Horizontal positioningincrease_y_coordinate(),decrease_y_coordinate()- Vertical positioningImage Adjustments:
increase_luminosity(),decrease_luminosity()- Brightness controlincrease_contrast(),decrease_contrast()- Contrast controlincrease_color(),decrease_color()- Color saturation controlincrease_quality(),decrease_quality()- Image quality controlDisplay Control:
display_dial(x, y)- Display specific dial positions (16 positions: 1-1 through 4-4)Message Format Handling
The implementation correctly handles two different OpenWebNet message formats:
Commands with WHERE (e.g., receive_video):
Uses
NormalMessageclass.Commands without WHERE (e.g., zoom, adjustments):
Uses
GenericMessageclass via_send_command_without_where()helper method.Camera Addressing
Cameras use WHERE addresses 4000-4099:
Video Streaming
Note: The OpenWebNet protocol only handles camera control commands. The actual video streaming is done via HTTP/HTTPS at the gateway's endpoint (e.g.,
http://gateway-ip/telecamera.php). This implementation intentionally does not include an HTTP client, focusing solely on the OpenWebNet protocol commands as requested.Usage Example
Files Changed
pyown/items/camera/(camera.py, init.py)pyown/items/__init__.pyto export camera moduledocs/api/items/camera.mdwith complete API referenceexamples/camera_01/with working demonstrationtests/items/test_camera.pywith comprehensive unit testsCAMERA_IMPLEMENTATION.mdwith detailed implementation notesCode Quality
Testing
All functionality has been validated:
References
docs/original/who7.mdOriginal prompt
💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.