-
-
Save niro1987/f6e84c27b304f0bf3be16a8f439e8efd to your computer and use it in GitHub Desktop.
I've seen something like it here:
https://community.home-assistant.io/t/turn-light-on-and-off-based-on-detected-motion/255994
If I could code it by myself I would do it, but I'm not a pro here :D
I’ll have a look
@dbara
I've updated the code. It should now work fully and be able to target multiple lights. Please reset and share your findings.
Please be aware that while you can select multiple lights, you will have to select them using the Pick Entity button.
Hey Niro, thank you for helping this much.
Current state is:
y Short Press Power
n Short Press Left
n Short Press Right
y Short Press Up
y Short Press Down
y Long Press Power
n Long Press Left
n Long Press Right
y Long Press Up
y Long Press Down
I get the following logs:
Error while executing automation automation.aaaaa2_zigbee2mqtt_ikea_tradfri_5_button_remote_warm_white_lights: Error rendering data template: UndefinedError: 'dict object' has no attribute 'entity_id'
22:19:51 – (FEHLER) Automatisierung
aaaaa2 Zigbee2MQTT - IKEA TRADFRI - 5 Button Remote - Warm White Lights: Choose at step 1: choice 4: Error executing script. Error for call_service at pos 1: Error rendering data template: UndefinedError: 'dict object' has no attribute 'entity_id'
22:19:51 – (FEHLER) Automatisierung - Die Nachricht ist zum ersten Mal um 22:19:51 aufgetreten und erscheint 2 mal
Hope this time I provided all helpful informations?
Thanks for your patience and work.
It sounds like you selected the target lights either by area or by device, not by entity.
Wow, you're right. Now I get another error:
Error while executing automation automation.aaaaa2_zigbee2mqtt_ikea_tradfri_5_button_remote_warm_white_lights: Error rendering data template: TypeError: unsupported operand type(s) for +: 'NoneType' and 'int'
22:44:13 – (FEHLER) Automatisierung - Die Nachricht ist zum ersten Mal um 22:44:11 aufgetreten und erscheint 2 mal
aaaaa2 Zigbee2MQTT - IKEA TRADFRI - 5 Button Remote - Warm White Lights: Choose at step 1: choice 4: Error executing script. Error for call_service at pos 1: Error rendering data template: TypeError: unsupported operand type(s) for +: 'NoneType' and 'int'
22:44:13 – (FEHLER) Automatisierung - Die Nachricht ist zum ersten Mal um 22:44:11 aufgetreten und erscheint 4 mal
One of the selected lights doesn't have a property color_temp
It's only one Light currently, and it's the same as before, it should support color_temp.
Can I provide more information somehow?
When you got this error, was the light turned on or off before you pressed the (left or right) button?
You cannot change the color_temp
while the light is turned off. Turn it on first, then change the color_temp
with left or right.
This is crazy, I repaired the bulb, now it works -.-
Only right & left are switched for me, eg. left button goes orange instead of blue and vice versa.
*re-paired..
Tried it now with two bulbs simultaneously, works like a charm.
Only issue still left & right arrow seem to be swapped.
Cheers and thanks a lot already
Swapped left and right
Love you, it works :)
I hope this is the last one, maybe just a quick question.
When I press the buttons rapidly the action seems to pause a while. Then I have to wait several seconds before I can continue, is there a way to improve it?
And would it be ok for you if I fork this code? I would like to try customizing the brightness steps, maybe I can learn how to help myself out instead of giving you headaches ;)
I believe the repeated button press is blocked by the remote itself. Saw that same behavior in a YouTube video by Frenck so I never gave it any thought.
Fork all you want. Make sure to change the source_url on your fork before you import it the first time.
Happy to help the community.
Hi niro1987, thanks a lot of this blueprint. I have some issues with the color temp for IKEA lights.
On/of is working, dimming is working, changing colortemps is not. The lamps are capable of switching cold to warm white. (LED1732G11)
I'm using a lightgroup to change 3 of these exact same lights.
Some error logs:
Logger: homeassistant.components.automation.woonkamer_verlichting_eettafel_remote
Source: helpers/script.py:1337
Integration: Automation (documentation, issues)
First occurred: 8:02:24 (30 occurrences)
Last logged: 8:03:33
Woonkamer Verlichting Eettafel - Remote: Choose at step 1: choice 10: Error executing script. Error for repeat at pos 1: Error rendering data template: TypeError: unsupported operand type(s) for +: 'NoneType' and 'int'
Woonkamer Verlichting Eettafel - Remote: Choose at step 1: choice 5: Error executing script. Error for call_service at pos 1: Error rendering data template: TypeError: unsupported operand type(s) for +: 'NoneType' and 'int'
Woonkamer Verlichting Eettafel - Remote: Error executing script. Error for choose at pos 1: Error rendering data template: TypeError: unsupported operand type(s) for +: 'NoneType' and 'int'
Woonkamer Verlichting Eettafel - Remote: Choose at step 1: choice 4: Error executing script. Error for call_service at pos 1: Error rendering data template: TypeError: unsupported operand type(s) for -: 'NoneType' and 'int'
Woonkamer Verlichting Eettafel - Remote: Error executing script. Error for choose at pos 1: Error rendering data template: TypeError: unsupported operand type(s) for -: 'NoneType' and 'int'
Logger: homeassistant.components.automation.woonkamer_verlichting_eettafel_remote
Source: components/automation/__init__.py:508
Integration: Automation (documentation, issues)
First occurred: 8:02:24 (14 occurrences)
Last logged: 8:03:33
Error while executing automation automation.woonkamer_verlichting_eettafel_remote: Error rendering data template: TypeError: unsupported operand type(s) for +: 'NoneType' and 'int'
Error while executing automation automation.woonkamer_verlichting_eettafel_remote: Error rendering data template: TypeError: unsupported operand type(s) for -: 'NoneType' and 'int'
Any idea how to fix this?
Hi @FlexxFR,
The error says that the selected light entity does not have a color_temp
property while the action was performed. This could be caused by one or all of the following:
- When creating the automation, you selected the light by area or by device. For this blueprint to work you need to select it by entity.
- The light entity was turned off when you pressed one of the temperature buttons. For the temperature change to work, the light has to be on.
- The light entity does not have a
color_temp
property. Some lights that can change between warm-white and cold-white use thekelvin
property.
I used the entity selection but used a "light group", switching to 3 induvidual light entities did the trick.
Now it's working 👍
Although, HA is reproting the lightgroup is supporting the color_temp.
min_mireds: 250
max_mireds: 454
effect_list: stop_effect, okay, breathe, finish_effect, channel_change, blink
supported_color_modes: **color_temp**
entity_id: light.eettafel_lamp_1, light.eettafel_lamp_2, light.eettafel_lamp_3
friendly_name: Verlichting Eettafel
icon: mdi:lightbulb-group
supported_features: 44
Is it correct groups are not supported?
At first I still believed it was not working because I was expecting a "step-mode" like the original IKEA mode, but it's working more gradually by holding the buttons. Great, even better :)
Great to hear that you've got it working now!
By the looks of it, the light group does allow a color_temp
to be set but it does not actually report what it's current color_temp
value is.
Hey Niro, I now had the Time to fork it, but somehow it doesn't seem to work.. I already deleted it, as I thought my edits were the issue, now I have a fresh fork but it still doesn't work properly.
I get the error "Error rendering data template: TypeError: unsupported operand type(s) for +: 'NoneType' and 'int'"
Happenes for the light color (color temp).
Do you have any idea?
The fork is here:
https://gist.github.com/dbara/911b76bb842bf2c76362c0ac9abb443b
Hey again, I found the issue and how to fix it. When you select one entity, it adds it differently than when you add multiple. You have to edit the automation as yaml and correct it.
Wrong:
light_entity:
entity_id: light.0xbc...
Correct:
light_entity:
entity_id:
- light.0xbc...
Have a good day
Hola de nuevo, encontré el problema y cómo solucionarlo. Cuando selecciona una entidad, la agrega de manera diferente que cuando agrega varias. Tienes que editar la automatización como yaml y corregirla.
Incorrecto: light_entity: entity_id: light.0xbc ...
Correcto: light_entity: entity_id: - light.0xbc ...
Que tenga un buen día
Thanks! I had the same problem with the Ikea bulbs and solved it with your tip
replace every var_light_entities.entity_id[0]
with var_light_entities.entity_id
Okay, can someone help me out here? I got the same issue with the colors. The Tradfri bulb has the property of "color_temp" but it won't change the color, always gives the same error:
Logger: homeassistant.components.automation.zigbee2mqtt_ikea_tradfri_5_button_remote_warm_white_lights
Source: components/automation/__init__.py:676
Integration: Automation ([documentation](https://www.home-assistant.io/integrations/automation), [issues](https://github.com/home-assistant/core/issues?q=is%3Aissue+is%3Aopen+label%3A%22integration%3A+automation%22))
First occurred: 17:48:25 (57 occurrences)
Last logged: 19:48:19
Error while executing automation automation.zigbee2mqtt_ikea_tradfri_5_button_remote_warm_white_lights: Error rendering data template: TypeError: unsupported operand type(s) for +: 'NoneType' and 'int'
Error while executing automation automation.zigbee2mqtt_ikea_tradfri_5_button_remote_warm_white_lights: Error rendering data template: TypeError: unsupported operand type(s) for -: 'NoneType' and 'int'
I already repaired the bulb twice, no change. I can change the color using the dev menu or my own automatisation just fine.
I'll test it on monday, as I'm not home currently.
One rule per light would normally be fine, but what if you have three light sources in one room, wich each has six or seven bulbs.