ControllerX. Bring full functionality to light and media player controllers

i believe you can do that by adding volume_steps.
for example:

geluidsknop_woonkamer_new:
module: controllerx
class: E1744MediaPlayerController
controller: mediaplayercontroller_woonkamer
integration: deconz
media_player: media_player.kef_woonkamer
delay: 200
volume_steps: 50

a volume step of 50 means it will do 2 steps or jumps as you call them per event(turn)…
so choose a number between 1 - 100 (the larger the number the smaller the steps)

1 Like

is it possible us a timer function after that timer it the lights would be shut off again.

Hi @slamkalukas,

Sorry for the delay in replying. This is indeed a very strange case. Since I do not have the same setup as you, the only thing I could do is to add this configuration to the integration tests I have setup. I did not find any problems when double-clicking with and without merge_mapping. I see that multiple_click_delay is 1000 with mapping and 500 with merge_mapping. I would recommend you leaving to 1000 to experiment if it working properly. Once it is working, you can make this value lower.

Could you also show the logs when clicking and double-clicking, so I see better this behaviour with the logs.

Regards,
Xavi M.

Hi @duceduc,

Glad you got it working with a work around. Thank you for the update. However, the “on” and “off” were not working because the YAML parser parses on and off as boolean variables (true and false). So you need to wrap “on” and “off” with quotes (").

Regards,
Xavi M.

Hi @Rdoull,

Could you please share the AppDaemon logs when holding the left and right arrows?

Not sure if you reported this already in GitHub, but I got this issue recently: https://github.com/xaviml/controllerx/issues/215

I am currently testing it with Z2M since I do not have deCONZ, but it seems to be a deCONZ problem for not firing 4001/4003 and 5001/5003 events.

Regards,
Xavi M.

Hi @seasideCT,

Sorry for the delay. I have replay to you in the GitHub issue: https://github.com/xaviml/controllerx/issues/209

Regards,
Xavi M.

Hi @ladaowner,

As @hans80 pointed out, you can use volume_steps to define how many steps (or jumps) are needed to go up or down. The higher, the smaller steps will take, a step of 1 means to go from min to max in 1 go.

However, this does not assure you to calibrate it in a way to make 100% with 2 full rotations. This controller fires a rotation start action when start rotating and a rotation release when the rotation is stopped. While waiting for those 2 events, ControllerX sends periodic requests to HA to change the volume. So if you do a quick 2 full rotations in 1s, it will be the same as moving slowly half rotation in 1s.

Also, I would recommend you to take a look at point #9 in the FAQ. Your controller will work smoother if connected to MQTT directly, rather than using the HA sensor.

Regards,
Xavi M.

Hi @hans80,

What do you mean by again?

You can use action_delay attribute to define which action should take longer to execute when fired.

corridor_controller:
  module: controllerx
  class: E1743Controller
  controller: corridor_controller
  integration: deconz
  light: light.corridor
  action_delay:
    2002: 10

In this case when the 2002 deCONZ event is fired, it will not be executed until 10 seconds after. What 2002 event does depends on the controller or whatever you define in the mapping section.

Let me know if it needs more clarifying, or if you were asking for something else.

Regards,
Xavi M.

Sorry, i should have been more clear.

My son sometimes goes to the toilet during the night. So he turns on the light in the room, goes to the toilet, comes back and jumps into bed. But he doesnt want to fall a sleep without the lights on so he leaves them on.

So it would be nice when he turns on the light it turns off automatically after 30 minutes…

Hi xaviml,

Thank you for your responce.

I had a look an the short press ( left and right ) give me the following

2021-01-04 20:02:25.563274 INFO sonos_controller: 🎮 Button event triggered: `4002`
2021-01-04 20:02:25.568672 INFO sonos_controller: 🏃 Running `previous_track` now
2021-01-04 20:02:25.573746 INFO sonos_controller: 🤖 Service: media_player.media_previous_track
2021-01-04 20:02:25.578451 INFO sonos_controller:   - entity_id: media_player.sonos
2021-01-04 20:02:34.158518 INFO sonos_controller: 🎮 Button event triggered: `5002`
2021-01-04 20:02:34.163536 INFO sonos_controller: 🏃 Running `next_track` now
2021-01-04 20:02:34.168264 INFO sonos_controller: 🤖 Service: media_player.media_next_track
2021-01-04 20:02:34.173200 INFO sonos_controller:   - entity_id: media_player.sonos

but on a long press I get nothing.

as for the github post, no that wasn’t me, but I probably should have posted there… Sorry…

Thank you for looking into it though

Robin

edit: on a totally different note though… when I press the power button it plays the last thing that came through the speaker (more often than not my doorbell) is it possible to have it play a certain station first?

Hi @Rdoull,

Thank you for your reply and the logs.

as for the github post, no that wasn’t me, but I probably should have posted there… Sorry…

No worries, I take a look at both of the communication channels, so no need to apologize :slight_smile:

I highly recommend you taking a look at the GitHub ticket since someone else had the same problem as you recently. He posted yesterday how he solved it: [BUG] IKEA Tradfri Remote E1810 "Hold/Release events" for < > are not recognized by deconz · Issue #215 · xaviml/controllerx · GitHub

edit: on a totally different note though… when I press the power button it plays the last thing that came through the speaker (more often than not my doorbell) is it possible to have it play a certain station first?

No, this is not supported. However, you could create an HA script for it and call it from ControllerX configuration. You will need to use different configurations with callback constraints from AppDaemon to call play_pause when the media player is paused, and call the script with the right station when idle. Happy to help further if needed :slight_smile:

Regards,
Xavi M.

1 Like

Hi @hans80,

As mentioned before, you could use action_delay, but this will work just if your son clicks the controller again to turn it off. Not very convenient. For this I would recommend you to set up an HA configuration like the following:

alias: 'Turn kid bathroom light off automatically at night'
mode: restart
trigger:
  - platform: state
    entity_id: light.kid_bathroom
    to: 'on'
condition:
  - condition: time
    after: '21:00:00'
    before: '07:00:00'
action:
  - delay: '1800' #  30 minutes in seconds
  - service: light.turn_off
    entity_id: light.kid_bathroom

So, when the light turns on, this automation is triggered. Then it first checks that is night time (between 21 and 7), then it waits 30 minutes (1800 seconds), and finally it turns the light off.

You can copy this YAML into the HA YAML editor for automations and change the light for your entity light name.

Hope this helps,
Xavi M.

Great project.
What’s det procedure for when i have two or more of the same controller?
Their id is the same and it doesn’t matter if i rename them in deconz/ha. Their unique id also seems to be the same.

Hi @Fifthy,

You are saying that you have 2 controllers that are the same, and they have the same name and unique ID?

About the same name, I am not sure, but their unique ID should be different. Be that as it may, you can change the name of your controller through the Phoscon app. Go to Switches, click on the switch that has the same name, and then click in the pencil to edit the name. That is the name that is used in the controller attribute when configuring a deCONZ device.

Regards,
Xavi M.

hmm
In deconz_event:
“data”: {
“id”: “tradfri_open_close_remote”
But i renamed it “TRADFRI open/close remote 2” in deconz

They do seem to have different unique ids now, can i use that in the “controller” field somehow? Instead of the regular id

Hi @Fifthy,

No, it only allows to use the “id”, not the “unique_id”. Once you change the name through Phoscon, I recommend you to restart the deCONZ addon, and even Home Assistant. That should fix your problem.

Regards,
Xavi M.

A restart did it :slight_smile: thanks.

1 Like

Did you ever git this controller working?

Thank you xaviml,

there was no need to change the battery or re-pair the device to deconz just needed to change the app.yaml setting to the following

sonos_controller:
  module: controllerx
  class: E1810MediaPlayerController
  controller: sonos_controller
  integration: deconz
  media_player: media_player.sonos
  volume_steps: 40
  merge_mapping:
    4002: previous_source
    5002: next_source

everything is working perfectly now :slight_smile:

Hi @Rdoull,

Sorry for this. Someone made me realized that the default mapping for de deCONZ integration was missing the 4001 and 5001 events. I added them and it will be fixed for next relase, so you will be able to remove the merge_mapping part again.

Notice that you are overwriting the click with next source. The default mapping for the click (4002 and 5002) is next/previous track. If that is what you want is fine, otherwise, you can change it to 4001 and 5001.

Regards,
Xavi M.