Why is sensor.season showing lower case state?

Tbh, the reference was meant to be more of a scientific approach than religious, along the lines of Popper…

In this case it is a glance card, albeit in a vertical-stack-in-card:

  - type: custom:vertical-stack-in-card
    title: Zon - Maan
    cards:
      - type: glance
        style: |
          ha-card {
            box-shadow: none;
          }
        show_header_toggle: false
        entities:
          - sun.sun
          - sensor.moon
          - sensor.season

      - type: entities
        title: Sun and Day settings
        show_header_toggle: false
        entities:
          - type: custom:fold-entity-row
            head:
              type: section
              label: Sun & light
            entities:
              - binary_sensor.sun_up
              - sensor.solar_angle
              - sensor.sun_state
              - sensor.nextsunrise
              - sensor.nextsunset
              - sensor.sunset_offset
              - sensor.length_of_day_factor
              - sensor.circadian_light

          - type: custom:fold-entity-row
            head:
              type: section
              label: Day & night
            entities:
              - sensor.dag_nacht
              - sensor.day_phase
              - sensor.part_of_day
              - sensor.period_of_day
              - sensor.day_night

but before Lovelace, the issue was there too.

What makes it unpredictable for me now, is the changing behavior in the same hardware setup on the one hand, and different behavior between different devices on the other hand.

Familiar with it and Russell’s teapot and several others.

Hope you find out why you have a black teapot whereas others don’t even have a teapot let alone a black one.

Isn’t there a ‘Proper’ filter in jinja ?

AND there is NO teapot !

just for reference, this is where the capitalization was made in the customization, and also noted the different behavior: Strange different template behavior between Hassio instances

note it was HA 81.5 at the time.

Both work for me in a simple entity card.
image
Nothing else to add, I just wanted to be able to say that something works :stuck_out_tongue_winking_eye:

Except I’d be lying because as I have mentioned before on here the moon sensor does not seem to be very accurate. According to timeanddate.com it is a full moon now (it is 22:05 here), not Waxing gibbous.

image

Luckily I don’t actually care that much. I’m neither a vampire nor a warewolf.
:upside_down_face:

yes, it seems off bit here too :wink: even we have a beaver moon now, of which I had never heard before, so thanks for that!
15

will probably show the full moon tomorrow

I have same issue. From time to time moon sensor and season sensor do not show translation. They are both on same card.

{% macro proper(text) %}
  {{ text[0]|upper}}{{text[1:] }}
{% endmacro %}

<p>{{ proper(mytext) }}</p>

I found this but I think that it needs a n
jinja wizard ninja to work some magic on it parsing each word through the macro

I have pretty much always used this:

      moonphases:
        entity_id: sensor.moon
        friendly_name: 'Moon'
        value_template: >
          {{ states('sensor.moon').title().replace('_',' ') }}
        entity_picture_template: >
          {% set state = states('sensor.moon').title().replace('_','').replace(' ','') %}
          {{ '/local/icons/MoonPhases/S{}.jpg'.format(state) }}
      seasonname:
        entity_id: sensor.season
        friendly_name: 'Season'
        value_template: >
          {{ states('sensor.season').title() }} 
        entity_picture_template: >-
          {% set state = states('sensor.season'.title()) %}
          {{ '/local/icons/season/{}.png'.format(state) }}

bro… {{ text.title() }}

{{ ‘small doggies like big bones’.title() }}

Produces : - Small Doggies Like Big Bones

See, Everyday is a learning day, many thanks

So @Mariusthvdb I appreciate petro’s offering (sorry just re-read @DavidFW1960 's suggestion and that’s in there first (sometimes I need a nudge with a sledgehammer !)) David’s offering is a ‘workaround’ but it should be short term until the issue gets looked at, and fixed ???
Now I’m going to figure out what he’s doing with custom images :smiley: Well I can guess but I want the mechanism (even bigger :smiley: )

Also available as a Jinja2 filter: title

Awww ! If you’d left that till tomorrow, I could have learnt something new then too !

I’ll just have to learn something else (even biggest :smiley: )

Thanks :rofl:

Ha! Well it’s a workaround I’ve been using forever… yeah custom images… you can check my github for those (the S is for southern hemisphere)

since I prefer to only capitalize the first word, I mostly use |capitalize

{{ 'small doggies like big bones'|capitalize }}

agree with the

bit, and yes, the other template sensors have been in this setup for the same period too :wink:

with some variations:

      season_name:
        friendly_name_template: >
          {{ states('sensor.season_name')}}
        value_template: >
          {{ states('sensor.season').capitalize() }}
        entity_picture_template: >
          {% set state = states('sensor.season') %}
          {{ '/local/weather/season/{}.png'.format(state) }}

      moon_phases:
        friendly_name_template: >
          {{states('sensor.moon_phases')}}
        value_template: >
          {{states('sensor.moon').capitalize().replace('_',' ')}}
        entity_picture_template: >
          {% set state = states('sensor.moon_phases') %}
          {{ '/local/weather/moonphases/{}.jpg'.format(state).replace(' ','_')|lower }}

note we can use both .capitalize() and |capitalize in Jinja

Hope my bug-report gets noticed, I’ll add the moon sensor to it.

too bad we cant use this for the moon.sensor as customization:

    sensor.moon:
      templates:
        icon: >
          return 'mdi:moon-' + state;

since these mdi: icons are available:
#moon-first-quarter
#moon-full
#moon-last-quarter
#moon-new
#moon-waning-crescent
#moon-waning-gibbous
#moon-waxing-crescent
#moon-waxing-gibbous

Ful/new moon state forces to write a full template:

        icon: >
          if (state === 'full_moon') return 'mdi:moon-full';
          if (state === 'new_moon') return 'mdi:moon-new';
          return 'mdi:moon-' + state.replace('_','-');

maybe Ill try to create a PR or at least a feature request doing this natively. managed this Add state dependent icons to moon sensor by Mariusthvdb · Pull Request #28743 · home-assistant/core · GitHub

lo and behold, a first! both sensors show correctly:

14

update

33

and back to full_moon again …

Yeah, but given your experience, that will probably change by tomorrow :crazy_face:

Edit: I’ve added my thumbs up to both ‘your’ and Fabaff’s requests