From 5b9cc2c131a35049330d02f740ab3cc49d0a4701 Mon Sep 17 00:00:00 2001 From: Michel van de Wetering Date: Mon, 12 Aug 2024 22:07:12 +0200 Subject: [PATCH 1/9] Use better unique_id which resembles actual format --- tests/conftest.py | 4 ++-- tests/test_config_flow.py | 2 +- tests/test_coordinator.py | 4 ++-- tests/test_init.py | 4 ++-- 4 files changed, 7 insertions(+), 7 deletions(-) diff --git a/tests/conftest.py b/tests/conftest.py index 0bcf6f4..93e01a3 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -55,7 +55,7 @@ def mock_api(hass): mock_api.device.api_level = 7 mock_api.device.device_type = "HSB1" mock_api.device.firmware_version = "firmwareversion" - mock_api.device.unique_id = "unique_id" + mock_api.device.unique_id = "123456ABCDEF" # Make sure it resembles real value mock_api.device.led_mode = 1 mock_api.device.ip_address = "1.2.3.4" mock_api.device.wifi = Mock(aiohuesyncbox.device.Wifi) @@ -130,7 +130,7 @@ async def setup_integration( minor_version=2, domain=huesyncbox.DOMAIN, entry_id=entry_id, - unique_id="unique_id", + unique_id="123456ABCDEF", # Make sure it resembles the real format title="HUESYNCBOX TITLE", data={ CONF_HOST: "host_value", diff --git a/tests/test_config_flow.py b/tests/test_config_flow.py index a28f51c..72e0395 100644 --- a/tests/test_config_flow.py +++ b/tests/test_config_flow.py @@ -329,7 +329,7 @@ async def test_zeroconf_already_configured(hass: HomeAssistant, mock_api) -> Non "name": b"Hue Syncbox Name", }, "path": "/different", - "uniqueid": "unique_id", + "uniqueid": "123456ABCDEF", "devicetype": "HSB001", "name": "Hue Syncbox Name", }, diff --git a/tests/test_coordinator.py b/tests/test_coordinator.py index 466ee38..e7a43d1 100644 --- a/tests/test_coordinator.py +++ b/tests/test_coordinator.py @@ -19,7 +19,7 @@ async def test_update_device_registry_and_config_entry_on_name_change( # Verify current name dr = device_registry.async_get(hass) - device = dr.async_get_device(identifiers={(huesyncbox.DOMAIN, "unique_id")}) + device = dr.async_get_device(identifiers={(huesyncbox.DOMAIN, "123456ABCDEF")}) assert device is not None assert device.name == "Name" @@ -34,7 +34,7 @@ async def test_update_device_registry_and_config_entry_on_name_change( await force_coordinator_update(hass) # Check device registry and config entry got updated - device = dr.async_get_device(identifiers={(huesyncbox.DOMAIN, "unique_id")}) + device = dr.async_get_device(identifiers={(huesyncbox.DOMAIN, "123456ABCDEF")}) assert device is not None assert device.name == "New name" diff --git a/tests/test_init.py b/tests/test_init.py index f2e33a8..31ef60d 100644 --- a/tests/test_init.py +++ b/tests/test_init.py @@ -25,14 +25,14 @@ async def test_device_info(hass: HomeAssistant, mock_api): integration = await setup_integration(hass, mock_api) dr = device_registry.async_get(hass) - device = dr.async_get_device(identifiers={(huesyncbox.DOMAIN, "unique_id")}) + device = dr.async_get_device(identifiers={(huesyncbox.DOMAIN, "123456ABCDEF")}) assert device is not None assert device.name == "Name" assert device.manufacturer == "Signify" assert device.model == "HSB1" assert device.sw_version == "firmwareversion" - assert device.connections == {("mac", "unique_id")} + assert device.connections == {("mac", "12:34:56:ab:cd:ef")} async def test_handle_authentication_error_during_setup(hass: HomeAssistant, mock_api): From fc3efb097bc78dfc6478a4a4a1abfa01e3181487 Mon Sep 17 00:00:00 2001 From: Michel van de Wetering Date: Mon, 12 Aug 2024 22:07:30 +0200 Subject: [PATCH 2/9] Clarify that HA will normalize the mac, so I don't need to. --- custom_components/huesyncbox/helpers.py | 1 + 1 file changed, 1 insertion(+) diff --git a/custom_components/huesyncbox/helpers.py b/custom_components/huesyncbox/helpers.py index 3e8431d..83e8ba6 100644 --- a/custom_components/huesyncbox/helpers.py +++ b/custom_components/huesyncbox/helpers.py @@ -27,6 +27,7 @@ async def update_device_registry( sw_version=api.device.firmware_version, # Uniqueid seems to be the mac. Adding the connection allows other integrations # like e.g. Mikrotik Router to link their entities to this device + # HA will normalize the mac address connections={(CONNECTION_NETWORK_MAC, api.device.unique_id)}, ) From 0fc4e6113393ca8a4dcc5f541430205ffa3635a6 Mon Sep 17 00:00:00 2001 From: Michel van de Wetering Date: Sun, 1 Sep 2024 10:59:43 +0200 Subject: [PATCH 3/9] Don't add huesyncbox directory in zip --- .github/workflows/push.yaml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/push.yaml b/.github/workflows/push.yaml index dfd686b..e7ddbd4 100644 --- a/.github/workflows/push.yaml +++ b/.github/workflows/push.yaml @@ -44,8 +44,8 @@ jobs: steps: - uses: actions/checkout@v4 - name: Zip custom components dir - working-directory: "custom_components" - run: zip -r huesyncbox.zip huesyncbox/* + working-directory: "custom_components/huesyncbox" + run: zip -r huesyncbox.zip ./* - name: Create Release id: create_release uses: actions/create-release@v1 # Official Github action From 3d94ba22e7d282387ba5268f32b9fa969c4e4010 Mon Sep 17 00:00:00 2001 From: Michel van de Wetering Date: Sun, 1 Sep 2024 11:02:09 +0200 Subject: [PATCH 4/9] Indicate zip_release to hacs --- hacs.json | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/hacs.json b/hacs.json index 0254405..1303718 100644 --- a/hacs.json +++ b/hacs.json @@ -1,5 +1,7 @@ { "name": "Philips Hue Play HDMI Sync Box", + "homeassistant": "2024.7.0", "render_readme": true, - "homeassistant": "2024.7.0" + "zip_release": true, + "filename": "huesyncbox.zip" } From 0ae3905992066149d3d8879893cf83d506864f47 Mon Sep 17 00:00:00 2001 From: Michel van de Wetering Date: Sun, 1 Sep 2024 11:07:03 +0200 Subject: [PATCH 5/9] Bump aiohuesyncbox to 0.0.30 --- custom_components/huesyncbox/manifest.json | 2 +- requirements.txt | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/custom_components/huesyncbox/manifest.json b/custom_components/huesyncbox/manifest.json index e663866..6e8dcf7 100644 --- a/custom_components/huesyncbox/manifest.json +++ b/custom_components/huesyncbox/manifest.json @@ -12,7 +12,7 @@ "iot_class": "local_polling", "issue_tracker": "https://github.com/mvdwetering/huesyncbox/issues", "loggers": ["aiohuesyncbox"], - "requirements": ["aiohuesyncbox==0.0.28"], + "requirements": ["aiohuesyncbox==0.0.30"], "version": "0.0.0", "zeroconf": ["_huesync._tcp.local."] } diff --git a/requirements.txt b/requirements.txt index 1207135..a36be68 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,2 +1,2 @@ # Must be same as in the manifest -aiohuesyncbox==0.0.28 +aiohuesyncbox==0.0.30 From 81e92b212d7683018669db3bce7340ad295f8a59 Mon Sep 17 00:00:00 2001 From: Michel van de Wetering Date: Sun, 1 Sep 2024 12:00:32 +0200 Subject: [PATCH 6/9] Apparently progress catching not needed anymore?? --- tests/test_config_flow.py | 10 ---------- 1 file changed, 10 deletions(-) diff --git a/tests/test_config_flow.py b/tests/test_config_flow.py index 72e0395..9aba91b 100644 --- a/tests/test_config_flow.py +++ b/tests/test_config_flow.py @@ -181,16 +181,6 @@ async def test_user_box_connection_errors_during_link( ) await hass.async_block_till_done() - assert result["type"] == FlowResultType.SHOW_PROGRESS - assert result["step_id"] == "link" - assert result["progress_action"] == "wait_for_button" - - # Trigger to get out of progress - result = await hass.config_entries.flow.async_configure( - result["flow_id"], - ) - await hass.async_block_till_done() - assert result["type"] == FlowResultType.ABORT assert result["reason"] == "connection_failed" From b3c937f20fae8b8c2b7b1a11039d1ce797d0fb17 Mon Sep 17 00:00:00 2001 From: Michel van de Wetering Date: Sun, 1 Sep 2024 16:04:21 +0200 Subject: [PATCH 7/9] Rename services to actions --- README.md | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/README.md b/README.md index 829d597..0718f67 100644 --- a/README.md +++ b/README.md @@ -6,7 +6,7 @@ Custom integration for the Philips Hue Play HDMI Sync Box. - [About](#about) - [Behavior](#behavior) - - [Services](#services) + - [Actions](#actions) - [Updating from before version 2](#updating-from-before-version-20) - [Installation](#installation) - [Home Assistant Community Store (recommended)](#home-assistant-community-store-hacs) @@ -46,15 +46,15 @@ A few notes on behavior when changing entities. Note that this behavior is just * Enabling light sync will also power on the box * Setting sync mode will also power on the box and start light sync on the selected mode -* When you want to change multiple entities the order is important. For example, Intensity applies to the current selected mode. So if you want to change both the `intensity` and `mode` you _first_ have to change the mode and then set the intensity. Otherwise, the intensity is applied to the "old" mode. If you want to avoid ordering issues you can use the `set_sync_state` service which will take care of the ordering and is more efficient than sending everything separately. +* When you want to change multiple entities the order is important. For example, Intensity applies to the current selected mode. So if you want to change both the `intensity` and `mode` you _first_ have to change the mode and then set the intensity. Otherwise, the intensity is applied to the "old" mode. If you want to avoid ordering issues you can use the `set_sync_state` action which will take care of the ordering and is more efficient than sending everything separately. -### Services +### Actions -The integration exposes some additional services. +The integration exposes some additional actions. -For the parameter descriptions use the Services tab in the Home Assistant Developer tools and search for `huesyncbox` in the services list. +For the parameter descriptions use the Actions tab in the Home Assistant Developer tools and search for `huesyncbox` in the actions list. -| Service name | Description | +| Action name | Description | |---|---| | set_bridge | Set the bridge to be used by the Philips Hue Play HDMI Syncbox. | | set_sync_state | Set the state of multiple features of the Philips Hue Play HDMI Syncbox at once. Makes sure everything is set in the correct order and is more efficient compared to using separate commands. | From 0e90d7f962436f593bae692b9cbb39ef5233fc5c Mon Sep 17 00:00:00 2001 From: Michel van de Wetering Date: Sun, 1 Sep 2024 17:04:56 +0200 Subject: [PATCH 8/9] Fix path to zip release file --- .github/workflows/push.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/push.yaml b/.github/workflows/push.yaml index e7ddbd4..d4bf96d 100644 --- a/.github/workflows/push.yaml +++ b/.github/workflows/push.yaml @@ -67,6 +67,6 @@ jobs: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} with: upload_url: ${{ steps.create_release.outputs.upload_url }} # This pulls from the CREATE RELEASE step above, referencing it's ID to get its outputs object, which include a `upload_url`. See this blog post for more info: https://jasonet.co/posts/new-features-of-github-actions/#passing-data-to-future-steps - asset_path: ./custom_components/huesyncbox.zip + asset_path: ./custom_components/huesyncbox/huesyncbox.zip asset_name: huesyncbox.zip asset_content_type: application/zip From aa2548ce908f6b932c960c885388e17ba28c274e Mon Sep 17 00:00:00 2001 From: Michel van de Wetering Date: Sun, 1 Sep 2024 18:03:21 +0200 Subject: [PATCH 9/9] Update version to 2.2.4 --- custom_components/huesyncbox/manifest.json | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/custom_components/huesyncbox/manifest.json b/custom_components/huesyncbox/manifest.json index 6e8dcf7..1ad6e85 100644 --- a/custom_components/huesyncbox/manifest.json +++ b/custom_components/huesyncbox/manifest.json @@ -1,7 +1,6 @@ { "domain": "huesyncbox", "name": "Philips Hue Play HDMI Sync Box", - "codeowners": [ "@mvdwetering" ], @@ -11,8 +10,14 @@ "integration_type": "device", "iot_class": "local_polling", "issue_tracker": "https://github.com/mvdwetering/huesyncbox/issues", - "loggers": ["aiohuesyncbox"], - "requirements": ["aiohuesyncbox==0.0.30"], - "version": "0.0.0", - "zeroconf": ["_huesync._tcp.local."] + "loggers": [ + "aiohuesyncbox" + ], + "requirements": [ + "aiohuesyncbox==0.0.30" + ], + "version": "2.2.4", + "zeroconf": [ + "_huesync._tcp.local." + ] }