I have a light automation where I want to add a condition of BLE devices NOT being in the room to turn lights off 5 minutes after their states change from room name (in this case ESPresense_br_primary to not_home). From what I read, the way to do this is through a binary sensor. I’m trying to set one up but keep getting errors.
In Developer Tools > Templates I created the binary sensor based on a post that I found from @tom_l in September 2022. It reads like this:
- template:
- binary_sensor:
- name: "Master Bedroom Occupancy"
state: >
{{ "ESPresense_br_primary" in [
states('sensor.espresence_lynn_iphone'),
states('sensor.espresence_ashley_iphone')] }}
delay_on: 5
delay_off: 5
I’m getting values or true/false in my results so I think it’s working properly.
When I go to add to configuration.yaml though, things start falling apart. and I get the error: unable to load schema from ‘http //schemas.home-assistant.io/configuration’ no content
And when I check config I get Invalid config for [sensor]: required key not provided @ data[‘platform’]. Got None. (See /config/configuration.yaml, line 20).
In my configuration.yaml I have:
### YAML File Locations
sensor: !include sensors.yaml
and my sensors.yaml is this:
### ESPresense Sensors ###
# One entry for each beacon you want to track
- platform: mqtt_room
device_id: "irk:f86b9a8c7ef8a663c2df2ba00d304250"
name: "ESPresence Lynn iPhone"
state_topic: "espresense/rooms"
timeout: 10
away_timeout: 120
- platform: mqtt_room
device_id: "irk:b3ad1f15da3f18fe0a7c26eef85b8465"
name: "ESPresence Lynn iPad6"
state_topic: "espresense/rooms"
timeout: 10
away_timeout: 120
- platform: mqtt_room
device_id: "ESPresence Ashley iPhone"
name: "ESPresence Ashley iPhone"
state_topic: "espresense/rooms"
timeout: 10
away_timeout: 120
- platform: mqtt_room
device_id: "irk:116605e62ea8591ba66c9c1cc06cb23b"
name: "ESPresence Ethan iPhone"
state_topic: "espresense/rooms"
timeout: 10
away_timeout: 120
### Master BR Occupancy by Lynn and Ashley ###
- template:
- binary_sensor:
master_br_occupancy:
- friendly_name: Master Bedroom Occupancy
state: >
{{ "ESPresense_br_primary" in [
states('sensor.espresence_lynn_iphone'),
states('sensor.espresence_ashley_iphone')] }}
delay_on: 5
delay_off: 30
I’m running HA inside of Proxmox:
Home Assistant 2023.5.2
Supervisor 2023.04.1
Operating System 10.1
Frontend 20230503.3 - latest
Thanks.