Physical switch not working, but works in Home Assistant GUI

Hi all,

Possibly a silly question.

I’ve just installed Home Assistant 2021.1.5, it has automatically discovered all of my LIFX lights and Smart Life (Tuya) light switches.

I’ve setup an automation that when one of the light switches is turned on, it switches on a LIFX bulb. The automation works if I turn the switch on via the Home Assistance GUI, but if I physically press the switch on the wall, it doesn’t do anything. The physical press of the switch on the wall also doesn’t register a change of state in Home Assistant.

I know the switch works, as I previously had it turning on a smart wall plug via the Smart Life app.

Maybe I missed something in the setup of the switch in Home Assistant, not sure?

The particular switch in question is this one: https://www.bunnings.com.au/deta-grid-connect-smart-double-gang-touch-light-switch_p0098812

Cheers,
Justin

Hi and welcome to the forum.

I did not think the Lifx switches were supported (yet). So you can see the state of the switch change in home assistant when you press the wall switch?

Can you please post your automation here (correctly formatted)?

Ah I wasn’t aware that LIFX switches were not supported. They were discovered with no issues, and toggling them off and on via Home Assistant works well.

When I press the wall switch physically, it does not change state in Home Assistant. But if I change the state of the switch in Home Assistant, the wall switch will change state. You can hear it click and the light on the switch goes on/off.

Automation is as follows:

alias: Wyatt's Lamp
description: ''
trigger:
  - platform: device
    type: turned_on
    device_id: 44de89a467cbc3ab413675c32aae848e
    entity_id: switch.1303035410521ce8d7da_2
    domain: switch
condition: []
action:
  - type: turn_on
    device_id: d1cd0b6e5f2022647e8e3b4f4b024418
    entity_id: light.wyatt_s_lamp
    domain: light
    brightness_pct: 100
mode: restart

They may be supported by the existing integration. I just wasn’t sure as the switches are quite new.

Try this:

alias: Wyatt's Lamp
description: ''
trigger:
  - platform: state
    entity_id: switch.1303035410521ce8d7da_2
action:
  - service: light.turn_{{ trigger.to_state.state }}
    data:
      entity_id: light.wyatt_s_lamp
      brightness_pct: 100
mode: restart

If it does not work, look in the Developer Tools States menu an see if switch.1303035410521ce8d7da_2 changes state when you press it.

Also just fyi, you can change your switch entity_id to something more meaningful in the configuration / entities menu.

EDIT just thought of something. If this is a momentary push button (not a toggle switch) try this instead:

alias: Wyatt's Lamp
description: ''
trigger:
  - platform: state
    entity_id: switch.1303035410521ce8d7da_2
action:
  - service: light.toggle
    data:
      entity_id: light.wyatt_s_lamp
      brightness_pct: 100
mode: restart

Thanks for all the help mate.

I tried the first code snippet, but it didn’t do anything unfortunately, either via the physical switch, or using the “Execute” command in Home Assistant.

When I tried the second code snippet, that didn’t do anything when the physical switch was pressed, but when I used the “Execute” command in Home Assistant, it turned on the light, but didn’t turn on the physical switch.

If I look at switch.1303035410521ce8d7da_2 in the Developer Tools States menu, it doesn’t change state when I physically press the switch.

Sorry and I just noticed you said LIFX switches in your original post, I read it as LIFX lights. I don’t have LIFX switches, I have LIFX bulbs. The light switch I am using is Smart Life/Tuya compatible one.

Ah. My mistake. I missed that it was a Tuya switch.

There’s your issue then. Why isn’t the switch sending it’s state to Home Assistant.

So it should as far as you are aware? No extra configuration should be required?

Definitely. If you want to use it with home assistant.

This I’m not so sure on. I flashed all my Tuya devices with alternative firmaware so they work locally using the ESPHome API. So I know very little about the Tuya integration.

Are there any errors related to your Tuya switch in the Configuration / Logs menu?

It may be an unsupported device. You can check here: GitHub - PaulAnnekov/tuyaha: Implements the special Tuya Home Assistant API.

Yep I thought that might be an option. But there appears to be reports of Grid Connect products no longer being able to be flashed? My Grid Connect lights are working even though they are in Tuya - #10 by greybags

Nothing in the logs that specifically relate to the light switch that I can see.

Bugger, thanks for the link, I’ll take a look.

Yep. Tuya keep moving the goal posts. I got in early, before their first firmware update to prevent hacking of their devices. Now they don’t even use ESP chips in some of their devices.