EPMatt / awesome-ha-blueprints

A curated collection of automation blueprints for Home Assistant.
https://epmatt.github.io/awesome-ha-blueprints
GNU General Public License v3.0
823 stars 246 forks source link

Bug - IKEA E1743 longpress no longer works #312

Open kanflo opened 2 years ago

kanflo commented 2 years ago

Blueprint name

Controller - IKEA E1743 TRÅDFRI On/Off Switch & Dimmer

Home Assistant Core Version

2022.4.3

Home Assistant Installation Type

Home Assistant Operating System

Description

Prior to 2022.3 long press on the E1743 worked like a charm using ZHA. Long press yields the following in the log:

Invalid value: {"trigger_action": "move_MoveMode.Down_83_bitmap8.0_bitmap8.0", "last_triggered": "2022-04-13 21:25:11.011648+02:00"} (length range 0 - 100)

Automation YAML config

- id: '1638911675158'
  alias: Dimmer Johans skrivbord
  description: ''
  use_blueprint:
    path: EPMatt/ikea_e1743.yaml
    input:
      integration: ZHA
      controller_device: 7373e365206f24b54f6423ab692dde58
      helper_last_controller_event: input_text.johan_skrivbord_dimmer
      action_button_up_short:
      - type: turn_on
        device_id: 5b9e9eee8d41b76735b2b02fc452e0c0
        entity_id: light.skrivbord_hoger
        domain: light
      - type: turn_on
        device_id: 1bb7f39db1216c8254014b33de543dae
        entity_id: light.skrivbord_vanster
        domain: light
      action_button_up_long:
      - device_id: 5b9e9eee8d41b76735b2b02fc452e0c0
        domain: light
        entity_id: light.skrivbord_hoger
        type: brightness_increase
      - device_id: 1bb7f39db1216c8254014b33de543dae
        domain: light
        entity_id: light.skrivbord_vanster
        type: brightness_increase
      action_button_down_short:
      - type: turn_off
        device_id: 5b9e9eee8d41b76735b2b02fc452e0c0
        entity_id: light.skrivbord_hoger
        domain: light
      - type: turn_off
        device_id: 1bb7f39db1216c8254014b33de543dae
        entity_id: light.skrivbord_vanster
        domain: light
      action_button_down_long:
      - device_id: 5b9e9eee8d41b76735b2b02fc452e0c0
        domain: light
        entity_id: light.skrivbord_hoger
        type: brightness_decrease
      - device_id: 1bb7f39db1216c8254014b33de543dae
        domain: light
        entity_id: light.skrivbord_vanster
        type: brightness_decrease
      button_up_long_loop: true
      button_up_long_max_loop_repeats: 100
      button_down_long_loop: true
      button_down_long_max_loop_repeats: 197

To Reproduce

  1. Long press up or down on the E1743

Expected behavior

The lights dimmed up or down.

Actual Behaviour

  1. Devtools / States claims the automation has run
  2. Configuration / Logs show an error setting the text input helper
  3. Light brightness did not change

Additional Details

Screenshots

No response

Additional context

kanflo commented 2 years ago

Actually it seems a bit unfair to label this as a bug in this repo. The input text has a default max length of 100 bytes and this limit is two years in the making.

ZHA could be the culprit by suddenly creating longer events causing strings like this:

{"trigger_action": "move_MoveMode.Down_83_bitmap8.0_bitmap8.0", "last_triggered": "2022-04-13 22:47:23.227150+02:00"}

To regain dimming of lights, one first needs to bump the max length of the input texts (min might be optional):

input_text:
  johan_skrivbord_dimmer:
    name: Dimmer Johans skrivbord
    min: 0
    max: 255

Additionally, the automation needs to adapt to the new ZHA events. See #314

Side note: as 255 is the max input string length, it seems to me HASS is written in Pascal :smile:

Hedda commented 2 years ago

FYI, for reference also see this related ZHA issue discussion for Home Assistant core -> https://github.com/home-assistant/core/issues/69375

EPMatt commented 2 years ago

Hi @kanflo,

I'm really sorry for the long delay. I didn't notice this issue and I jumped directly in the discussion in your PR. I'll link this ticket to your Pull Request, so we can keep track of its progress as well. For anyone jumping into this now, please check out #314; there you'll find the fix for this, and the updated blueprints, which you can download and test on your HA instance. If you still experience issues, please provide your feedback in the Pull Request.

Thank you for your work and for your patience! :)