Skip to content

Commit

Permalink
Release v2.3.0
Browse files Browse the repository at this point in the history
  • Loading branch information
mvdwetering committed Sep 21, 2024
2 parents 6296df1 + bc81d7c commit 05d76d6
Show file tree
Hide file tree
Showing 13 changed files with 751 additions and 83 deletions.
37 changes: 2 additions & 35 deletions .github/workflows/push.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@ on:
push:
branches:
- dev
- master
- master
- release/*
pull_request:
schedule:
- cron: "0 0 * * *"
Expand Down Expand Up @@ -36,37 +37,3 @@ jobs:
uses: "hacs/action@main"
with:
category: "integration"

release:
if: ${{ startsWith(github.ref, 'refs/tags/v') }}
needs: validate
runs-on: "ubuntu-latest"
steps:
- uses: actions/checkout@v4
- name: Zip custom components dir
working-directory: "custom_components/huesyncbox"
run: zip -r huesyncbox.zip ./*
- name: Create Release
id: create_release
uses: actions/create-release@v1 # Official Github action
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # This token is provided by Actions, you do not need to create your own token
with:
tag_name: ${{ github.ref }}
release_name: ${{ github.ref }}
# body: |
# Changes in this Release
# - First Change
# - Second Change
draft: true
prerelease: false
- name: Upload Release Asset
id: upload-release-asset
uses: actions/upload-release-asset@v1
env:
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/huesyncbox.zip
asset_name: huesyncbox.zip
asset_content_type: application/zip
38 changes: 38 additions & 0 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
name: Create release from tag

on:
push:
tags:
- 'v[0-9]+.[0-9]+.[0-9]+'

jobs:
release:
runs-on: "ubuntu-latest"
steps:
- uses: actions/checkout@v4

- run: |
echo Checkout done for $GITHUB_REF
- name: Figure out integration name
run: |
INTEGRATION_SUBDIR=$(ls -d custom_components/*/)
echo "INTEGRATION_NAME=$(echo $INTEGRATION_SUBDIR | cut -d'/' -f2)" >> $GITHUB_ENV
echo Integration name: ${{ env.INTEGRATION_NAME }}
- name: Zip custom components dir
working-directory: "custom_components/${{ env.INTEGRATION_NAME }}"
run: zip -r ${{ env.INTEGRATION_NAME }}.zip ./*

- name: Create Release
# Started from: https://stackoverflow.com/questions/75679683/how-can-i-auto-generate-a-release-note-and-create-a-release-using-github-actions
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
tag: ${{ github.ref_name }}
# --discussion-category "General" not possible for draft releases :/
run: |
gh release create "$tag" "./custom_components/${{ env.INTEGRATION_NAME }}/${{ env.INTEGRATION_NAME }}.zip" \
--repo="$GITHUB_REPOSITORY" \
--title="$tag" \
--generate-notes \
--draft
7 changes: 4 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@

[![Contributors](https://img.shields.io/github/contributors/mvdwetering/huesyncbox.svg)](https://github.com/mvdwetering/huesyncbox/graphs/contributors)

Custom integration for the Philips Hue Play HDMI Sync Box.
Custom integration for the Philips Hue Play HDMI Sync Box.
Both 4K and 8K are supported.

- [About](#about)
- [Behavior](#behavior)
Expand Down Expand Up @@ -30,7 +31,7 @@ The following features are available:
* Brightness control
* Entertainment area selection
* HDMI input connection status
* Dolby Vision compatibility on/off
* Dolby Vision compatibility on/off (only on 4K)
* LED indicator mode
* Bridge connection status ⁺
* Bridge ID ⁺
Expand All @@ -57,7 +58,7 @@ For the parameter descriptions use the Actions tab in the Home Assistant Develop
| 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. |
| 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 than using separate commands. |

## Updating from before version 2.0

Expand Down
88 changes: 84 additions & 4 deletions custom_components/huesyncbox/icons.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,86 @@
{
"services": {
"set_bridge": "mdi:bridge",
"set_sync_state": "mdi:sync"
"entity": {
"number": {
"brightness": {
"default": "mdi:brightness-5"
}
},
"select": {
"hdmi_input": {
"default": "mdi:hdmi-port"
},
"entertainment_area": {
"default": "mdi:lamps"
},
"intensity": {
"default": "mdi:sine-wave"
},
"sync_mode": {
"default": "mdi:multimedia"
},
"led_indicator_mode": {
"default": "mdi:led-variant-on",
"state": {
"off": "mdi:led-variant-off",
"dimmed": "mdi:led-variant-on",
"normal": "mdi:led-on"
}
}
},
"sensor": {
"bridge_connection_state": {
"default": "mdi:connection"
},
"bridge_unique_id": {
"default": "mdi:bridge"
},
"hdmi1_status": {
"default": "mdi:video-input-hdmi"
},
"hdmi2_status": {
"default": "mdi:video-input-hdmi"
},
"hdmi3_status": {
"default": "mdi:video-input-hdmi"
},
"hdmi4_status": {
"default": "mdi:video-input-hdmi"
},
"ip_address": {
"default": "mdi:ip-network"
},
"wifi_strength": {
"default": "mdi:wifi-strength-outline",
"state": {
"not_connected": "mdi:wifi-strength-off-outline",
"weak": "mdi:wifi-strength-1",
"fair": "mdi:wifi-strength-2",
"good": "mdi:wifi-strength-3",
"excellent": "mdi:wifi-strength-4"
}
},
"content_info": {
"default": "mdi:aspect-ratio"
}
},
"switch": {
"power": {
"default": "mdi:power"
},
"light_sync": {
"default": "mdi:television-ambient-light"
},
"dolby_vision_compatibility": {
"default": "mdi:hdr"
}
}
}
},
"services": {
"set_bridge": {
"service": "mdi:bridge"
},
"set_sync_state": {
"service": "mdi:sync"
}
}
}
4 changes: 2 additions & 2 deletions custom_components/huesyncbox/manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@
"requirements": [
"aiohuesyncbox==0.0.30"
],
"version": "2.2.4",
"version": "2.3.0",
"zeroconf": [
"_huesync._tcp.local."
]
}
}
1 change: 0 additions & 1 deletion custom_components/huesyncbox/number.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@ async def set_brightness(api: aiohuesyncbox.HueSyncBox, brightness):
ENTITY_DESCRIPTIONS = [
HueSyncBoxNumberEntityDescription( # type: ignore
key="brightness", # type: ignore
icon="mdi:brightness-5", # type: ignore
native_max_value=100, # type: ignore
native_min_value=1, # type: ignore
native_step=1, # type: ignore
Expand Down
4 changes: 0 additions & 4 deletions custom_components/huesyncbox/select.py
Original file line number Diff line number Diff line change
Expand Up @@ -118,22 +118,19 @@ async def select_led_indicator_mode(api: aiohuesyncbox.HueSyncBox, mode):
ENTITY_DESCRIPTIONS = [
HueSyncBoxSelectEntityDescription( # type: ignore
key="hdmi_input", # type: ignore
icon="mdi:hdmi-port", # type: ignore
options_fn=available_inputs,
current_option_fn=current_input,
select_option_fn=select_input,
),
HueSyncBoxSelectEntityDescription( # type: ignore
key="entertainment_area", # type: ignore
icon="mdi:lamps", # type: ignore
entity_category=EntityCategory.CONFIG, # type: ignore
options_fn=available_entertainment_areas,
current_option_fn=current_entertainment_area,
select_option_fn=select_entertainment_area,
),
HueSyncBoxSelectEntityDescription( # type: ignore
key="intensity", # type: ignore
icon="mdi:sine-wave", # type: ignore
options=INTENSITIES, # type: ignore
current_option_fn=current_intensity,
select_option_fn=select_intensity,
Expand All @@ -146,7 +143,6 @@ async def select_led_indicator_mode(api: aiohuesyncbox.HueSyncBox, mode):
),
HueSyncBoxSelectEntityDescription( # type: ignore
key="led_indicator_mode", # type: ignore
icon="mdi:alarm-light", # type: ignore
entity_category=EntityCategory.CONFIG, # type: ignore
options=sorted(LED_INDICATOR_MODES), # type: ignore
current_option_fn=current_led_indicator_mode,
Expand Down
39 changes: 10 additions & 29 deletions custom_components/huesyncbox/sensor.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@
@dataclass(frozen=True, kw_only=True)
class HueSyncBoxSensorEntityDescription(SensorEntityDescription):
get_value: Callable[[aiohuesyncbox.HueSyncBox], str] = None # type: ignore[assignment]
icons: dict[str, str] | None = None


WIFI_STRENGTH_STATES = {
Expand All @@ -29,81 +28,72 @@ class HueSyncBoxSensorEntityDescription(SensorEntityDescription):
4: "excellent",
}

WIFI_STRENGTH_ICONS = {
"not_connected": "mdi:wifi-strength-off-outline",
"weak": "mdi:wifi-strength-1",
"fair": "mdi:wifi-strength-2",
"good": "mdi:wifi-strength-3",
"excellent": "mdi:wifi-strength-4",
}

ENTITY_DESCRIPTIONS = [
HueSyncBoxSensorEntityDescription( # type: ignore
key="bridge_connection_state", # type: ignore
icon="mdi:connection", # type: ignore
entity_category=EntityCategory.DIAGNOSTIC, # type: ignore
entity_registry_enabled_default=False, # type: ignore
device_class=SensorDeviceClass.ENUM, # type: ignore
options=["uninitialized", "disconnected", "connecting", "unauthorized", "connected", "invalidgroup", "streaming", "busy"], # type: ignore
options=[
"uninitialized",
"disconnected",
"connecting",
"unauthorized",
"connected",
"invalidgroup",
"streaming",
"busy",
], # type: ignore
get_value=lambda api: api.hue.connection_state,
),
HueSyncBoxSensorEntityDescription( # type: ignore
key="bridge_unique_id", # type: ignore
icon="mdi:bridge", # type: ignore
entity_category=EntityCategory.DIAGNOSTIC, # type: ignore
entity_registry_enabled_default=False, # type: ignore
get_value=lambda api: api.hue.bridge_unique_id,
),
HueSyncBoxSensorEntityDescription( # type: ignore
key="hdmi1_status", # type: ignore
icon="mdi:video-input-hdmi", # type: ignore
entity_category=EntityCategory.DIAGNOSTIC, # type: ignore
device_class=SensorDeviceClass.ENUM, # type: ignore
options=["unplugged", "plugged", "linked", "unknown"], # type: ignore
get_value=lambda api: api.hdmi.input1.status,
),
HueSyncBoxSensorEntityDescription( # type: ignore
key="hdmi2_status", # type: ignore
icon="mdi:video-input-hdmi", # type: ignore
entity_category=EntityCategory.DIAGNOSTIC, # type: ignore
device_class=SensorDeviceClass.ENUM, # type: ignore
options=["unplugged", "plugged", "linked", "unknown"], # type: ignore
get_value=lambda api: api.hdmi.input2.status,
),
HueSyncBoxSensorEntityDescription( # type: ignore
key="hdmi3_status", # type: ignore
icon="mdi:video-input-hdmi", # type: ignore
entity_category=EntityCategory.DIAGNOSTIC, # type: ignore
device_class=SensorDeviceClass.ENUM, # type: ignore
options=["unplugged", "plugged", "linked", "unknown"], # type: ignore
get_value=lambda api: api.hdmi.input3.status,
),
HueSyncBoxSensorEntityDescription( # type: ignore
key="hdmi4_status", # type: ignore
icon="mdi:video-input-hdmi", # type: ignore
entity_category=EntityCategory.DIAGNOSTIC, # type: ignore
device_class=SensorDeviceClass.ENUM, # type: ignore
options=["unplugged", "plugged", "linked", "unknown"], # type: ignore
get_value=lambda api: api.hdmi.input4.status,
),
HueSyncBoxSensorEntityDescription( # type: ignore
key="ip_address", # type: ignore
icon="mdi:ip-network", # type: ignore
entity_category=EntityCategory.DIAGNOSTIC, # type: ignore
entity_registry_enabled_default=False, # type: ignore
get_value=lambda api: api.device.ip_address,
),
HueSyncBoxSensorEntityDescription( # type: ignore
key="wifi_strength", # type: ignore
# icon="mdi:wifi", # type: ignore
icons=WIFI_STRENGTH_ICONS,
entity_category=EntityCategory.DIAGNOSTIC, # type: ignore
entity_registry_enabled_default=False, # type: ignore
get_value=lambda api: WIFI_STRENGTH_STATES[api.device.wifi.strength], # type: ignore
),
HueSyncBoxSensorEntityDescription( # type: ignore
key="content_info", # type: ignore
icon="mdi:aspect-ratio", # type: ignore
entity_category=EntityCategory.DIAGNOSTIC, # type: ignore
entity_registry_enabled_default=False, # type: ignore
get_value=lambda api: api.hdmi.content_specs, # type: ignore
Expand Down Expand Up @@ -154,12 +144,3 @@ def __init__(
def native_value(self) -> str | None:
"""Return the state of the sensor."""
return self.entity_description.get_value(self.coordinator.api)

@property
def icon(self) -> str | None:
"""Return the icon."""
if self.entity_description.icons is not None:
return self.entity_description.icons[
self.entity_description.get_value(self.coordinator.api)
]
return super().icon
3 changes: 0 additions & 3 deletions custom_components/huesyncbox/switch.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,21 +24,18 @@ class HueSyncBoxSwitchEntityDescription(SwitchEntityDescription):
ENTITY_DESCRIPTIONS = [
HueSyncBoxSwitchEntityDescription( # type: ignore
key="power", # type: ignore
icon="mdi:power", # type: ignore
is_on=lambda api: api.execution.mode != "powersave",
turn_on=lambda api: api.execution.set_state(mode="passthrough"),
turn_off=lambda api: api.execution.set_state(mode="powersave"),
),
HueSyncBoxSwitchEntityDescription( # type: ignore
key="light_sync", # type: ignore
icon="mdi:television-ambient-light", # type: ignore
is_on=lambda api: api.execution.mode not in ["powersave", "passthrough"],
turn_on=lambda api: api.execution.set_state(sync_active=True),
turn_off=lambda api: api.execution.set_state(sync_active=False),
),
HueSyncBoxSwitchEntityDescription( # type: ignore
key="dolby_vision_compatibility", # type: ignore
icon="mdi:hdr", # type: ignore
entity_category=EntityCategory.CONFIG, # type: ignore
is_on=lambda api: api.behavior.force_dovi_native == 1,
turn_on=lambda api: api.behavior.set_force_dovi_native(1),
Expand Down
Loading

0 comments on commit 05d76d6

Please sign in to comment.