Breaking Up Config File for Timer

Hi All,
I use timers frequently in the automation routines that are written. Due to the number (~10) of them that I have and the opportunity for the volume to continue to grow, I wanted to remove the different timers that have been written and put them into their own directory with each timer represented by an individual .yaml file.

I have attempted to follow the same process that I used to do this for automation routines and when I did this for sensors, but I am encountering a setup error after reboot of the container.

2019-02-09 22:56:34 ERROR (MainThread) [homeassistant.setup] Setup failed for timer: Component failed to initialize

My configuration.yaml file looks like the following:

The directory that includes all the different timer yaml files is represented below:

image

What am I missing to make this work?

Thanks in advance for your help.

Well, looking for the usual suspects of typos or case… and not seeing any… can we look at real duh’s like the permissions on the timer directory?

The permissions look to be the same when comparing the timer directory with the automation directory (one that I doesn’t have any issues).

Both have read, write, execute permissions.

I am at a loss.

Appreciate the effort.

Anyone else have any ideas?

I’m not a Linux expert but the permissions appear to be good and there doesn’t appear to be an issue in the way the config file is setup (syntax, spacing, etc). When I broke out the automation routines from the config file, I never experienced this issue

Timers don’t get written as a list like automations and sensors do (with a - in front of each entry). They get written by names. Don’t ask why there is a difference because I really have no idea why.

But with that in mind try this:

timer: !include_dir_merge_named timers/

Ordered dictionary vrs list of items. Basically a choice by the dev of the timer component. It does remove the chance of having a timer contain the same entity_id. maybe that was it.

That was the part i didn’t know - if there was some real reason or if it was just a personal preference of the dev.

I’m guessing he followed the workflow for most template sensors/input_booleans/input_numbers which all use ordered dictionaries. I mean it makes sense because the names matter. In a list, names don’t matter because the index controls the position of the item in the list, and you can have multiplie items with the same name. In an ordered dictionary, the name of the item controls the position of the item and you will have only 1 unique name.

Thanks for the idea @finity, but that didn’t work.

Received the following in the log:
2019-02-17 18:01:13 ERROR (MainThread) [homeassistant.setup] Setup failed for timer: Component failed to initialize.

I tried the following to see if the difference of timers or timer made an impact - it didn’t.
timer: !include_dir_merge_named timers/
timer: !include_dir_merge_named timer/

Any other ideas? :slight_smile:

post the contents of your timer yaml files. it seems like it could be something in there.

The contents of the individual timers referenced in the directory above include the following:

image

image

Appreciate the help all!

OK…

I just changed my config to test this and it works fine.

What I have now:

in configuration.yaml:

timer: !include_dir_merge_named timers/

in my config directory I have a subdirectory called “timers” (at config/timers) that has another file called timers_test.yaml that has the following entries:

15_min_garage_lights:
  duration: '00:15:00'
  
north_garage_door:
  duration: '00:30:00'
  
water_sensor:
  duration: '00:15:00'

the config checker says valid and on restart all of the timers show up in the dev-states page just like they should.

You should have only one entry for “timer:” in your configuration.yaml file. I saw above that you had two entries. If that is still the case then remove one of them and make sure the timer directory is named appropriately. It doesn’t matter what you call it (you could name it ralph if you wanted to) but you just need to make sure you reference it correctly in the timer declaration.

timer: !include_dir_merge_named ralph/

1 Like

Appreciate all the time effort spent on this @finity!

With your guidance, I was able to get it to work. It appears that I can only have one .yaml file that identifies all the different timers instead of one file with all the timers.

Thanks again!