Hi,
Has anyone been able to use a RESTful sensor-like code in a cover instantiation?
I have sensors that determine the state of an A/C duct (open or closed) and a cover to open and close the duct, but ideally the cover would know its state without the sensor…
The sensor is:
- platform: rest
name: Zone Green Room # Zone 1
resource: http://192.168.1.192/Zones1_4
method: GET
verify_ssl: false
value_template: '{{ value_json[0].Mode }}'
and then the cover, using this sensor for its state:
green_room_duct:
friendly_name: "Green Room Ducts"
value_template: "{{ is_state('sensor.zone_green_room', 'open') }}"
open_cover:
- service: shell_command.ac_command
data_template:
data: '{"ZoneCommand":{"ZoneNo":"1","Command":"open"}}'
url: http://192.168.1.192/ZoneCommand
close_cover:
- service: shell_command.ac_command
data_template:
data: '{"ZoneCommand":{"ZoneNo":"1","Command":"close"}}'
url: http://192.168.1.192/ZoneCommand
icon_template: >-
{% if is_state('sensor.zone_green_room', 'open') %}
mdi:fan
{% else %}
mdi:fan-off
{% endif %}
I’m really just trying to improve my cover code style as I’m sure it is inefficient (and I get up to 10 second delays in updating the state on my UI when toggling which I though may have something to do with the separation of the sensor and the cover itself - some is obviously associated with the A/C processing the command).
Thanks for any help you may provide!
Matthew