Moon platform with moon phases pictures

really sorry, but you have lost me…

the template results in Luna Calante (waning crescent) which is what you feed it in the template itself, based on the state of the ‘mother’ sensor.fase_lunare

what is the issue now? Are you saying the sensor.fase_lunare has an incorrect state? Or do you see an issue in the template?

the main problem is that by replacing the state of the sensor with " sensor.phase_moon" as you indicated, I get this result

template:
  - sensor:
      - unique_id: moon_phases
        name: >
          {% set phase = states('sensor.fase_lunare') %}
          {% set mapper = {'new_moon':'Luna Nuova',
                           'waxing_crescent':'Luna Crescente',
                           'first_quarter':'Primo Quarto',
                           'waxing_gibbous':'Gibbosa Crescente',
                           'full_moon':'Luna Piena',
                           'waning_gibbous':'Gibbosa Calante',
                           'last_quarter':'Ultimo Quarto'} %}
          {{mapper.get(phase,'Luna Calante')}}
          ({{phase|replace('_',' ')|capitalize}})
        state: >
          {{states('sensor.fase_lunare').capitalize().replace('_',' ')}}
        picture: >
          {% set state = states('sensor.fase_lunare') %}
          /local/MoonPhases/{{state}}.png

If you add the “Moon” integration using the UI, the entity is named sensor.moon_phase by default.
That is what I used in my examples.
You should of course use the name as you set it up on your system.

yeah, that is the number 1 rule:

never blindly copy other peoples code, but always adapt to your personal setting/liking

besides that, for troubleshooting issues, it’s also always better to post the entity in dev tools/states and not a screenshot of some card in the frontend. Simply because we cant even see which entity your have in the card. Is it the original, or the template…

in this particular case: you are making life difficult with all those naming changes. your HA system sensor entity_id is sensor.fase_lunare, you are using a unique_id: moon_phases, and yet there is a Luna name in the card…

btw, testing this card, I now discover that the entity card doesnt show the entry_picture at all? I never use these entity cards…
clicking the entity to reveal more-info shows fine, but the entity card itself does:

using the same entity in an entities card shows fine…

so now we need the tile card (with the option to use the entity_picture) to do that?

I’m sorry, I’m giving up, I thank you for trying to help me but I can’t make myself understood anymore, thank you very much and Merry Christmas

I’ll try again to explain my situation, if someone is kind enough to tell me what I have to change in order to read the states of the moon in Italian:

this is the template in config.yaml :

template:
  - sensor:
      - unique_id: Fase lunare
        name: >
          {% set phase = states('sensor.moon') %}
          {% set mapper = {'new_moon':'Luna Nuova',
                           'waxing_crescent':'Luna Crescente',
                           'first_quarter':'Primo Quarto',
                           'waxing_gibbous':'Gibbosa Crescente',
                           'full_moon':'Luna Piena',
                           'waning_gibbous':'Gibbosa Calante',
                           'last_quarter':'Ultimo Quarto'} %}
          {{mapper.get(phase,'sensor.fase_lunare')}}
          ({{phase|replace('_',' ')|capitalize}})
        state: >
          {{states('sensor.moon').capitalize().replace('_',' ')}}
        picture: >
          {% set state = states('sensor.moon') %}
          /local/MoonPhases/{{state}}.png

and these are the states:

this is lovelace card:

  - type: 'tile'
    name: Luna
    entity: sensor.fase_lunare
    show_entity_picture: true

and finally this is the visual result on my dashboard:

I need to know what I have to change to have the moon phases in Italian

any advice?

Did you tryed like my setting view posts above.
If I set up like … example of @Mariusthvdb
I get mixed german and englisch

@alexamend does it work for you? I tried it but it doesn’t work

As I mentioned earlier, if you want to have the state in Italian, you should use the template with the mapper on the state. Currently you simply use the state of the base sensor, which is in English.

Also, in the Lovelace card, you set a name. With that, you overwrite the actual sensor name, which has the templates Italian trnslation ……

Lastly, I would advice you to use lowercase unique_id’s without spaces, ( and use the _ )

@Mariusthvdb practically could you tell me what to change in my configuration?

I fixed two of the three errors, now please explain to me practically how to fix the third one?Senza titolo2
Senza titolo3

this tamplate should work four you… “hope so ;-)”

If you don´t wont the (englich name) remove this line

        ({{phase|replace('_',' ')|capitalize}})

also you have to sete the folder to your settings

      picture: >
        {% set state = states('sensor.moon_phase') %}
        /local/moon_phases/{{state}}.png

template:

template:
  - sensor:
    - name: 'Luna'
      unique_id: la_mia_luna
      state: >
        {% set phase = states('sensor.moon_phase') %}
        {% set mapper = {'new_moon':'Luna Nuova',
                         'waxing_crescent':'Luna Crescente',
                         'first_quarter':'Primo Quarto',
                         'waxing_gibbous':'Gibbosa Crescente',
                         'full_moon':'Luna Piena',
                         'waning_gibbous':'Gibbosa Calante',
                         'last_quarter':'Ultimo Quarto'} %}
        {{mapper.get(phase,'Luna Calante')}}
        ({{phase|replace('_',' ')|capitalize}})
      picture: >
        {% set state = states('sensor.moon_phase') %}
        /local/moon_phases/{{state}}.png

@alexamend i just removed this line from my template,

 ({{phase|replace('_',' ')|capitalize}})

and it seems to work…it was that simple!! but now I have to remove the writing in English, how do I proceed?
Senza titolo4

getting there :wink:

please post yaml in a code block, and don’t post screenshots. we can not copy those to edit errors.

select some code, then use the icon </> in the toolbar .

on the state in English, well, this is a template sensor, you can template any of the options. State and name, it just returns what you configure it to do. What do you want in the second line?

the Tile card is just not that useful here, check what it does in my config:

and this is in an entities card:

or a glance…

or even a button

Scherm­afbeelding 2023-01-10 om 10.21.51

the button might be best suited for this, because you can easily not show the English state, with:

show_state: false

Scherm­afbeelding 2023-01-10 om 10.23.41

btw, just to be complete, the Entity card is even worse, and only shows the path when selecting Entity_picture…

if you look at some post up i posted all my code correctly

If you compare… your name, not state is template

        name: >
          {% set phase = states('sensor.moon') %}
          {% set mapper = {'new_moon':'Luna Nuova',
      state: >
        {% set phase = states('sensor.moon_phase') %}
        {% set mapper = {'new_moon':'Luna Nuova',

Try this:

template:
  - sensor:
      - unique_id: fase_lunare
        name: Fase Lunare
        state: >
          {% set phase = states('sensor.moon') %}
          {{ {'new_moon':'Luna Nuova',
              'waxing_crescent':'Luna Crescente',
              'first_quarter':'Primo Quarto',
              'waxing_gibbous':'Gibbosa Crescente',
              'full_moon':'Luna Piena',
              'waning_gibbous':'Gibbosa Calante',
              'last_quarter':'Ultimo Quarto'}.get(phase, phase) }}
        picture: "/local/MoonPhases/{{ states('sensor.moon') }}.png"
1 Like

@123 everything perfect, solved @123 the top

Hi all,

I tried to download the moonphase pictures, but I do nt have access to the link. Can someone tell me, how I can get the pictures?