Showing 3-Way Switches in the GUI

I have a 3-way switch installed in a multi-way circuit. It shows as an on-off-switch whereas its function is to be a toggle from on-off or off-on based on a momentary push.

Has someone figured out an elegant graphical way to show this in Lovelace?

In an ideal world, it would even integrated the state of the underlying circuit, energized or de-energized :grin:

Thanks

Very interesting, but the entity itself only has on/off states even though it is effectively a toggle switch :frowning_face:

Thanks for the pointer, though.

So it’s just a switch. Where does the “three way” come into it?

The relay included with the smart switch is a single pole double throw type which connects Common to one of two Travelers so that the switch can be installed at either end of a multi-way circuit.

The device generates two MQTT switch entities, each with ON/OFF states. One entity is the physical state of the switch and the other the state of the circuit. So it is possible for circuit to be ON while the switch is OFF because of one of the other physical switches.

Got it.

So you are only getting the state of the switch connected to the smart device not the state of the load in (what the rest of the world calls) a two way system.

You need to rewire the switches so that the two physical switches (connected by the traveller wires) are connected to your smart switch input. That way if either of the switches changes state your smart device can tell and it changes the load.

Everything works fine from the physical switches. I’m trying to improve the representation in the Lovelace GUI

Yes, that is what I suggested will do.

You will then have a switch in HA that changes depending on the state of the light, i.e. both switches not the single currently connected switch.

In HA what do you care what the switches are? You care whether the light is on or off. You want to turn the light on or off. Why do the switches need to be represented at all?

1 Like

@nickrout

Agree completely. It is just that MQTT Discovery set up my 3-way smart switch as two switch entities and I’m trying to figure out how to get the circuit to be represented as a light whose state is shown by an icon and that can be turned on/off by touching that same icon instead of another icon

Well why didn’t you say that in the first post?

Here is what you need:

Still figuring out my way around, hence often don’t know the right question to ask.

Light templates look fascinating and I might be able to get away with using an icon_template and a value_template and possibly an availability_template.

If the state has evaluated to “on” and I click the icon, does it invoke the turn_off function? And can I just assign a value to a switch entity in the turn_off function instead of invoking a service like in the examples?

(Of course something equivalent would have to done for turn_on)

Thank you so much!

So what device is this switch?

TreatLife SS02 3-way switch flashed with Tasmota 8.5.0.1

switch.treatlife1_toggle1 tells me whether the light is on and toggling switch.treatlife1_toggle2 (it accepts commands to turn it on or off or to toggle it) will toggle the light. The code below created an entity called light.front_porch_lights that shows the correct state of the lights and is clickable to toggle it!

light:
  - platform: template
    lights:
      front_porch_lights:
        friendly_name: "Front Porch Lights"
        value_template: >-
          {% if is_state('switch.treatlife1_toggle1', 'off') %}
            off
          {% else %}
            on
          {% endif %}
        icon_template: >-
          {% if is_state('switch.treatlife1_toggle1', 'off') %}
            mdi:lightbulb-off
          {% else %}
            mdi:lightbulb-on
          {% endif %}
        turn_on:
          service: switch.toggle
          data:
            entity_id: switch.treatlife1_toggle2
        turn_off:
          service: switch.toggle
          data:
            entity_id: switch.treatlife1_toggle2

Thanks @tom_l

I can put it in a light card in Lovelace in which case it shows up as a bulb or in an entities card where it shows up as a toggle switch. Unfortunately, the light card can only take a single light.

It works for light groups…

Does a light group allow independently clickable lights?

Thanks

No, it controls them all with the same data. If you individual control just use multiple cards in a stack

Thanks, again

Maybe I should open up a new topic for this but today, we had a power outage. When the electricity was restored, the three way switch kind of works except ON is now OFF and vice versa in both the dashboard and the LED on the switch.

Is there a reset function or something that I should be invoking? I could change the template to match this behavior but the next power outage could switch things around again so I am hesitant.