I am not too familiar with ZHA, so my solution might not be too good, if it even works, but i tried my best to make a version compatible with it. I can unfortunately not test it.
Sorry for taking so long to answer.
Import:
Hi, I integrated your second Blueprint. After clicking on save nothing happens and no automation is generated.
Thx for your help
Thanks for the support @Computerfreak14 the blueprint did not work, but when reading it, it gave me a good idea on what to do.
I kind of have the remote working now, but not all buttons are fully functional. I saw your events and they were similar to the ones I was getting through ZHA, but not identical. So I replaced those and that did the trick. You can get the needed info from listening to zha_event in developer tools → event, then just press and long press each button to see the commands for each of them, the mapping I got looks like this:
As you can see you get actually 2 commands when long pressing up and down. So you can get 4 different functions with this remote:
1.- Press Up
2.- Press Down
3.- Long Press Up
4.- Long Press Down
To set up an automation (I have one for each of the above) it looks something like this:
alias: Styrbar test Up
description: ''
trigger:
- event_data:
device_ieee: "device_ieee from zha_event"
unique_id: "unique id from zha_event"
device_id: "device id from zha_event"
command: 'on'
args: []
platform: event
event_type: zha_event
condition: []
action:
- device_id: "device you want to trigger, in this case a light"
domain: light
entity_id: "entity of device you want to trigger"
type: brightness_increase
mode: single
You must only change the command and condition value for each button.
The only issue I have left is that the side buttons don’t seem to trigger any event o a simple press, and the battery repoting seems to be half of the actual battery left.
Hope this helps
Thanks so much for the tip to “debug” listening on zha_event!
I got those response with left and right buttons (args are differents):
With right
{
"event_type": "zha_event",
"data": {
"device_ieee": "80:4b:50:ff:fe:9f:d9:2b",
"unique_id": "80:4b:50:ff:fe:9f:d9:2b:1:0x0005",
"device_id": "79bf28217e31c5bf5542d83b678a224e",
"endpoint_id": 1,
"cluster_id": 5,
"command": "press",
"args": [
256,
13,
0
]
},
"origin": "LOCAL",
"time_fired": "2021-09-12T23:35:21.968518+00:00",
"context": {
"id": "c692698f174e394ad20d050aeaf3d459",
"parent_id": null,
"user_id": null
}
}
With left
{
"event_type": "zha_event",
"data": {
"device_ieee": "80:4b:50:ff:fe:9f:d9:2b",
"unique_id": "80:4b:50:ff:fe:9f:d9:2b:1:0x0005",
"device_id": "79bf28217e31c5bf5542d83b678a224e",
"endpoint_id": 1,
"cluster_id": 5,
"command": "press",
"args": [
257,
13,
0
]
},
"origin": "LOCAL",
"time_fired": "2021-09-12T23:37:26.803999+00:00",
"context": {
"id": "b75b210654afa713ac7e661f7f088fd3",
"parent_id": null,
"user_id": null
}
}
I get no response or event at all when pressing left and right buttons (only when long pressing)…
I am using ZHA with a Conbee II stick.
Did they work from the start with you @Slobadx?
Yes, I got the event response throught ZHA without any previus configuration but I am using CC2531
Hey guys,
thanks for sharing,
here is ZHA modified version of IKEA STYRBAR remote.
Added left/right button long press support.
Feel free to share and use as own blueprint.
blueprint:
name: Ikea Styrbar Remote
description: Control your lights with the IKEA STYRBAR remote. You can also set
actions for the left and right button.
domain: automation
input:
remote:
name: Remote
description: IKEA Styrbar remote to use
selector:
device:
integration: zha
manufacturer: IKEA of Sweden
entity:
domain: sensor
target_light:
name: Lights
description: The lights you want to control with the remote
selector:
target:
entity:
domain: light
button_left:
name: Left button
description: Action to run on left button press short
default: []
selector:
action: {}
button_right:
name: Right button
description: Action to run on right button press short
default: []
selector:
action: {}
button_left_hold:
name: Left button hold
description: Action to run on left button press long,
action is stopped when button is released.
default: []
selector:
action: {}
button_right_hold:
name: Right button hold
description: Action to run on right button press long,
action is stopped when button is released.
default: []
selector:
action: {}
brightness:
name: Brightness
description: The brightness you want your lights to be when turning them on
default: 100
selector:
number:
min: 0.0
max: 100.0
mode: slider
step: 1.0
unit_of_measurement: '%'
force_brightness:
name: Force Brightness
description: Force the above set brightness when turning on the lamps?
default: false
selector:
boolean: {}
source_url: https://raw.githubusercontent.com/Computerfreak14/Z2M-Styrbar-remote-blueprint/experimental-ZHA/Z2M-IKEA-STYRBAR-remote.yaml
trigger:
- platform: event
event_type: zha_event
event_data:
device_id: !input 'remote'
action:
- variables:
command: '{{ trigger.event.data.command }}'
dataargs: '{{ trigger.event.data.args }}'
- choose:
- conditions: '{{ command == ''on'' }}'
sequence:
- choose:
- conditions: '{{ force_brightness }}'
sequence:
- service: light.turn_on
target: !input 'target_light'
data:
transition: 1
brightness_pct: !input 'brightness'
default:
- service: light.turn_on
target: !input 'target_light'
data:
transition: 1
- conditions: '{{ command == ''off'' }}'
sequence:
- service: light.turn_off
target: !input 'target_light'
- conditions: '{{ command == ''move'' }}'
sequence:
- repeat:
until: '{{ command == ''stop'' }}'
sequence:
- service: light.turn_on
data:
brightness_step_pct: -10
transition: 1
target: !input 'target_light'
- delay: '1'
- conditions: '{{ command == ''move_with_on_off'' }}'
sequence:
- repeat:
until: '{{ command == ''stop'' }}'
sequence:
- service: light.turn_on
data:
brightness_step_pct: 10
transition: 1
target: !input 'target_light'
- delay: '1'
- conditions:
- '{{ command == ''press'' }}'
- '{{ dataargs[0] == 257 }}'
sequence: !input 'button_left'
- conditions:
- '{{ command == ''press'' }}'
- '{{ dataargs[0] == 256 }}'
sequence: !input 'button_right'
- conditions:
- '{{ command == ''hold'' }}'
- '{{ dataargs[0] == 3329 }}'
sequence:
- repeat:
until: '{{ command == ''release'' }}'
sequence: !input 'button_left_hold'
- conditions:
- '{{ command == ''hold'' }}'
- '{{ dataargs[0] == 3328 }}'
sequence:
- repeat:
until: '{{ command == ''release'' }}'
sequence: !input 'button_right_hold'
mode: restart
max_exceeded: silent
Made an account to thank you for this!
Works great with ZHA with a conbeeII stick
I’ve added the blueprint from the first post & then overwrote it manually with the one from @se3
Works like a charm
Any chance of including the Left Hold and Right Hold on the zigbee2mqtt blueprint? I tried adapting but made a mess of it :>
Hello, will it be possible to use this with deconz/phoscon integration?
Hi @r100gs , it’s working with deCONZ.
I have question for @Computerfreak14: how can I increase the time for changing the brightness?
Instead of changing the brightness in 1 sec, to do it in 3 seconds (for example).
you can set it in zigbee2mqtt addon > you device > setting (specific) > transition
hi @nicolae.fratila,
Is there any step before adding the blueprint to do in deconz/phoscon to add the remote ?
Thanks in advance.
You don’t have to do anything in deCONZ before adding the blueprint. I just set the automation based on blueprint
Hi @nicolae.fratila ,
thanks for your help.
However i tried and added the blueprint, tried to create an automation without doing anything more, but it asks for the “action entity of your Styrbar remote”, i dont have any entity for the remote.
Then i tried to add the remote on deconz, selecting the IKEA products → others, and it was added, but only have the battery entity .
is this normal or theres any other step that i have to do ?
Thanks in advance for your help.
HI,
I just run across this template and it’s exactly what I was looking for. but I can’t seem to get it working.
The state variable step is giving me an error… Anybody who know what to do about it?
@Computerfreak14 Thank you for creating this BluePrint. Seems it is not possible to import this BluePrint anymore.
HA information:
Home Assistant 2022.11.4
Supervisor 2022.11.2
Operating System 9.3
Frontend 20221108.0 - latest
Error I get while importing
I’m having the same problem, did you find out how to solve? Thank you
No I didn’t, had use a different template.
I had success with this blueprint: