Simple light on off blueprint, turning light on dimly when pressing off

I have a bit of a strange issue which I wonder if anyone is able to help with please? I have a few IKEA switches and bulbs connected to ZHA and have written a simple blueprint to make the switches turn the lights on and off:

This all seems to work fine, I create an automation by giving it a switch and light and it works. When I press on the light goes on and it goes off when I press off.

The issue I’m having is that on one automation, all seems fine too, but, if you press off when it’s already off the light will come on, but quite dim, HA doesn’t show any logs for this happening, and the status of the light in HA is still off (0%), if I keep pressing the off button it will toggle. I have two other switches and bulbs all IKEA Rodret switch and IKEA E27 bulbs and they don’t do the same thing.

This dimmed bulb state is the same as what you get if you remove the bulb and put it back in again, i.e. it’s startup state which is quite a useful feature, but even if this is what is happening here with my issue, how is Home assistant doing this, and not knowing it’s doing it (hope this makes sense)

If anyone has any ideas please that would be great, thanks.

BTW, if I write a manual automation for this it works fine without the issue.

alias: Landing debug
description: ""
trigger:
  - device_id: d0a40d3ee3617cd79c9cf21be3358108
    domain: zha
    platform: device
    type: remote_button_short_press
    subtype: turn_on
    id: "on"
  - device_id: d0a40d3ee3617cd79c9cf21be3358108
    domain: zha
    platform: device
    type: remote_button_short_press
    subtype: turn_off
    id: "off"
condition: []
action:
  - choose:
      - conditions:
          - condition: trigger
            id:
              - "on"
        sequence:
          - service: light.turn_on
            metadata: {}
            data:
              brightness_pct: 100
            target:
              entity_id: light.landing_bulb_light_2
      - conditions:
          - condition: trigger
            id:
              - "off"
        sequence:
          - service: light.turn_off
            metadata: {}
            data: {}
            target:
              entity_id: light.landing_bulb_light_2
mode: single

I’m sorry, but I can’t read that. If you fix it I will try to help you.

Thanks, yeah I can’t figure out how to copy and paste from terminal in HA, hence the screen shot. Will have another go and getting the code in a more readable format.

1 Like

Apologies for the delay @Sir_Goodenough here is the blueprint code:

blueprint:
  name: light switch
  description: light switch
  domain: automation
  input:
    switch:
      name: Switch
      selector:
        device:
          filter:
            - integration: zha
              model: "RODRET Dimmer"
    light:
      name: Light
      selector:
        target:
          entity:
            domain: light
trigger:
  - device_id: !input switch
    domain: zha
    platform: device
    type: remote_button_short_press
    subtype: turn_on
    id: "on"
  - device_id: !input switch
    domain: zha
    platform: device
    type: remote_button_short_press
    subtype: turn_off
    id: "off"
condition: []
action:
  - choose:
      - conditions:
          - condition: trigger
            id:
              - "on"
        sequence:
          - service: light.turn_on
            metadata: {}
            data:
              transition: 0
              brightness_pct: 100
            target: !input light
      - conditions:
          - condition: trigger
            id:
              - "off"
        sequence:
          - service: light.turn_off
            metadata: {}
            data:
              transition: 0
            target: !input light
mode: single

Thanks!

Are the switches the kind with no neutral?
I bet they are. If so you would need a bypass cap or resistor connected across the bulbs because the switch may be drawing too much for the bulb to go dark.
Another brand of bulb might solve that.
The code looks fine from what I can see.

Thanks for looking at the code and for the reply. Just to confirm, the switches I have are not smart switches that you wire into the wall in replacement of a normal switch, they are battery operated zigbee switches, and the bulbs are smart bulbs and the power to them are just always on. The switch controls the bulbs via HA. Therefore I do not believe that no neutral wire is the issue.

OK so it’s a bulb that internally won’t turn itself off. WOW. Can you look at the actual state of the bulb? does it think it’s off or just dim or something. Those sound like some weird bulbs.

The bulb has gone bad, sorry to say. :slight_smile: Had that with two bulbs from IKEA (over years, so no worries).

It seems, like the PCB over time is going bad and shortening something. It looks like they would just dim a litlle, like a fire just before it goes out. :slight_smile:
Normally these signs come up, when you have not enough ground on the PCB.

With mine, they were very warm, if not even hot, in the weeks before they “burned out”. Maybe check if this is the case for you, and if so, just recycle them. It’s not something you would want to blow up, for that 15.-€… :wink:

But all of these are guesses, I brought mine to the recycling right after it started, without even looking for a reason. If a bulb, that is running on power all the time shows signs of destruction, I’ll recycle them and buy new ones. But hey, that’s me. :rofl:

2 Likes

Thanks for your replies, I guess it may be possible for there to be an issue with the bulb, although that doesn’t really explain why it’s only an issue with the blueprint, which I thought exactly reproduced my original automaton. As the bulb only communicated directly with HA and so does the switch, HA is the only things linking the two. So none of this really makes any sense.

Just checked and now the blueprint and automation have the same issue, at least that part is consistent. So it could be a dodgey bulb but annoyingly it’s only a month or 2 old. But found a work around for now, which is to put in a second condition to check if the bulb is on before turning it off, which seems to work. Will put this into my blueprint soon.