maybe this helps:
Ive updated to 0.81.0b2 and as far as I can see the moon sensor still works fine:
and the regular sensor.moon
maybe this helps:
Ive updated to 0.81.0b2 and as far as I can see the moon sensor still works fine:
and the regular sensor.moon
Thanks. A little
As far as I can tell the safest thing is to always include the entity_id
!
Also, it seems like this could be a big breaking change for some people?
Yes I updated all my template sensors to include the entity_id used in the template. I have no idea why not just referencing the sensor in the template isnât enough. Itâs a 0.81.0 change. Guess thereâs some purpose regarding timer out of sync but I only started getting errors after 0.81 because of the entity id.
All my template sensors are working without using entity_id. I think there are some fringe cases in which the parser cannot resolve a sensor. Those are going to fail now.
yes, same here, most (all aamof) of them still work fine, fringe cases are explained by @pnbruckner above
Trying to get my moon sensor going on my new build and after trying several of these examples still canât get things running. Any help would be appreciated.
I am running Home Assistant 0.93.1 using the #hass-io image on Raspberry Pi 3 B+ on a 64GB card. I am connected via wireless on the same network as my devices I am trying to control. I am also subscribed and logged into Home Assistant Cloud.
Directory Structure:
/local/moonphases/
core-ssh:/config/www/moonphases# ls
NFirstQuarter.jpg NNewMoon.jpg NWaxingCrescent.jpg
NFullMoon.jpg NWaningCrescent.jpg NWaxingGibbous.jpg
NLastQuarter.jpg NWaningGibbous.jpg
Here is my config snippet:
# Sensors
sensor:
# Moon Phase
- platform: template
sensors:
moonphases:
friendly_name: 'Moon'
value_template: >
{{ states('sensor.moon').title().replace('_',' ') }}
entity_picture_template: >
{% set state = states('sensor.moon').title().replace('_','') %}
{{ '/local/moonphases/N{}.jpg'.format(state) }}
Thanks in advance for the help!
what do you see? Or have any errors? the template is fine.
you do have a folder /config/www/moonphases ? because /local = /config/www âŠ
also, be sure to need the replace function in the images template, I donât use that and my files look like:
I use
moon_phases:
friendly_name: 'Moon phases'
value_template: >
{{states('sensor.moon').title().replace('_',' ')}}
entity_picture_template: >
{% set state = states('sensor.moon') %}
{{ '/local/weather/moonphases/{}.jpg'.format(state) }}
because I didnât like the capitals in the file namesâŠ
but, since your template results in:
I do have a folder /config/www/moonphases
No errors in Config when I do config check.
The display shows sensor with label Moon that is a blank white circle circle
I thought perhaps my template was wrong because of how I had my files named so I renamed to be like yours:
and I updated my config matching yours (adjusting the directory to local/moonphases
# Moon Phase
- platform: template
sensors:
moon_phases:
friendly_name: 'Moon Phase'
value_template: >
{{states('sensor.moon').title().replace('_',' ')}}
entity_picture_template: >
{% set state = states('sensor.moon') %}
{{ '/local/moonphases/{}.jpg'.format(state) }}
I donât get why I canât get the status or images to display?
I donât see why it shouldnât be working. From what I see, you have the www folder, youâre using local. and your code will get you the correct information. Just to rule out the template, copy the entity_picture_template into the value template so we can see the output.
EDIT: Actually, it appears as if your sensor.moon is causing the problems. Youâre getting the word unknown as a state back, thatâs coming directly from it outputting ânoneâ. Fix sensor.moon and you fix your problem.
yes that what I tried also, and on my system, the template shows fine, see above screenshot.
maybe the files are in an incorrect format/density?
of courseâŠ
sensor:
- platform: moon
should be in your config
Bingo the entity picture template shows this as well when I adjusted to test
re-added sensor.moon (and Yes @petro and @Mariusthvdb it was there just spaced over incorrectly it looked like but not throwing an error)
We HAVE MOON!!!
However, now I am still getting Unknown. Wil this sort out over time?
regular sensor.moon is showing status fine. but the single color moon icons (default moon icons that used to show up) is not showing. Is this expected behavior?
Once I get this all sorted I assume I should hide the regular sensor and then trigger the template to show after the sun sets?
sensor.moon is still not showing the default icons it used to. Would be good to understand why. Before I started with the value_template, it would show default icons. I plan on hiding this and just using the vaule_template but its one of those things Iâd like to understand and fix.
The updated moon phase template is working and updating now. I forgot that its not a real-time update and takes time to pull in the data.
Special Thanks to @petro and @Mariusthvdb for digging in and helping me resolve this. I appreciate it.
you mean this?:
should automatically do so, unless youâve customized it someway. brightness-3 now.
While weâre on the subject of the moon sensor, has anyone else noticed that it appears to report a full moon a day late?
must admit Iâve never been troubled by that out of ignorance probably, and it gave me reason to check this:
which has some nice pictures too I will probably âborrowâ.
Does the sensor moon have an attribute of next full moon, down think so? So we can only check if it says so?
Yes you have to wait for the next full moon to check!
Which is why I have never brought it up before. I often forget to check and it is not that important to me anyway!
Those images are great. Seems like a more granular per day day status would be needed for sensor.moon so those images could be used?
Yes, exactly that moon icon. No customization yet on my end. This is still so new I have lots to learn. I ended up putting them on a card and when I did add sensor.moon to the card it is fine.
I am going to hide sensor.moon moving forward just making sure nothing is broken as I move this build along
I have spent a lot of time consulting the forum to understand how to represent the phases of the moon using JPG image icon.
First I added a www folder to config, as follows
Then I modified the configuration file. Initially I had a section dedicated to sensors
##################################################################
# Empieza la secciĂłn SENSORES
##################################################################
sensor:
########## Weather prediction ####################### linea 68
- platform: yr
########### Fases de la Luna #####################################
- platform: moon
### Se añade el sensor de Fecha y Hora
- platform: time_date
display_options:
- 'date'
- 'time'
############# Air Visual Index USA ##############################
- platform: airvisual
with which he obtained this result
I have added another section dedicated templates for the phases of the moon
#################################################################
# Comienza TEMPLATES
#################################################################
###### Fases de la Luna ##########################
# Iconos de Fases de la luna
- plataform: template
sensors:
moon_phases:
entity: sensor.moon
friendly_name: 'Luna'
value_template: >
{{ states('sensor.moon').title().replace('_',' ') }}
entity_picture_template: >
{% set state = states('sensor.moon').title().replace('_','') %}
{{ '/local/luna/{}.jpg'.format(state) }}
###################################################################
# Finaliza TEMPLATES
###################################################################
When checking the configuration, this error message appears:
Invalid config for [sensor]: required key not provided
@ data[âplatformâ]. Got None. (See /config/configuration.yaml, line 68)
Please check the docs at https://home-assistant.io/components/sensor/
Can someone help me find and correct the mistake? Unfortunately, I am not able to find it.
Thanks in advance
could it be this typo?
platAform: template
should be platform: template