-
-
Notifications
You must be signed in to change notification settings - Fork 28
Development of Athom Homey Pro integration into NSPanelManager #338
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: devel
Are you sure you want to change the base?
Conversation
Add comprehensive Homey Web API integration documentation outlining architecture, implementation phases, and entity support (lights, switches, buttons, scenes). Document includes setup requirements, configuration details, and real-time WebSocket updates following existing Home Assistant and OpenHAB integration patterns. Additionally, standardize code formatting across Python files by converting single quotes to double quotes for consistency and improving string formatting. Changes: - Add HOMEY_INTEGRATION.md with complete integration specifications - Standardize quote style from single to double quotes - Improve code formatting consistency across web interface files
- Reordered Tailwind CSS classes to follow consistent utility-first pattern (positioning, display, sizing, styling, state classes) - Added Homey controller status indicator alongside Home Assistant and OpenHAB - Improved code readability and maintainability across entity page components - No functional changes to existing features
- Upgrade CMake minimum required version from 3.15 to 3.23 - Modernize CMake syntax (lowercase commands, modern conditionals) - Refactor library creation with reusable add_mqtt_static_lib macro - Use modern FILE_SET HEADERS for better header management - Improve build script organization with clear section headers - Add HomeyScene entity implementation with icon support This modernization enables better dependency management and leverages newer CMake features for more maintainable build configuration.
- Change error to warning when backend_name is empty for Homey scenes - Add default values to prevent crashes when scene is misconfigured - Update log message to provide clearer context about classification issues - Skip Homey initialization gracefully for improperly configured scenes
- Add backend_name handling for homey scene type in create_or_update_scene_entity - Refactor Homey device selection UI with improved JavaScript event handling - Add hidden backend_name field and auto-populate device names from selection - Move device names data structure to improve maintainability
…s for updating a device state
…mostat (use Homey V3 SDK url scheme)
Replace array-based capability loading with explicit mapping from database boolean fields (can_dim, can_color_temperature, can_rgb) to Homey capabilities. Always include onoff capability for lights and add debug logging for mapped capabilities.
Changes the Homey mood API call from '/api/mood/{id}/trigger' to
'/api/manager/mood/mood/{id}/activate' to match the correct Homey API endpoint
for activating moods.
Changes the Homey mood API call from '/api/mood/{id}/trigger' to
'/api/manager/mood/mood/{id}/activate' to match the correct Homey API endpoint
for activating moods.
…ration - Add current and requested state tracking to ButtonEntity - Implement optimistic mode support for button state updates - Fix Homey button integration to send actual state instead of null - Add color temperature conversion utilities for Homey lights - Rename constructor parameter from light_id to button_id for clarity - Add get_state() method to retrieve button state
Fix dangling pointer bug by properly managing Authorization header string lifetime in HomeyScene::activate(). Previously, fmt::format() result was converted to c_str() inline, creating a temporary that would be destroyed before use. Now creates persistent auth_header string variable and corrects header list syntax.
…o /set Update the Homey API endpoint for activating moods from `/activate` to `/set` to match the correct Homey API specification for mood management.
tpanajott
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry for the delay but I got a bit sick over the weekend. Feeling a bit better now again. This all looks quite good but there is a few things that needs to be fixed and a few things that needs to be verified (mostly that all Django templates still work after the HTML formatting).
| this->reload_config(); | ||
|
|
||
| // Build MQTT Topics | ||
| std::string mqtt_base_topic = fmt::format("nspanel/entities/button/{}/", this->_id); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I can't see that this is used anywhere. Is there a reason for it being here?
| /** | ||
| * Get the on/off state of the switch. | ||
| */ | ||
| bool get_state(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This function has not been implemented in the .cpp file.
| HomeyManager::detach_event_observer(this->_homey_device_id, boost::bind(&HomeyButton::homey_event_callback, this, _1)); | ||
| } | ||
|
|
||
| void HomeyButton::send_state_update_to_controller() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is there a reason this is done over HTTP PUT? Does Homey not support doing this over websockets? Websockets would be preferable as we reuse an already established connection and that is therefore faster.
| } | ||
|
|
||
| SPDLOG_DEBUG("Loaded Homey button {}::{}, device ID: {}", this->_id, this->_name, this->_homey_device_id); | ||
| HomeyManager::attach_event_observer(this->_homey_device_id, boost::bind(&HomeyButton::homey_event_callback, this, _1)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As you've written below, buttons are one way only. Perhaps comment out this line and the on in the destructor that attaches event observers as they are not needed?
| EntityManager::_rooms.erase(std::remove_if(EntityManager::_rooms.begin(), EntityManager::_rooms.end(), [&room_ids](auto room) { | ||
| return std::find_if(room_ids.begin(), room_ids.end(), [&room](auto id) { return id == room->get_id(); }) == room_ids.end(); | ||
| }), | ||
| EntityManager::_rooms.erase(std::remove_if(EntityManager::_rooms.begin(), EntityManager::_rooms.end(), [&room_ids](auto room) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This section has become a bit hard to read with the formatting done by your editor.
| if (this->_homey_scene_type == HOMEY_SCENE_TYPE::HOMEY_FLOW) | ||
| { | ||
| // For Flows: POST /api/manager/flow/flow/{flow_id}/trigger | ||
| url = fmt::format("http://{}/api/manager/flow/flow/{}/trigger", homey_address, this->_homey_id); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is it really http and not https?
|
|
||
| // Build MQTT Topics | ||
| std::string mqtt_base_topic = fmt::format("nspanel/entities/light/{}/", this->_id); | ||
| std::string mqtt_base_topic = fmt::format("nspanel/entities/thermostat/{}/", this->_id); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is a relic from previous versions and can be removed.
| /* | ||
| * Perform a HTTP GET or POST request and collect response data. | ||
| * @param url: The URL to perform the HTTP GET or POST request against. | ||
| * Perform a HTTP GET, POST or PUT request and collect response data. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These comments should be split up and only above the functions they are relevant for so that IDEs can give relevant information on mouse hover.
| fi | ||
|
|
||
| if [ "$?" == 0 ]; then | ||
| docker run --name nspanelmanager -v /etc/timezone:/etc/timezone:ro -v "${DATA_VOLUME}":"/data/" -d -p ${PORT}:8000 -p 8001:8001 nspanelmanager |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
While at it I see that I've missed removing port 8001, only port 8000 is used in current version.
| >No smart home system configured! Please configure Home Assistant, | ||
| OpenHAB, or Homey in Settings.</span | ||
| > | ||
| {% endif %} {% if is_home_assistant_configured %} {% if action in |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is somewhat of a problem with HTML formatters when using Django. I've personally turned the formatter off for HTML files as they can mess up Django templates and it's not always the case the Django handles line brakes correctly.
|
Hi, no need to cause any stress. But what's the status? Do you need help? |
No description provided.