Yesterday I tried to push on the topic and managed to create a fake boolean input sensor. I created two automation scripts in order to change the status when the cover is open (after two seconds the bool is reset to False from a second script). If I play with this boolean variable, the HomeKit cover status is properly updated and shown on the Home App.
The (strange) issue I have now, is that I can’t control the switch anymore. I mean… when I try to call the open_cover service no switch is triggered / no mqtt command is issued.
The code is the following:
Inside cover.yaml
I have:
- platform: template
covers:
garden_gate:
unique_id: "Garden Gate"
device_class: gate
value_template: "{{ false if is_state('input_boolean.gate_fake_sensor','off') else true }}"
friendly_name: "Garden Gate"
open_cover:
service: switch.turn_on
target:
entity_id: switch.gate
close_cover:
service: switch.turn_off
target:
entity_id: switch.gate
While, the switch.yaml
device (it’s a shelly1) is configured as:
#Garden Gate
- platform: mqtt
name: "Garden Gate"
state_topic: 'shellies/GardenGate/relay/0'
command_topic: 'shellies/GardenGate/relay/0/command'
availability_topic: 'shellies/GardenGate/online'
unique_id: garden_gate
payload_on: 'true'
payload_off: 'false'
payload_available: 'true'
In order to complete the code report, my boolean input variable is described as the following:
gate_fake_sensor:
name: "Garden Gate - Fake Sensor"
icon: mdi:gate
While the automations I wrote are the following two:
- id: '1653511856618'
alias: Garden Gate Fake Sensor - Reset if True
description: ''
trigger:
- platform: state
entity_id:
- input_boolean.gate_fake_sensor
for:
hours: 0
minutes: 0
seconds: 2
from: 'off'
to: 'on'
condition: []
action:
- service: input_boolean.turn_off
data: {}
target:
entity_id: input_boolean.gate_fake_sensor
mode: single
- id: '1653519204938'
alias: Garden Gate - Fake Sensor to True
(Duplica)
description: ''
trigger:
- platform: state
entity_id:
- cover.garden_gate
from: closed
condition: []
action:
- service: input_boolean.turn_on
data: {}
target:
entity_id: input_boolean.gate_fake_sensor
mode: single
I am not sure what I am missing now since everything seems to be as suggested by the documentation…
Any idea?
The yaml code check is ok and I tried already to reboot the homeassistant service.