home assistant adding custom sensors

home assistant adding custom sensors

Author
Discussion

Trustmeimadoctor

Original Poster:

13,233 posts

161 months

Thursday 28th September 2023
quotequote all
so im trying to add just a simple time sensor copying it off the HA website

yet when i paste it in i just get errors when i try to reload the yaml

this is what im trying to add
sensor:
# Minimal configuration of the standard time and date sensor
- platform: time_date
display_options:
- 'date_time_iso'
# Build on the standard sensor to produce one that can be customized
template:
- sensor:
- name: "Date and time"
state: "{{ as_timestamp(states('sensor.date_time_iso')) | timestamp_custom('%A %B %-d, %I:%M %p') }}"
icon: "mdi:calendar-clock"



yet i get
96 | sensor:

^
97 | # Minimal configuration of th ...


when i edit the file so i adjust the indent then i get more bks when i try to reload the yaml

i do have other ones that work but i had a time playing around with indenting and things and if i had the sensors for doing the cpu temps etc then i the other one stops working

ARHarh

4,145 posts

113 months

Thursday 28th September 2023
quotequote all
What are you trying to achieve with a time sensor?

Time is built into HA and does not need configuration.

Trustmeimadoctor

Original Poster:

13,233 posts

161 months

Thursday 28th September 2023
quotequote all
I was playing more than anything as I'd had trouble with a more complex one for calculating degree days.

I did previously have one that got all the system stats CPU disk etc but now I have my degree day one it breaks the system Info one