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:
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?
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.
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.
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/
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:
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.
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.