Nick4
(Nick)
June 13, 2023, 8:58am
101
Guys, just bumped on this while searching for something else: of course it’s possible to mix the use for different purposes.
I do this for lights and mediaplayers.
Nick4
(Nick)
June 13, 2023, 9:35am
102
Hi guys, I’m using this remote to control mainly my mediaplayers but also some lights/helpers.
For some buttons I use the long or double press functionality.
This has worked flawlessly until some time ago and for a reason I cannot find, the double press doesn’t work anymore.
The (Optional) Expose x button double press event is enabled.
I increased Helper - Double Press delay input to 10000
but still a double press is seen as single.
Does anyone have the same problem or an idea what might be wrong?
Ian-Zz
(Ian Zz)
June 15, 2023, 4:16am
103
Yeah I just noticed today my double presses also don’t work like they used too. I haven’t looked into it much but if I do (and get them working) will let you know.
athua
(Gus)
June 15, 2023, 4:40am
104
Double clicks have been having issues since HA 2023.5 was released.
See the following issues discussion which contains work-around to get it working:
opened 12:36PM - 05 May 23 UTC
bug
blueprint
### Blueprint name
Controller - IKEA E1743 TRÅDFRI On/Off Switch & Dimmer
… ### Home Assistant Core Version
2023.5.1
### Home Assistant Installation Type
Home Assistant Operating System
### Description
The Blueprint 'Controller - IKEA E1743 On/Off Switch & Dimmer' stopped working after recent Home Assistant update
Upon further inspection it’s simply the double tap feature of that controller/blueprint that’s not working. The single press and long press functionality is working but the double press functionality is dead and appears to be throwing errors in the error log. Here is just one example of what I see simply after a home assistant reboot:
Logger: homeassistant.components.automation
Source: components/automation/config.py:207
Integration: Automation (documentation, issues)
First occurred: 6:58:51 AM (1 occurrences)
Last logged: 6:58:51 AM
Blueprint 'Controller - IKEA E1743 On/Off Switch & Dimmer' generated invalid automation with inputs {'integration': 'deCONZ', 'controller_device': 'd798e7a289381fe620c8ca2f6f1c7c9e', 'helper_last_controller_event': 'input_text.text1', 'action_button_up_double': [{'service': 'light.turn_on', 'data': {}, 'target': {'entity_id': 'light.living_room_fan_lights'}}], 'action_button_down_double': [{'service': ''}], 'button_up_double_press': True, 'button_down_double_press': True, 'helper_double_press_delay': 1000, 'action_button_up_short': [{'type': 'turn_on', 'device_id': 'bc0d7e01c84ff0e016a4c6bd1a6c480b', 'entity_id': 'light.texas_instruments_cc1352_cc2652_z_stack_3_30_build_20220219_living_room_downlights_zha_group_zha_group_0x0002', 'domain': 'light', 'brightness_pct': 100}], 'action_button_down_short': [{'type': 'turn_off', 'device_id': 'bc0d7e01c84ff0e016a4c6bd1a6c480b', 'entity_id': 'light.texas_instruments_cc1352_cc2652_z_stack_3_30_build_20220219_living_room_downlights_zha_group_zha_group_0x0002', 'domain': 'light'}], 'action_button_up_long': [{'device_id': 'bc0d7e01c84ff0e016a4c6bd1a6c480b', 'domain': 'light', 'entity_id': 'light.texas_instruments_cc1352_cc2652_z_stack_3_30_build_20220219_living_room_downlights_zha_group_zha_group_0x0002', 'type': 'brightness_increase'}], 'action_button_down_long': [{'device_id': 'bc0d7e01c84ff0e016a4c6bd1a6c480b', 'domain': 'light', 'entity_id': 'light.texas_instruments_cc1352_cc2652_z_stack_3_30_build_20220219_living_room_downlights_zha_group_zha_group_0x0002', 'type': 'brightness_decrease'}], 'button_up_long_loop': True, 'button_down_long_loop': True, 'button_up_long_max_loop_repeats': 2500, 'button_down_long_max_loop_repeats': 2500}: Service does not match format <domain>.<name> for dictionary value @ data['action'][3]['choose'][3]['sequence'][0]['choose'][0]['sequence'][0]['choose'][0]['sequence'][2]['choose'][0]['sequence'][0]['service']. Got ''
### Automation YAML config
```yaml
alias: Bathroom - Doubletap - Fan
description: ""
use_blueprint:
path: EPMatt/ikea_e1743.yaml
input:
integration: deCONZ
controller_device: 1291a6dbd2844a87b99006cff6b0a308
helper_last_controller_event: input_text.text1
button_up_double_press: true
button_down_double_press: true
action_button_up_double:
- type: turn_on
device_id: 4b3c7d62506e2024325e9ac0a60eeed0
entity_id: switch.bathroom_fan
domain: switch
action_button_down_double:
- type: turn_off
device_id: 4b3c7d62506e2024325e9ac0a60eeed0
entity_id: switch.bathroom_fan
domain: switch
helper_double_press_delay: 1000
```
### To Reproduce
1. Go to '...'
2. Click on '....'
3. Trigger the automation '....'
4. See error
Logger: homeassistant.helpers.template
Source: helpers/template.py:237
First occurred: 8:35:01 AM (1 occurrences)
Last logged: 8:35:01 AM
Template variable error: 'dict object' has no attribute 'event' when rendering '{%- if integration_id == "zigbee2mqtt" -%} {{ trigger.event.data.new_state.state }} {%- elif integration_id == "deconz" -%} {{ trigger.event.data.event }} {%- elif integration_id == "zha" -%} {{ trigger.event.data.command }}{{"_" if trigger.event.data.args|length > 0}}{{ trigger.event.data.args|join("_") }} {%- endif -%}'
Logger: homeassistant.components.automation.bathroom_doubletap_fan
Source: helpers/script.py:410
Integration: Automation ([documentation](https://www.home-assistant.io/integrations/automation), [issues](https://github.com/home-assistant/home-assistant/issues?q=is%3Aissue+is%3Aopen+label%3A%22integration%3A+automation%22))
First occurred: 8:35:01 AM (1 occurrences)
Last logged: 8:35:01 AM
Bathroom - Doubletap - Fan: Error executing script. Error rendering template for variables at pos 2: UndefinedError: 'dict object' has no attribute 'event'
Logger: homeassistant.components.automation.bathroom_doubletap_fan
Source: components/automation/__init__.py:254
Integration: Automation ([documentation](https://www.home-assistant.io/integrations/automation), [issues](https://github.com/home-assistant/home-assistant/issues?q=is%3Aissue+is%3Aopen+label%3A%22integration%3A+automation%22))
First occurred: 8:35:01 AM (1 occurrences)
Last logged: 8:35:01 AM
Error while executing automation automation.bathroom_doubletap_fan: UndefinedError: 'dict object' has no attribute 'event'
### Expected behavior
I would expect the device_id of 4b3c7d62506e2024325e9ac0a60eeed0 to turn on/off.
### Actual Behaviour
Nothing -- error is thrown, and device never receives command.
### Additional Details
- [ ] I'd like to help developing a fix for this issue.
### Screenshots
_No response_
### Additional context
_No response_
I applied the fix and its working for me using Zigbee2MQTT:
Search for the regex_match code and replace it with the following (some spaces have been removed):
regex_match("^{((“a”:".*"|“t”:\d+.\d+)(,)?){2}}$"))
1 Like
Nick4
(Nick)
June 15, 2023, 7:43am
105
THANK YOU, you have put me in the right direction!
At first I didn’t have a clue where to find this and then it didn’t work since the code you gave seems to be for another zigbee integration.
Nick4
(Nick)
June 15, 2023, 7:52am
106
For anyone having this double click issue.
You have to open the blueprint file (so not the blueprint in your HA UI but in your filesystem ) for the automation you used for this button. (maybe make a copy)
Find regex_match and replace the string following to it.
This string is different for the type of zigbee integration you use.
For Zigbee2MQTT it’s:
regex_match("^\{((\"a\":\".*\"|\"t\":\d+\.\d+)(,)?){2}\}$"))
For deCONZ:
regex_match("^{(("a":.*|"t":\d+.\d+)(,)?){2}}$"))
For ZHA: can’t find the code but you have to remove the spaces between the brackets.
Save the file and reload your automations.
5 Likes
I have tried this with no luck - surely the official blueprint can be updated?
Nick4
(Nick)
July 25, 2023, 11:19am
108
Hi Damien, what did you do?
It’s not that hard, for me this was unknown terrain too.
Which integration do you use?
1 Like
Using Zigbee2MQTT.
Just managed to fix it though. I copied the latest blueprint yaml files from the awesome-ha-blueprints repo and removed 6 spaces total, 3 from each of the regex lines.
1 Like
This worked for ZHA. 6 total spaces in 2 different regex lines.
Sorry, but which spaces between which brackets?
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 "" }}'
I thought we needed spaces between {{ and the (
tego1
(Tego1)
August 10, 2023, 11:39am
112
Hi, this blueprint looks great but the UP and DN buttons are not working for me.
The UP button sends this: {“a”:“step_with_on_off_StepMode.Up_43_5”,“t”:1691605619.133851}
and DN this: {“a”:“step_StepMode.Down_43_5_0_0”,“t”:1691605611.559078}
Any ideas?
Thank you
Nick4
(Nick)
August 10, 2023, 8:22pm
113
Hi Dave, I just did a recap from what I found when I had this issue as well.
I just used the that example for z2m which solved my problem.
As you can see, there are no spaces between the {{ and (
So what is in the Git repo is already correct? What I posted just above is exactly how it currently is in the repo
athua
(Gus)
August 11, 2023, 4:56am
115
sparkydave:
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 "" }}'
You need to change it to:
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 "" }}'
ie. remove the space between the : and \ and also between the , and )
1 Like
does this fix work in 2023.7?
I’m trying to apply it in mine, and it keeps generating this error each time i chuck the new deconz regex in and reload my automations:
invalid template (TemplateSyntaxError: expected token ',', got 'a') for dictionary value @ data['action'][1]['variables']['last_controller_event']. Got '{{ (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 "" }}' invalid template (TemplateSyntaxError: expected token ',', got 'a') for dictionary value @ data['action'][1]['variables']['trigger_delta']. Got '{{ (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 }}'
Nick4
(Nick)
August 27, 2023, 5:36pm
117
Hi, welcome to the forum!
You seem to have used the wrong string.
Have a look a little higher in this topic for my post with the correct one for deCONZ.
1 Like
i’d have sworn up and down i was using the deconz one
i suppose that’s what happens when you try this stuff before bed haha
for my own sanity, this:
regex_match("^{(("a":.*|"t":\d+.\d+)(,)?){2}}$"))
is the correct string, isn’t it?
I’ve replaced the regex that appears on lines 439 and 440 of the blueprint, but it’s still not working for me - I’ll be honest, I suck at regex, and I’m not even sure where I should start to begin troubleshooting. If someone could point me in the correct direction, I’d be eternally grateful.
i don’t suppose anyone has any ideas as to the above?
i’ve tried mucking round a bit over the last couple weeks, and i just can’t seem to get it working as it should with the double presses
the single press works fine, but no matter what i do, the double press just doesn’t seem to work
Nick4
(Nick)
September 13, 2023, 9:48am
120
If you have solved the issue of the spaces correctly it will be something else.