CoolKit-Technologies / ha-addon

Apache License 2.0
264 stars 120 forks source link

After upgrading to 1.4.3 the switches cannot be used in automations because they are not listed as devices. #134

Open gituletz opened 1 year ago

gituletz commented 1 year ago

After upgrading to 1.4.3 the switches cannot be used in automation because they are not listed as devices. The Sonoff switches are listed only as entities. There is an associated notification with the sonoff switches mentioning they cannot be managed because they don't have a unique ID:

This entity ('switch.10010ee5c2') does not have a unique ID, therefore its settings cannot be managed from the UI. See the documentation for more detail.

redelacruz commented 1 year ago

Can confirm. I really hope everything can get a unique ID.

There is a workaround, though. You can use services in automations to accomplish what you want. It's a lot more roundabout, but it works.

Example code:

mode: single
trigger:
  - platform: sun
    event: sunrise
    offset: 0
  - platform: sun
    event: sunset
    offset: 0
action:
  - if:
      - condition: sun
        after: sunrise
        before: sunset
    then:
      - service: switch.turn_off
        target:
          entity_id: switch.10010ee5c2
    else:
      - service: switch.turn_on
        target:
          entity_id: switch.10010ee5c2
gituletz commented 1 year ago

Where can I write the sample code? I am novice with HA. If you can guide me in the right direction I would appreciate.

In the meantime is somebody even checking the issues raised here for ewelink addon? such support makes me think twice when choosing another device for automation. Maybe the right platform is Tuya instead Tuya devices are also cheaper than Sonoff and the other ewelink compatible.

redelacruz commented 1 year ago

When you go to the automation, there should be an Edit in YAML option.

However, you can also do this via the Visual Editor. Just pick the "Call service" action. Then, pick switch.turn_off, switch.turn_on, or switch.toggle depending on what you need to do. You'll then be asked for a target. Use the "Choose entity" button and select the switch you need.

gituletz commented 1 year ago

It works perfectly. Thank you!

CJGuirao commented 1 year ago

Confirm, same issue here.