Skip to content

Commit

Permalink
(ikea_e1812, ikea_e1524_e1810) Fixed double press events not triggere…
Browse files Browse the repository at this point in the history
…d due to changes in Home Assistant 2023.5.x (#600)

* Changed RegEx expression

Now correctly sets trigger_delta and last_controller_event for double press events.

* ikea_e1524_e1810: bump version to 2025.01.03, add min home assistant version

* ikea_e1812: replicate changes from e1524_e1810

* docs: update changelog

* docs: fix typo

---------

Co-authored-by: Tim Göhringer <tim.goehringer@protonmail.com>
Co-authored-by: EPMatt <30753195+EPMatt@users.noreply.github.com>
  • Loading branch information
3 people authored Jan 3, 2025
1 parent c2f0ea6 commit 20ef4e4
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 5 deletions.
8 changes: 5 additions & 3 deletions blueprints/controllers/ikea_e1524_e1810/ikea_e1524_e1810.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,11 @@ blueprint:
🚀 This blueprint is part of the **[Awesome HA Blueprints](https://epmatt.github.io/awesome-ha-blueprints) project**.
ℹ️ Version 2022.08.08
ℹ️ Version 2025.01.03
source_url: https://github.com/EPMatt/awesome-ha-blueprints/blob/main/blueprints/controllers/ikea_e1524_e1810/ikea_e1524_e1810.yaml
domain: automation
homeassistant:
min_version: 2023.5.0
input:
integration:
name: (Required) Integration
Expand Down Expand Up @@ -436,8 +438,8 @@ action:
{%- elif integration_id == "zha" -%}
{{ trigger.event.data.command }}{{"_" if trigger.event.data.args|length > 0}}{{ trigger.event.data.args|join("_") }}
{%- endif -%}
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 }}'
last_controller_event: '{{ (states(helper_last_controller_event) | from_json).a if helper_last_controller_event is not none and (states(helper_last_controller_event) | regex_match("^\{((\"a\": \".*\"|\"t\": \d+\.\d+)(, )?){2}\}$")) else "" }}'
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 }}'
last_controller_event: '{{ (states(helper_last_controller_event) | from_json).a if helper_last_controller_event is not none and (states(helper_last_controller_event) | regex_match("^\{((\"a\":\".*\"|\"t\":\d+\.\d+)(,)?){2}\}$")) else "" }}'
# update helper
- service: input_text.set_value
data:
Expand Down
6 changes: 4 additions & 2 deletions blueprints/controllers/ikea_e1812/ikea_e1812.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,11 @@ blueprint:
🚀 This blueprint is part of the **[Awesome HA Blueprints](https://epmatt.github.io/awesome-ha-blueprints) project**.
ℹ️ Version 2022.08.08
ℹ️ Version 2025.01.03
source_url: https://github.com/EPMatt/awesome-ha-blueprints/blob/main/blueprints/controllers/ikea_e1812/ikea_e1812.yaml
domain: automation
homeassistant:
min_version: 2023.5.0
input:
integration:
name: (Required) Integration
Expand Down Expand Up @@ -212,7 +214,7 @@ action:
{%- elif integration_id == "zha" -%}
{{ trigger.event.data.command }}{{"_" if trigger.event.data.args|length > 0}}{{ trigger.event.data.args|join("_") }}
{%- endif -%}
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 }}'
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 }}'
# update helper
- service: input_text.set_value
data:
Expand Down
1 change: 1 addition & 0 deletions website/docs/blueprints/controllers/ikea_e1524_e1810.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -354,3 +354,4 @@ If you notice your controller is not behaving as expected please remove the batt
- **2021-08-02**: Improve inputs documentation and organization
- **2021-10-26**: Standardize blueprints structure and inputs naming across the whole collection. Improve blueprint documentation. No functionality change.
- **2022-08-08**: Optimize characters usage for the `helper_last_controller_event` text input.
- **2025-01-03**: Fixed double press events not triggered due to changes in Home Assistant 2023.5.x. ([@ZtormTheCat](https://github.com/ZtormTheCat))
1 change: 1 addition & 0 deletions website/docs/blueprints/controllers/ikea_e1812.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -192,3 +192,4 @@ It's also important to note that the controller doesn't natively support double
- **2021-08-02**: Improve inputs documentation and organization
- **2021-10-26**: Standardize blueprints structure and inputs naming across the whole collection. Improve blueprint documentation. No functionality change.
- **2022-08-08**: Optimize characters usage for the `helper_last_controller_event` text input.
- **2025-01-03**: Fixed double press events not triggered due to changes in Home Assistant 2023.5.x.

0 comments on commit 20ef4e4

Please sign in to comment.