New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Need Help working on ZHA Tradfri Remote #62
Comments
Could you try the lastest version and give template conditions a go? template conditions. Currently the key value pair conditions doesn't traverse data properties but will try to implement this in the near future |
I'm also just curious as to how ZHA handles switches etc. Is that really how the data comes in for all devices? there doesn't seem to be a friendly way to determine the button or action, do you literally have to interporate the args and params like you showed to determine what button or action was pushed? Update: I've just looked at the other two blueprints for ZHA currently in the repo and they reference everything via the command property. Can you not just reference that? considering it already states Sorry just noticed you mentioned "Sadly ZHA only seperates the left and right button by these parameters". Another suggestion would be to request the developers via their github page and ask to make the device event data a bit more fulfilled and easier to handle. Or even better contribute to their code and add it in yourself ;) |
Your Idea about reaching out to the ZHA folks is great, but I don't think changing this is a possibility, because it would break all of the existing automations and HA blueprints. |
I understand that but there's also the possiblity that they'll change it in a future update to be more towards the norm and how other devices data is sent... Eitherway the next update you can access those properties from the key, value conditions using dot notation like you were originally doing |
I've tried template condition, but hadn't had any luck. Could you please look over this code?
|
You would do |
I also haven't done extensive testing on the templated conditions but the simple test I did worked, so if that code I sent doesn't work then might be an issue with Switch Manager |
Sadly didn't work for me :/ |
WIth the latest version you can also do # I can't be certain this one will work as I haven't tested arrays with dot notation only objects
conditions:
- key: args.0
value: 256
- key: args.1
value: 13
- key: args.2
value: 0 or # This one should definitely work
conditions:
- key: params.param1
value: 256
- key: params.param2
value: 13
- key: params.param3
value: 0 |
Thank you :D |
If possible, could you send your blueprint as a zip so I can do testing on it, will help me find the issues with templating and key arrays. And I can just emulate the event data you have above |
I'll do as soon as I programmed all the buttons :) |
This switch is super weird. The release values for the left and right button are the same, and the param1 counts how long the switch was pressed in ms. |
Yh to be honest I didn't like the look of the data when I saw it... If you don't need to know how long it was pressed then just omit that condition and use only param2 and param3. Is it possible the Template condition was working it's just that the arg[0] would always be a different value so it would never pass? It's also surprising because Ikea switches seem to be fairly popular and well mantained |
I think that is the best I can do. |
Just a couple of notes with your blueprint. hold (released) for both left and right will fire with either one because the conditions match. Also power hold can be referenced by command move_to_level_with_on_off based on the blueprint @ https://github.com/niro1987/homeassistant-config/blob/main/blueprints/automation/niro1987/zha_ikea_tradfri_5button_remote_custom.yaml |
Also latest version now works with templated conditions and now lists in condition keys so thanks for sending your blueprint to use as my guineapig ;) |
You are right about that. As far as I can see there's no way around triggering hold(release) on the left AND right button because they use the same data. First - The basic press command: Second (about 3 seconds after pressing): Third (Shortly after the first one) Fourth (Shortly after the second one) Using the third or fourth one solves no issues because the release event will still be triggered. I used the second one because it provides the fastest response (around 3 seconds of holding) I don't know if this is on ikea or the ZHA team, but someone has really messed up this remote 😵💫 |
The Zigbee2MQTT and deCONZ blueprints for this switch/remote doesnt have hold or hold (released) for the power button but do for everything else so that part must be more Ikea's design flaw (well Zigbee2MQTT does have hold but not hold (released). I assume those integrations have made effort to preprocess these before sending out as an event or mqtt to be handled. Probably why that link I sent you for the generic blueprint doesn't have hold (released) but on hold for the buttons. I can only advise using that blueprints data as reference as it's designed for ZHA and been used by others. Not much more Switch Manager can do about these cases I'm afraid, it can only work with the data that's passed in |
I got it working a little bit, but I'm not able to use "args" or "params" as conditions. Can someone help me with this problem?
Sadly ZHA only seperates the left and right button by these parameters:
Left Press:
Right Press:
Can someone help me with the right way to write these conditions? It's probably just a formatting issue.
The text was updated successfully, but these errors were encountered: