I struggled with stripping out the leading 0, as well as the am/pm setting. I was finally able to get it working correctly using the following code in my sensors YAML file:
Thanks Jeremy… using your sensor code. One little mod people may like… use customize to set the sensor badge unit of measurement to AM or PM and it displays nicely under the time
customize:
sensor.sunrise_time:
unit_of_measurement: AM
sensor.sunset_time:
unit_of_measurement: PM
I get this error:
Error loading /config/configuration.yaml: while parsing a block mapping
in “/config/configuration.yaml”, line 5, column 1
expected , but found ‘-’
in “/config/configuration.yaml”, line 34, column 1
These are template sensors, and the line before these config entries must be:
sensor:
If you the get an error message saying something like “duplicate sensor” then you already have such a line somewhere in your config file, and need to move your above config entries underneath that existing list of sensors.