Been trying out different combinations to get to some way of getting the HUE Dimmer to turn on the light on and for x number of clicks on the ON button switch between predefined scenes.
Logfile of Appdaemon:
2021-08-30 16:16:46.460668 INFO dimmer_bryggers_X1: 🎮 Button event triggered: `1003`
2021-08-30 16:16:46.467608 INFO dimmer_bryggers_X1: 🏃 Running `Service (scene.turn_on)` now
2021-08-30 16:16:46.473601 INFO dimmer_bryggers_X1:
🤖 Service: scene.turn_on
- scene: scene.fitness_fuldtlys
2021-08-30 16:16:46.501421 WARNING HASS: Error calling Home Assistant service default/scene/turn_on
2021-08-30 16:16:46.502879 WARNING HASS: Code: 400, error: 400: Bad Request
Running latest version of everything,
no errors in HA,
all lights/scenes tested manually as working OK
Best regards and thanks for the great work you do!
Thank you, I selected the first option to try with the Hue Dimmer, a little bit of fiddling and teaching myself a bit more about input_select and hey presto - it works.
I’d love to do it with multiple clicks, how would you implement that using the HueDimmerController class? I don’t quite understand the instructions in the link you shared. Thanks again, J
The problem with your configuration is that you are passing the wrong data to the service. You can check in Home Assistant > Developer Tools > Services the attributes for scene.turn_on. The scene should be passed as entity_id, and not scene. Also, you should pass the whole entity ID, so scene.bryggers_fuldtlys for example. So your configuration should look like:
Normally this error “Code: 400, error: 400: Bad Request” means that the request to HA has not been processed correctly. In this case is because the parameters was not passed properly or the scene does not exists in HA.
This is my current configuration for the light in my bathroom attached to a sensor and controlled via ControllerX with Callback constraints from AppDaemon. You can see how I use the scene action in here.
This configuration is valid from ControllerX v4.14.0. You are currently using v4.12.0. If you update ControllerX and restart AppDaemon, you will get your problem fixed. However, if you don’t to upgrade, here you have another way to achieve the same:
It’s as easy as adding $ and the number of clicks you want. Additionally, you might need to add multiple_click_delay to the configuration if the double click does not work properly.
Also, in case of working with z2m and wanting to use the multiclick functionality, then you need to make sure to remove from the device-specific (devices.yaml) the multiple_press_timeout option in Zigbee2MQTT configuration. Not sure if this is still needed, but I have this in the documentation.
I have a similar configuration for my Hue Dimmer switch from the bedroom with deCONZ to turn off the livingroom lamp with a double click:
Also, I recommend you now to read the multi-click documentation I shared earlier since it explains better how it works and you can see some examples in there with explanations.
Got it almost working now, but maybe the HUE Dimmer does not support multiple clicks,
I can’t seem to get it to report with 1004,1005… when trying multiple clicks on it,
Only 1000-1003, seems to work (when looking inside appdaemon log) same for the other buttons on the HUE Dimmer I got.
I used your code above with my scenes.
The multiple click functionality is something from ControllerX. It virtually recognizes multiple clicks even if the device does not support them. You can read more about it here.
If you are using deCONZ, you should use the deCONZ events (1002, 1001, etc…) and not toggle as you are trying to use in the configuration you pasted:
If 3 clicks is too much and it does not respond properly, you can use double click for the off button (4002$2). Basically, you need to put the event first, then $, and finally the number of clicks. The rest will be handled by ControllerX to check if it was 2, 3, 4, 10, or 20 clicks in a row.
Finally, you can change multiple_click_delay (default is 500ms) to define when to detect multiple clicks. So if you have problems detecting the multiple clicks, you will need to make that delay higher (700 or 1000 for example). However, if you use a high number, for example, 4000ms, it will take 4 seconds to execute the command you want because ControllerX will wait for 4s every click to know if there is another click coming.
As I showed to @jastan1971, this is my configuration for my HUE dimmer with deCONZ (like your setup):
This will use the default mapping of this controller and it will add this double click action to my controller to toggle my living room light from my bedroom.
Think I finally managed to get my head around it an read your documentation about the “event” codes from the remote I have There was no 1004,1005… silly me!
So when I got it working with your latest input, I went back to try out the scenes and selectnext.
Could not get it to work, but when I read the log files I figured out there was a missing scene. in the command.
So I now have it working in perfectly order like this, I had to change the cut´n´paste from another post of yours with the added scene. . That solved my challenge with the “400 bad request”
Again my error, could have added scene. to the lines in configuration.yaml.
I just released ControllerX v4.16.0 with a new feature for click and hold actions. Now you should be able to configure in a more flexible way how to cycle through different attributes (brightness, color_temp and white_value). Until now, when reaching the min or max the cycle stopped. Now this is the default behaviour (stop), but you can also configure to loop (going from max to min and min to max), and bounce (bouncing back when reaching min or max).
It is not something I see the use case for my setup, but I am sure some of you might need or want something like this. Especially when working with 1-button controllers.
If you are planing to use it, I would love hearing your use case!
i currently use aqara single button switch with reference: WXKG06LM i don’t find this reference in supported controllers, seems the same as WXKG07LMLightController but with single button.
I want to use this switch to dimmer the light when switch is hold, I tried this config
The configuration you had should do the work, since you can use LightController and mapping for custom controllers that are not supported like this one.
However, I don’t normally recommend using a hold_* action like hold_brightness_toggle if there is no release action. This controller does not have a release action, so when the button is released, the brightness will continue changing, so probably my suggestion to this controller would be: