Workday in a separate file

Hello to you, :slight_smile:
I have browsed the forum with the word “workday” but I did not find what I was looking for.

In the same principle as when we write our automations in an external file to configuration.yaml with the line “automation: !include automations.yaml”, I would like to put my “workday” configuration (which works well) in an external file but if I create the following line “automation: !include workday.yaml” in my configuration.yaml file and I move (cut/paste) my worday configuration from my configuration.yaml file to my workday.yaml file and I restart, I get an error in the notifications and my workday sensor does not work anymore. Does anyone know how to do this properly please?

Thanks for your help :slight_smile:

Are referring to this integration?

It produces a binary_sensor.

If you put the Workday Binary Sensor’s configuration in a file named workday.yaml and then did this:

automation: !include workday.yaml

then you told Home Assistant to load all of it’s automations from a file that doesn’t exclusively contain automations. I think you already know how Home Assistant reacted to that mistake.

You can do this:

binary_sensor: !include workday.yaml

but then all of your binary_sensor configurations must also be in that file.

Alternately, you can use a different !include directive that allows you to store binary_sensor configurations in multiple files. However, I am getting ahead of myself. How do you want to store your binary_sensor configurations?

1 Like

I do this:

binary_sensor: !include_dir_merge_list binary_sensors/

then in /config/binary_sensors/workday.yaml I have

- platform: workday
  country: GB
  province: Scotland

This document explains how the !include statements work.

Hi,

Yes i talk about this,
Thank you both :slight_smile: I will explore your 2 solutions for sure.

Again thanks !

Hi :slight_smile:

Yes i think i will use !include and put all my binary sensor in 1 file but my decision is not final yet.