Created
January 19, 2025 10:15
-
-
Save Slalamander/887be90c0cad44271f868677f6b86c40 to your computer and use it in GitHub Desktop.
Ikea Tradfri LED1949C5 Patcher
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| blueprint: | |
| name: Tradfri LED1949C5 Patcher | |
| description: | | |
| The IKEA tradfri LED1949C5 bulbs seem to have a bug in the firmware where instructing them to turn off with a transition when they are already off, causes them to turn on. | |
| The light still reports being off to Home Assistant, however. From testing, this only seemed to happen if the previous command turned the light off from being on. | |
| Calling turn off again when it is in this spooky state (credits to 123 for that term) turns it off and seems to prevent it from happening again. | |
| This blueprint aims to fix the light turning on in the spooky state by catching turn off commands if it is already off. | |
| It listens to all calls to the ``light.turn_off`` service, then checks for the conditions that: | |
| - The light is currently off | |
| - The turn off is called with a transition | |
| - Checks if the light is present in any of the targets, either as entity_id, within a device that is being turned off, or in the area that is instructed to turn off | |
| - Checks if the service call did not originate from the automation (to prevent infinite loops) | |
| Considering IKEA seems to have been phasing out these lights (and likely are done by now), I suspect a firmware update to fix this is unlikely. | |
| This blueprint was written for ``TRADFRIbulbE14WScandleopal470lm`` on firmware `` 0x01010020``. | |
| domain: automation | |
| input: | |
| spooky_light: | |
| name: Light Entity | |
| description: The spooky light | |
| selector: | |
| entity: | |
| filter: | |
| domain: light | |
| variables: | |
| light_entity: !input spooky_light | |
| trigger: | |
| - platform: event | |
| event_type: call_service | |
| event_data: | |
| domain: light | |
| service: turn_off | |
| condition: | |
| - condition: template | |
| value_template: "{{ this.context.id != trigger.event.context.id }}" | |
| enabled: true | |
| - condition: state | |
| entity_id: !input spooky_light | |
| state: "off" | |
| enabled: true | |
| - condition: template | |
| value_template: "{{ 'transition' in trigger.event.data.service_data }}" | |
| enabled: true | |
| - condition: or | |
| conditions: | |
| - condition: template | |
| value_template: | | |
| {% set service_data = trigger.event.data.service_data %} | |
| {% if "entity_id" in service_data %} | |
| {{ light_entity in service_data.entity_id }} | |
| {% else %} | |
| false | |
| {% endif %} | |
| - condition: template | |
| value_template: | | |
| {% set service_data = trigger.event.data.service_data %} | |
| {% if "device_id" in service_data %} | |
| {{ device_id(light_entity) in service_data.device_id }} | |
| {% else %} | |
| false | |
| {% endif %} | |
| - condition: template | |
| value_template: | | |
| {% set service_data = trigger.event.data.service_data %} | |
| {% if "area_id" in service_data %} | |
| {{ area_id(light_entity) in service_data.area_id }} | |
| {% else %} | |
| false | |
| {% endif %} | |
| alias: >- | |
| Test if the light to be fixed is in any of the targets (either its area, | |
| device or the entity itself) | |
| action: | |
| - delay: | |
| hours: 0 | |
| minutes: 0 | |
| seconds: 0 | |
| milliseconds: 500 | |
| - metadata: {} | |
| data: {} | |
| target: | |
| entity_id: !input spooky_light | |
| action: light.turn_off | |
| enabled: true |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment