In trying to troubleshoot why I can’t get the time_date integration working (which I still haven’t figured out) I stumbled across this post: Time sensor
That posts noted that there should only be one
sensor:
with all of the sensors listed under it. When I do so I get errors that I am missing a platform for each sensor. I am having trouble understanding what a platform is and what one I should use since I cannot find a list of them. Is it arbitrary in that I can put whatever I want as a platform for grouping purposes?
The integration page for time_date shows example of the correct format.
A “platform” equates to an “integration”, of which you will find many on the Integrations page of the HA site.
Note that since a lot of things have move to the GUI, you wouldn’t normally need to know that. The time_date integration is one that hasn’t, so you need to know this stuff.
Lastly - if you require assistance it’s best to post your yaml - making sure you use preformatted text tags (</> on the posting toolbar).
I copied and pasted above from the time and date integration page. I first tried adding it directly to my confirguation.yaml but no entities showed up. I then added it to my templates.yaml file where I keep all of my sensors. Which is connected to my confirguation.yaml via:
The sensor,yaml is blank as when I moved all of my sensors there I started getting errors for missing platforms. I have a lot of sensors here is one of them (currently in my templates.yaml)
I added another sensor at the bottom to show you how more than one sensor platform goes in that file. Note that there is no “sensor:” in that file. It is already in your configuration.yaml file and points to this file to include. This is what that whole other topic you linked to was about.
This (below) however is part of the template integration. Not the sensor integration. Leave it in your templates.yaml file:
it does need the “- sensor:” (with the dash) as there can be many types of templates, e.g. buttons, boolean sensors, triggered sensors, etc…
You need to restart home assistant after adding that config for them to be loaded.
All the ones with - platform: ... go in your sensor.yaml file.
All the ones listed here go in your templates.yaml file.
I know. It is confusing that the sensor integration has sensor platforms and the template integration has template sensors. Legacy template sensors do go in the sensor.yaml file but don’t use them for new sensors. That was the way it used to be done.
If the word is hard up against the margin of configuration.yaml, like
I still don’t understand how to figure out what platform is needed when I make a sensor but I do understand now that I should probably leave my sensors as is since they work.
Restarting the whole system worked, I assumed that I could just restart the script. Thank you!
Now that I have the time date integration working I assumed that using the following line would result in a date time but it results in a string according to the template editor.
I did that but then I got a weird situation where the automation was triggered but there was no trace (see pictures). I assumed that this had to do with the format of the sensor being an incorrect format but now that I think about it, it wouldn’t have triggered in the first place if that was the case. Is this a bug?