Help with binary sensor and yaml

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'

Hey there, please be sure to start with an easy to follow description of your question, otherwise you might not get an answer.

I suspect this is what you have in your configuration.yaml:

binary_sensor:
  - platform: workday
    country: UK
    workdays: [mon, tue, wed, thu, fri]

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.

I’ve added these to my binary_sensor. yaml folder in config file.

This doesn’t make sense to me. You need to put this directly into configuration.yaml. Everything goes there.

Later when you got more accustomed I recommend a packages folder, but take one step at a time.

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).

Thank you - all working now