I had moon-phases working with YAML Configuration prior to the latest upgrade.
Has YAML Configuration been removed for moon-phases?
The configuration of the Moon integration changed from YAML to UI in the April 2022 release of Home Assistant.
OK ⊠YAML was more flexible than UI ⊠no value added with the change
For the Moon integration, what was more flexible about YAML configuration?
no value added with the change
One advantage is that you donât have to restart Home Assistant to install the Moon integration (or restart to remove the Moon integration).
I had in YAML following âŠ
moon_phases:
friendly_name: ' '
value_template: >-
{% set phases = {'first_quarter': 'Tilltagande halvmÄne', 'full_moon': 'FullmÄne',
'last_quarter': 'Avtagande halvmÄne', 'new_moon': 'NymÄne',
'waning_crescent': 'Avtagande mÄnskÀra', 'waning_gibbous': 'Avtagande gibbousmÄne',
'waxing_crescent': 'Tilltagande mÄnskÀra', 'waxing_gibbous': 'Tilltagande gibbousmÄne'} %}
{% set phase = states('sensor.moon') %}
{{ phases[phase] if phase in phases.keys() else 'Error' }}
How can I get them to UI?
Maybe Custom-UI can help out?
What you posted isnât the Moon integration. Itâs a Template Sensor that references sensor.moon
.
Youâre confusing YAML configuration of the Moon integration with YAML configuration of a Template Sensor. Currently thereâs no support for Template Sensor configuration via the UI, only via YAML.
I read the documentation for Templates ⊠still confused but at a higer level.
I translated moon phases to swedish with replace (as below) and it worked OK
Now I want to use mdi: icon but donât see how.
-
platform: template
sensors:moon_phases:
friendly_name: ââ
value_template: >-
{{ states (âsensor.moon_phaseâ) | replace(âfirst_quarterâ, âTilltagande halvmĂ„neâ) | replace(âfull_moonâ, âFullmĂ„neâ) âŠ
icon_template: mdi:moon-???
Take âfull-moonâ as an example.
The mdi site tells me that the name is âmoon-fullâ but when I check with dev tool in HA it gives me for sensor.moon_phases following:
options:
- first_quarter
- full_moon
- last_quarter
- new_moon
- waning_crescent
- waning_gibbous
- waxing_crescent
- waxing_gibbous
Clearly there is a difference in names âfull_moonâ and âmoon-fullâ.
How should icon_template: mdi:moon-??? look like?
I suggest you create a Template Sensor in modern format (not legacy format).
Example:
template:
- sensor:
- name: MĂ„nfaser
state: >
{% set phase = states('sensor.moon_phase') %}
{{ { 'new_moon': 'NymÄne',
'waxing_crescent': 'Tilltagande mÄnskÀra',
'first_quarter': 'Tilltagande halvmÄne',
'waxing_gibbous': 'Tilltagande gibbousmÄne',
'full_moon': 'FullmÄne',
'waning_gibbous': 'Avtagande gibbousmÄne',
'last_quarter': 'Avtagande halvmÄne',
'waning_crescent': 'Avtagande mÄnskÀra' }.get(phase, phase) }}
icon: >
mdi:moon-{{ states('sensor.moon_phase').replace('_', '-').replace('-moon', '') }}
NOTE
In the future, it may not be necessary to create a Template Sensor to translate the Moon sensor (sensor.moon_phase
). What is missing is for someone to translate the English moon phases into Swedish and submit it to Home Assistantâs translation tables.
For more information refer to the following:
Thanks for your support ⊠it works like a Swiss clock
Youâre welcome!
Please consider marking my post above with the Solution tag. It will automatically place a check-mark next to the topicâs title which signals to other users that this topic has been resolved. This helps users find answers to similar questions.
For more information about the Solution tag, refer to guideline 21 in the FAQ.