I am looking for the working example how to control virtual binary sensor from Automation.
I did a lot of search but unfortunately did not find any solution for my problem.
Binary Sensor is successfully created by adding this code to the configuration.yaml
Class must be 'presence" because only this way sensor status could be passed to
the Hubitat hub.
binary_sensor:
- platform: virtual
name: 'Presence Status VK'
initial_value: 'on'
class: presence
initial_availability: true
I can change status from the Developer Tools screen by typing on or off
in the state field:
But even this way after few seconds status returns to whatever I assign
to the initial_value field. Why this is happening?
However no matter what I am/was trying status does not change from Automation.
Here is what I tried for the Test Automation:
- id: '1652549626534'
alias: BT Beacon Unlock
description: ''
trigger:
- platform: device
device_id: 15b5e6697b305fe24740ab030e5e9f97
domain: lock
entity_id: lock.front_door
type: unlocked
condition: []
action:
- condition: state
entity_id: binary_sensor.virtual_presence_status_vk
state: virtual.turn_off
mode: single
- id: '1652550230919'
alias: BT Beacon Lock
description: ''
trigger:
- platform: device
device_id: 15b5e6697b305fe24740ab030e5e9f97
domain: lock
entity_id: lock.front_door
type: locked
condition: []
action:
- condition: state
entity_id: binary_sensor.virtual_presence_status_vk
state: virtual.turn_on
mode: single
What I am missing?
Please help me to solve this problem.