I have a switch (true/false) that I can read or set with rest API. I like to have a toggle that can set this switch on/off or being updated when the switch got changed (without using this toggle).
I am so confused if I should use switch or sensor or binary_sensor or a combination?
So I think i need to add some thing like: value_template: '{{ value_json.value.status }}'
But after that I’m clueless. The code check is accepted and I can restart HAS but there is no trace of an additional switch. I must be skipping a part but I don’t know what.
This reads the value correctly and toggles the switch in HAS when the value is being changed from the device side. But when I try to toggle the switch in HAS, it return to it’s previous status after about 2 second. ie setting from OFF to ON ends in being OFF again.
Is this because the POST and GET command within the REST are done at the same time? Anything I can do to prevent that?
I was able to understand the output from the rest switch by linking it to webhook.site by replacing de resource with a webhook.site link. Not sure why but I only managed to do this once. After that my switch just disappeared. Not sure what I did different the first attempt.