Skip to content

Commit baf659f

Browse files
alexdelpreteEPMatt
andauthored
(Z2M) OSRAM AC025XX00NJ / Philips 8718699693985: fix and update (#615)
* Updated actions_mapping for Zigbee2MQTT Updated Actions Mapping as per Z2M docs: https://www.zigbee2mqtt.io/devices/AC0251100NJ_AC0251600NJ_AC0251700NJ.html#actions * Added Zigbee2MQTT support for Philips 8718699693985 Hue Smart Button * copy new helper json marshaling from ikea controllers, bump version to 2025.01.05 * docs: add z2m support, update changelog --------- Co-authored-by: EPMatt <[email protected]>
1 parent 20ef4e4 commit baf659f

File tree

4 files changed

+56
-15
lines changed

4 files changed

+56
-15
lines changed

blueprints/controllers/osram_ac025xx00nj/osram_ac025xx00nj.yaml

+14-11
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,11 @@ blueprint:
1515
1616
🚀 This blueprint is part of the **[Awesome HA Blueprints](https://epmatt.github.io/awesome-ha-blueprints) project**.
1717
18-
ℹ️ Version 2022.08.08
18+
ℹ️ Version 2025.01.05
1919
source_url: https://github.com/EPMatt/awesome-ha-blueprints/blob/main/blueprints/controllers/osram_ac025xx00nj/osram_ac025xx00nj.yaml
2020
domain: automation
21+
homeassistant:
22+
min_version: 2023.5.0
2123
input:
2224
integration:
2325
name: (Required) Integration
@@ -264,15 +266,16 @@ variables:
264266
button_down_long: [move]
265267
button_down_release: [stop]
266268
zigbee2mqtt:
267-
button_up_short: [up]
268-
button_up_long: [up_hold]
269-
button_up_release: [up_release]
270-
button_center_short: [circle_click]
271-
button_center_long: [circle_hold]
272-
button_center_release: [circle_release]
273-
button_down_short: [down]
274-
button_down_long: [down_hold]
275-
button_down_release: [down_release]
269+
# source: https://www.zigbee2mqtt.io/devices/AC0251100NJ_AC0251600NJ_AC0251700NJ.html#actions
270+
button_up_short: ['on']
271+
button_up_long: [brightness_move_up]
272+
button_up_release: [brightness_stop]
273+
button_center_short: [brightness_move_to_level]
274+
button_center_long: [move_to_saturation]
275+
button_center_release: [hue_stop]
276+
button_down_short: ['off']
277+
button_down_long: [brightness_move_down]
278+
button_down_release: [brightness_stop]
276279
# pre-choose actions for buttons based on configured integration
277280
# no need to perform this task at automation runtime
278281
button_up_short: '{{ actions_mapping[integration_id]["button_up_short"] }}'
@@ -338,7 +341,7 @@ action:
338341
{%- elif integration_id == "zha" -%}
339342
{{ trigger.event.data.command }}
340343
{%- endif -%}
341-
trigger_delta: '{{ (as_timestamp(now()) - ((states(helper_last_controller_event) | from_json).t if helper_last_controller_event is not none and (states(helper_last_controller_event) | regex_match("^\{((\"a\": \".*\"|\"t\": \d+\.\d+)(, )?){2}\}$")) else as_timestamp("1970-01-01 00:00:00"))) * 1000 }}'
344+
trigger_delta: '{{ (as_timestamp(now()) - ((states(helper_last_controller_event) | from_json).t if helper_last_controller_event is not none and (states(helper_last_controller_event) | regex_match("^\{((\"a\":\".*\"|\"t\":\d+\.\d+)(,)?){2}\}$")) else as_timestamp("1970-01-01 00:00:00"))) * 1000 }}'
342345
# update helper
343346
- service: input_text.set_value
344347
data:

blueprints/controllers/philips_8718699693985/philips_8718699693985.yaml

+29-4
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ blueprint:
55
# Controller - Philips 8718699693985 Hue Smart Button
66
77
Controller automation for executing any kind of action triggered by the provided Philips 8718699693985 Hue Smart Button. Allows to optionally loop an action on a button long press.
8-
Supports deCONZ, ZHA.
8+
Supports deCONZ, ZHA, Zigbee2MQTT.
99
1010
Automations created with this blueprint can be connected with one or more [Hooks](https://epmatt.github.io/awesome-ha-blueprints/docs/blueprints/hooks) supported by this controller.
1111
Hooks allow to easily create controller-based automations for interacting with media players, lights, covers and more.
@@ -15,9 +15,11 @@ blueprint:
1515
1616
🚀 This blueprint is part of the **[Awesome HA Blueprints](https://epmatt.github.io/awesome-ha-blueprints) project**.
1717
18-
ℹ️ Version 2022.08.08
18+
ℹ️ Version 2025.01.05
1919
source_url: https://github.com/EPMatt/awesome-ha-blueprints/blob/main/blueprints/controllers/philips_8718699693985/philips_8718699693985.yaml
2020
domain: automation
21+
homeassistant:
22+
min_version: 2023.5.0
2123
input:
2224
integration:
2325
name: (Required) Integration
@@ -27,12 +29,20 @@ blueprint:
2729
options:
2830
- deCONZ
2931
- ZHA
32+
- Zigbee2MQTT
3033
controller_device:
3134
name: (deCONZ, ZHA) Controller Device
3235
description: The controller device to use for the automation. Choose a value only if the remote is integrated with deCONZ, ZHA.
3336
default: ''
3437
selector:
3538
device:
39+
controller_entity:
40+
name: (Zigbee2MQTT) Controller Entity
41+
description: The action sensor of the controller to use for the automation. Choose a value only if the remote is integrated with Zigbee2MQTT.
42+
default: ''
43+
selector:
44+
entity:
45+
domain: sensor
3646
helper_last_controller_event:
3747
name: (Required) Helper - Last Controller Event
3848
description: Input Text used to store the last event fired by the controller. You will need to manually create a text input entity for this, please read the blueprint Additional Notes for more info.
@@ -141,17 +151,28 @@ variables:
141151
button_short: [on_short_release]
142152
button_long: [on_hold]
143153
button_release: [on_long_release]
154+
zigbee2mqtt:
155+
# source: https://www.zigbee2mqtt.io/devices/8718699693985.html#action-enum
156+
button_short: [press]
157+
button_long: [hold]
158+
button_release: [release]
144159
# pre-choose actions for buttons based on configured integration
145160
# no need to perform this task at automation runtime
146161
button_short: '{{ actions_mapping[integration_id]["button_short"] }}'
147162
button_long: '{{ actions_mapping[integration_id]["button_long"] }}'
148163
button_release: '{{ actions_mapping[integration_id]["button_release"] }}'
149164
# build data to send within a controller event
165+
controller_entity: !input controller_entity
150166
controller_device: !input controller_device
151-
controller_id: '{{controller_device}}'
167+
controller_id: '{% if integration_id=="zigbee2mqtt" %}{{controller_entity}}{% else %}{{controller_device}}{% endif %}'
152168
mode: restart
153169
max_exceeded: silent
154170
trigger:
171+
# trigger for zigbee2mqtt
172+
- platform: event
173+
event_type: state_changed
174+
event_data:
175+
entity_id: !input controller_entity
155176
# trigger for other integrations
156177
- platform: event
157178
event_type:
@@ -172,6 +193,10 @@ condition:
172193
{%- endif -%}
173194
{%- endset -%}
174195
{{ trigger_action not in ["","None"] }}
196+
# only for zigbee2mqtt, check if the event is relative to a real state change, and not only some minor changes in the sensor attributes
197+
# this is required since multiple state_changed events are fired for a single button press, with the result of the automation being triggered multiple times
198+
- '{{ integration_id != "zigbee2mqtt" or trigger.event.data.new_state.state != trigger.event.data.old_state.state }}'
199+
175200
action:
176201
# debouncing - when automation is triggered multiple times, the last automation run is the one which completes execution, due to mode restart
177202
# therefore previous runs must wait for the debounce delay before executing any other action
@@ -189,7 +214,7 @@ action:
189214
{%- elif integration_id == "zha" -%}
190215
{{ trigger.event.data.command }}
191216
{%- endif -%}
192-
trigger_delta: '{{ (as_timestamp(now()) - ((states(helper_last_controller_event) | from_json).t if helper_last_controller_event is not none and (states(helper_last_controller_event) | regex_match("^\{((\"a\": \".*\"|\"t\": \d+\.\d+)(, )?){2}\}$")) else as_timestamp("1970-01-01 00:00:00"))) * 1000 }}'
217+
trigger_delta: '{{ (as_timestamp(now()) - ((states(helper_last_controller_event) | from_json).t if helper_last_controller_event is not none and (states(helper_last_controller_event) | regex_match("^\{((\"a\":\".*\"|\"t\":\d+\.\d+)(,)?){2}\}$")) else as_timestamp("1970-01-01 00:00:00"))) * 1000 }}'
193218
# update helper
194219
- service: input_text.set_value
195220
data:

website/docs/blueprints/controllers/osram_ac025xx00nj.mdx

+3
Original file line numberDiff line numberDiff line change
@@ -240,3 +240,6 @@ This blueprint supports any variant of the Osram SMART+ Switch Mini controller (
240240
- **2021-08-02**: Improve inputs documentation and organization
241241
- **2021-10-26**: Standardize blueprints structure and inputs naming across the whole collection. Improve blueprint documentation. No functionality change.
242242
- **2022-08-08**: Optimize characters usage for the `helper_last_controller_event` text input.
243+
- **2025-01-05**:
244+
- Updated Actions Mapping as per Z2M [docs](https://www.zigbee2mqtt.io/devices/AC0251100NJ_AC0251600NJ_AC0251700NJ.html#actions) for the device. ([@alexdelprete](https://github.com/alexdelprete))
245+
- Fix regex for updated helper JSON serialization starting from Home Assistant 2023.5.0.

website/docs/blueprints/controllers/philips_8718699693985.mdx

+10
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ Hooks allow to easily create controller-based automations for interacting with m
3030

3131
<Requirement id='deconz'/>
3232
<Requirement id='zha'/>
33+
<Requirement id='zigbee2mqtt'/>
3334
<Requirement name='Input Text Integration' required>
3435

3536
This integration provides the entity which must be provided to the blueprint in the **Helper - Last Controller Event** input. Learn more about this helper by reading the dedicated section in the [Additional Notes](#helper---last-controller-event).
@@ -52,6 +53,12 @@ This integration provides the entity which must be provided to the blueprint in
5253
selector='device'
5354
required='deCONZ, ZHA'
5455
/>
56+
<Input
57+
name='Controller Entity'
58+
description='The action sensor of the controller to use for the automation. Choose a value only if the remote is integrated with Zigbee2MQTT.'
59+
selector='entity'
60+
required='Zigbee2MQTT'
61+
/>
5562
<Input
5663
name='Helper - Last Controller Event'
5764
description='Input Text used to store the last event fired by the controller. You will need to manually create a text input entity for this, please read the blueprint Additional Notes for more info.'
@@ -148,3 +155,6 @@ It's also important to note that the controller doesn't natively support double
148155
- **2021-08-02**: Improve inputs documentation and organization
149156
- **2021-10-26**: Standardize blueprints structure and inputs naming across the whole collection. Improve blueprint documentation. No functionality change.
150157
- **2022-08-08**: Optimize characters usage for the `helper_last_controller_event` text input.
158+
- **2025-01-05**:
159+
- Added support for Zigbee2MQTT. ([@alexdelprete](https://github.com/alexdelprete))
160+
- Fix regex for updated helper JSON serialization starting from Home Assistant 2023.5.0.

0 commit comments

Comments
 (0)