I’m trying to configure Sonoff mini switch to toggle our bedroom lights.
So far I have create a switch for it and I can toggle the lights on and off (if the entity is updated). But I want to force update the entity to automatically get the newest state of the switch.
So is there a way to force updating the state of the entity because my switch is relaying on that entity state? Below is my configuration of the switch and the entity that I refer to is a rest sensor.
switch:
- platform: template
switches:
masterbedroom:
value_template: "{{ is_state('sensor.licht_master_bedroom', 'on') }}"
turn_on:
service: rest_command.master_bedroom_on
entity_id: sensor.licht_master_bedroom
turn_off:
service: rest_command.master_bedroom_off
entity_id: sensor.licht_master_bedroom
rest_command:
master_bedroom_off:
url: "http://192.168.0.201:8081/zeroconf/switch"
method: post
payload: '{ "deviceid": "100000140e", "data": { "switch": "off" }}'
master_bedroom_on:
url: "http://192.168.0.201:8081/zeroconf/switch"
method: post
payload: '{ "deviceid": "100000140e", "data": { "switch": "on" }}'