Hello, I need to figure out how to best configure a cover device for my gate. The command_line that I’m using is very kludgy, unreliable and has overhead I want to eliminate (polling & spawning command line scripts).
I have a binary_sensor entity that tell me the open/close state. Because of this I should’nt have to have polling to get the cover state.
I have switch entity that triggers the gate to open & close. It is a momentary switch that turns off after triggered.
I have a gate_open script (HA built in, not a command line) that will turn on the above switch when the gate is closed.
I have a gate_close script (HA built in, not a command line) that will turn on the above switch when the gate is opened.
For reference, here’s snippet of my current config:
cover:
- platform: command_line
covers:
gate:
friendly_name: Gate
command_open: 'curl -k -X POST -H "Content-Type: application/json" https://localhost:8123/api/service/script/gate_open'
command_close: 'curl -k -X POST -H "Content-Type: application/json" https://localhost:8123/api/service/script/gate_close'
command_stop: 'echo'
command_state: 'curl -k -X GET -H "Content-Type: application/json" https://localhost:8123/api/states/binary_sensor.gate_sensor_10_0'
value_template: "{% if value_json.state == 'on' %}0{% else %}100{% endif %}"
Right now, the state is polled every 15 seconds and I would love to not even have polling. If there was just a way to have the cover entity have a value template for the state along with the entity_id of and entity that it could register for any state changes. Along those lines it would be great if I could specify an entity and service for the open & close actions and I could eliminate the command_line overhead all together.