So i have been struggling with this case my self from 2 days now.
I have read and tested deferent things around the forum and reddit and did not find working solution. Obviously I am missing something somewhere.
I am trying to do a simple automation.
If i press a button (Ikea E1524 remote connected via Zigbee2MQTT) i want to increase or decrease the brightness of a light. Ether by percent or value. The simple on/off automation works with no problems.
I have no Idea where to put the pointed solution
@TGR I got one just build it today with the same config as you have.
Zigbee2MQTT configuration (with latest release 1.21 and firmware, you must upgrade for use with the E1524 button).
Ikea TRADFRI E1524 button
Ikea TRADFRI LED bulb E27 LED1623G12 (light)
My dimmer E1524 button is showing as 0xd0cf5efffe276402_action and the bulb has multiple entities 2 of them has a attribute with brightness in it. I renamed the entity within zigbee2mqtt but thatâs somehow not done for al the HASS entries The bulb has this address x000b57fffe307869
and in HASS this entities:
light.0x000b57fffe307869_light
sensor.zb_ikea_lamp_badkamer_linkquality
So first I tried to use states.sensor.light.0x000b57fffe307869_light .attributes.brightness but that failed with the validation. But it works with states.sensor.zb_ikea_lamp_badkamer_linkquality.attributes.brightness
So this is the complete example script:
- alias: ZB badroom ON/OFF
trigger:
platform: state
entity_id: sensor.0xd0cf5efffe276402_action
to: 'toggle'
action:
entity_id: light.0x000b57fffe307869_light
service: light.toggle
- alias: ZB badroom - dimmer UP
trigger:
platform: state
entity_id: sensor.0xd0cf5efffe276402_action
to: 'brightness_up_click'
action:
- service: light.turn_on
entity_id: light.0x000b57fffe307869_light
data_template:
brightness: >
{% set suggested = states.sensor.zb_ikea_lamp_badkamer_linkquality.attributes.brightness|int + 31 %}
{% if suggested < 200 %}
{{ suggested }}
{% else %}
200
{% endif %}
- alias: ZB badroom - dimmer DOWN
trigger:
platform: state
entity_id: sensor.0xd0cf5efffe276402_action
to: 'brightness_down_click'
action:
- service: light.turn_on
entity_id: light.0x000b57fffe307869_light
data_template:
brightness: >
{% set suggested = states.sensor.zb_ikea_lamp_badkamer_linkquality.attributes.brightness|int - 31 %}
{% if suggested > 25 %}
{{ suggested }}
{% else %}
25
{% endif %}
So you can use this for reference, just put your own entity IDâs in it.
And the Ikea E1524 dimmer is quite fancy, it has multiple states when you press a button. short and long presses gives different states:
âtoggleâ
âbrightness_up_holdâ
âbrightness_up_releaseâ
âbrightness_up_clickâ
âbrightness_down_clickâ
âbrightness_down_releaseâ
âbrightness_down_clickâ
âarrow_right_clickâ
âarrow_left_clickâ
Next step is to get this states working in a script so that way when I long press the brightness button the bulb will continue to in/decrease the levels.
my brightness is set in an other sensor than the switch for the light ON/OFF.
on/off is in light.0x000b57fffe307869_light and brightness is in sensor.zb_ikea_lamp_badkamer_linkquality
OK, I need help then in other direction then.
How can I read/use the current brightness of switched on light as condition?
What condition TYPE should I use: numeric state, state, or template?
I did try state, but all I tried to put in numeric state does not work.
Examples or suggestions anyone?
I have somewhat the same configuration as @alco has above, but I donât use the discovery mode from zigbee2mqtt. I define all of my devices (sensors) manually in yaml.
An example with the IKEA Tradfri LED bulb E27 600 lumen dimmable, color, opal white light (LED1624G9):
Notice the fact that Iâm using json_attributes_topic in there, which adds all of the attributes (which are available in the zigbee2mqtt JSON) to the light sensor in Home Assistant.
So, by adding that I can simply call states.light.living_room.attributes.brightness or state_attr('light.living_room', 'brightness') to retrieve its brightness, whichever you prefer.
And this is my automation which is based on percentages:
In this automation you see zigbee2mqtt/remote_living_room as the topic. remote_living_room is the friendly_name of my IKEA Tradfri remote control in the zigbee2mqtt configuration itself.
was trying to use this action on the UI and it doesnt let me save it so I went manual on the yaml file however is not working, Im trying to regulate the brightness of my yeelights with the rotatetion of a xiaomi cube
id: '000000001'
alias: Tesseract_rl
trigger:
- entity_id: sensor.0x00158d0001038f7c_action
platform: state
to: rotate_left
condition:
- condition: state
entity_id: light.la_luz_del_estudio
state: 'on'
action:
- data:
brightness: >
{% set suggested = states.light.light.la_luz_del_estudio.attributes.brightness|int + 31 %}
{% if suggested < 200 %}
{{ suggested }}
{% else %}
200
{% endif %}
Am I doing anything wrong? checked the indentation but the configurator says its alright
I created an app for AppDaemon to bring full functionality to IKEA E1524/E1810 and IKEA E1743. If you have more than one controller you can add a new instance app and thatâs it. I donât support group of lights, just 1 sensor connected with 1 light. However, you can connect them by creating different apps with multiple lights and the same controller in all of them. You can see the post about it here.
Thanks, man! You really saved me from going down a rabbit hole there! Was considering if I was going to create a custom component for this. Glad I saw your reply first. Canât say putting the functionality in light.turn_on is the most intuitive⌠Should probably have been its own service?
Anyways, @Method, is there any way you could mark @robvâs answer as the correct one? I think it could help others coming across this topic