Dear all,
I’m new to HA, I have my garage door controlled by a custom devices which exposes an http api.
the following configuration works in configuration.yaml:
switch:
- platform: rest
name: Garage
device_class: switch
resource: http://192.168.1.50/ha/switch/garage/
body_on: '{"active": "true"}'
body_off: '{"active": "false"}'
headers:
Content-Type: application/json
verify_ssl: false
but the behavior is like a switch not like a door, meaning in homekit appears like a switch and I need to “turn on” the door rather than opening.
The status (quering http://192.168.1.50/ha/switch/garage/) is json back true/false, but ideally would like to use close/opening/open/closing.
I added a binary sensor and a cover, but not sure why I cannot see the cover in my entities:
binary_sensor:
- platform: rest
resource: http://192.168.1.50/ha/switch/garage/
method: GET
name: Garage Door
device_class: garage_door
value_template: '{{ value_json.status }}'
cover:
- platform: template
covers:
garage_door:
device_class: garage
friendly_name: "GarageCover"
value_template: "{{ is_state('binary_sensor.garage_door', 'true') }}"
open_cover:
service: switch.toggle
data:
entity_id: switch.garage
close_cover:
service: switch.toggle
data:
entity_id: switch.garage
icon_template: >-
{% if states('binary_sensor.garage_door') == "true" %}
mdi:garage-open
{% else %}
mdi:garage
{% endif %}
Can you please help me fixing this? I was looking many example but cannot make any work.
dk