Having watched a YouTube video I’ve added these to my binary_sensor. yaml folder in config file.
Having created them I’d hoped I oculd use them as a condition in the Ui as a binary sensor so that certain automations couldnt trigger when I set a condition but I can’t see these as binary sensors on the UI so obviously not worked and I wondered if there were any ideas?
#Workday sensor
- platform: workday
country: UK
workday: [mon, tue, wed, thur, fri]
# time of day
- platform: tod
name: Day
after: Sunrise
before: Sunset
- platform: tod
name: Up and about
after: '05:00'
before: '07:00'
- platform: tod
name: Morning
after: '07:00'
before: '08:30'
- platform: tod
name: Daytime
after: '08:30'
before: '17:00'
- platform: tod
name: Evening
after: '17:00'
before: '21:00'
- platform: tod
name: Night
after: '21:00'
before: '05:00'
After reloading Home Assistant, you can use the sensor in the automation editor on the webpage or in a configuraton.yaml text style automation:
automation:
- alias: Testing rule
trigger:
- platform: state
entity_id: binary_sensor.workday_sensor
to: "on"
action:
service: notify.persistent_notification
data:
message: This should work
Thanks, sorry it wasn’t clear. Yes that’s what I have put in the binary_sensors folder of my config file however when I go into the automation editor it doesn’t show as one of my binary sensors ie binary_sensor.workday_sensor isn’t there and can’t be selected.
Is that exactly how they appear in your file or is the misalignment due to a copy-paste error?
If that’s exactly how they appear, they’re all misaligned and invalid. Check the documentation’s examples to see proper indentation (or the example in ThomDietrich’s post, except you don’t need binary_sensor: on the first line of the binary_sensor.yaml file).