Closed pieterdevriesch closed 1 year ago
Seems the PR from bendikrb was never committed so isn't apart of this repo (think was due to lack of updating the PR to conform with the guidelines). With that said, Feel free to name the devices to the core vendor or whatever would be easily distinguishable for other users.
Also for better readability and logic, you will want to put the endpoint conditions as a button condition and not on each action. I would also advise to use key value pairs for condition checks instead of Jinja templated conditions.
Seems the PR from bendikrb was never committed so isn't apart of this repo (think was due to lack of updating the PR to conform with the guidelines). With that said, Feel free to name the devices to the core vendor or whatever would be easily distinguishable for other users.
I only have this one switch so I have no idea who is the core vendor. Until I found bendikrb's PR I didn't even know it was available under different brands. Anyway I'll see if I can find out something.
Also for better readability and logic, you will want to put the endpoint conditions as a button condition and not on each action. I would also advise to use key value pairs for condition checks instead of Jinja templated conditions.
The endpoint should be ok but when I tried it as key value pairs it didnt work properly (it would not differentiate between the different buttons for hold state, the only difference between them is in the params section and it would not work.) That's the thing I learned from bendikrb's version, because this way it actually works.
I assume this following should work
- x: 86
y: 86
width: 127
height: 214
conditions:
- key: endpoint_id
value: 1
actions:
- title: press
conditions:
- key: cluster_id
value: 6
- key: command
value: 'on'
- title: hold
conditions:
- key: cluster_id
value: 8
- key: command
value: 'move_with_on_off'
- key: params.move_mode
value: 0
- title: hold (released)
conditions:
- key: cluster_id
value: 8
- key: command
value: stop_with_on_off
- key: button_last_state.0.title
value: hold
I assume this following should work
That's what I tried originally but maybe I made a mistake. I didn't have the repository forked yet at that point so I can't really look back. I've made the modifications but I will test it first, this evening when I'm home.
Finally had time to test. I did not make a mistake before. It only recognises the hold action when using the templated conditions, not as key/value pairs.
- title: hold
conditions:
- key: cluster_id
value: 8
- key: command
value: 'move_with_on_off'
- key: params.move_mode
value: 0
Does not work, while:
- title: hold
conditions: >
{{ data.cluster_id == 8
and data.command == 'move_with_on_off'
and data.params.move_mode == 0 }}
does. I also don't understand why since both methods say the exact same thing.
Just let me know if you want to troubleshoot this some more or just accept the templated version?
So it's just the hold action that's having the issue? If so, I think the params.move_mode being zero is defaulting to False as 0 is false. If that's the case, could you just change that one to the working version and I will merge then debug and change if necessary on my end.
Also could you post an example payload for that action so I have data to work with instead of writing it out from scratch.
Done.
Here's the hold payload:
event_type: zha_event
data:
device_ieee: cc:cc:cc:ff:fe:64:43:c6
unique_id: cc:cc:cc:ff:fe:64:43:c6:1:0x0008
device_id: 5d12e7476d2e470b33b7bb2bf8d6407b
endpoint_id: 1
cluster_id: 8
command: move_with_on_off
args:
- 0
- 50
params:
move_mode: 0
rate: 50
origin: LOCAL
time_fired: "2023-05-13T21:51:33.950870+00:00"
context:
id: 01H0BHHZHYQX5YE0EN9B553GD2
parent_id: null
user_id: null
and the hold(release):
event_type: zha_event
data:
device_ieee: cc:cc:cc:ff:fe:64:43:c6
unique_id: cc:cc:cc:ff:fe:64:43:c6:1:0x0008
device_id: 5d12e7476d2e470b33b7bb2bf8d6407b
endpoint_id: 1
cluster_id: 8
command: stop_with_on_off
args: []
params: {}
origin: LOCAL
time_fired: "2023-05-13T21:51:35.095622+00:00"
context:
id: 01H0BHJ0NQBYFRXQGCC1RYXZFK
parent_id: null
user_id: null
That was the top left (I) button. Top right (O) is with args 1:
event_type: zha_event
data:
device_ieee: cc:cc:cc:ff:fe:64:43:c6
unique_id: cc:cc:cc:ff:fe:64:43:c6:1:0x0008
device_id: 5d12e7476d2e470b33b7bb2bf8d6407b
endpoint_id: 1
cluster_id: 8
command: move_with_on_off
args:
- 1
- 50
params:
move_mode: 1
rate: 50
origin: LOCAL
time_fired: "2023-05-13T21:58:16.455350+00:00"
context:
id: 01H0BHY8M7Q256DCKG7KA85WWB
parent_id: null
user_id: null
event_type: zha_event
data:
device_ieee: cc:cc:cc:ff:fe:64:43:c6
unique_id: cc:cc:cc:ff:fe:64:43:c6:1:0x0008
device_id: 5d12e7476d2e470b33b7bb2bf8d6407b
endpoint_id: 1
cluster_id: 8
command: stop_with_on_off
args: []
params: {}
origin: LOCAL
time_fired: "2023-05-13T21:58:17.935386+00:00"
context:
id: 01H0BHYA2F0J6973A9KMNCXDE0
parent_id: null
user_id: null
Thanks, I'll have a look into it
Blueprint Checklist
Just managed to fix my blueprint after discovering that @bendikrb was working on a switch from a different brand that's clearly the exact same one as mine. I put the brand name of mine on it but maybe it could be changed to both (although there might be more rebranded versions).