The switch.test is updated to “on” and “off” when I turn on/off the light, but it doesn’t turn on my coffee switch. What version of HA do you use @RobDYI?
I read your post again and I think the template switch is working as it should. The value_template doesn’t turn the switch on/off but only changes the state. In your case, the state of switch.test is light.kitchen_lamp but changing the state of light.kitchen_lamp shouldn’t turn switch.test on or off.
I’ve tested several times, the switch.test turns on as I turn on my kitchen light. And it turns off when I turn it off.
It makes sense, since the switch should be set to on/off depending on the light.
But it does not solves the mystery about not triggering the switch.coffe_switch.
What version of HA did you have?
Edit: When I mean turn off/turn on the switch.test I mean it sets the state of switch.test to “on” or “off”
If you think of the example of the skylight and someone opens the skylight manually, do you want the the skylight switch to start the motor that tries to open an already open skylight or do you want HA only to show the status of the skylight as open?
In your example, the kitchen light should not turn on the coffee machine, it should only show the test switch as on.
Reading the text, you get the impressions that the sensor.skyllight triggers the switches and control the device.
It also says
For example, if you have a garage door with a toggle switch that operates the motor and a sensor that allows you know whether the door is open or closed, you can combine these into a switch that knows whether the garage door is open or closed.
Which I interpret that they make a switch displaying the state of garage door instead of the sensor? It contradicts the example above.
English is not my native language, so I maybe mixing up things. But the template switch page is confusing…
What is more confusing is this:
turn_on (Required): Defines an action to run when the switch is turned on.
turn_off (Required): Defines an action to run when the switch is turned off.
It cleary states that it runs an action when the switch is on or off, wich supports the quote above about controling a device.
Seems that also the rest switch is not without problems as it seems to be sending some non-json data to API with POST as default. Trying to get past that somehow.
I did not get the platform: template to work but I ended up using platform: rest.
The use case is still the same: I will try to use this to poll I2C GPIO extension board pin statuses. This should function as the gateway to input switch state via API:
This is the result that actually works on that side:
The is_on_template can also be used to check related variables on HASS side, but I haven’t tested that yet. So not sure if and how it will work.
Please note that I had to use the template check to string value: value_json == {“active”: “true”}. I ended up with a problem when I set the json as boolean {“active”: true} it ended up showing True (with capital T) on the web server. I quess this caused it not to match on HASS side. Not 100% sure about it, but I did not feel like debugging this thing as I got it working.