Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

sensor.season shows state in lowercase #28704

Closed
Mariusthvdb opened this issue Nov 11, 2019 · 8 comments
Closed

sensor.season shows state in lowercase #28704

Mariusthvdb opened this issue Nov 11, 2019 · 8 comments

Comments

@Mariusthvdb
Copy link
Contributor

Mariusthvdb commented Nov 11, 2019

Home Assistant release with the issue:

101.3

Last working Home Assistant release (if known):
never...

Operating environment (Hass.io/Docker/Windows/etc.):

Hassio, Rpi4
Integration:

Description of problem:

sensor.season and sensor.moon show lowercase state sometimes.

While all the translations files are capitalized. Some time ago before Lovelace I used _stateDisplay customization to have the state use a capital, but since that isn’t supported any longer, Im stuck with this:

Schermafbeelding 2019-11-11 om 17 13 21

Problem-relevant configuration.yaml entries and (fill out even if it seems unimportant):

sensor:
  - platform: season
    type: astronomical

Traceback (if applicable):


Additional information:

have also set some customization, but even without that, the sensor shows 'autumn' instead of 'Autumn' and 'waxing_gibbous' instead of 'Waxing gibbous'.

Schermafbeelding 2019-11-12 om 09 57 24

homeassistent:
  customize:
    sensor.season:
      templates:
        friendly_name: 'Season'
        icon: >
          if (state === 'spring') return 'mdi:flower';
          if (state === 'summer') return 'mdi:sunglasses';
          if (state === 'autumn') return 'mdi:leaf';
          if (state === 'winter') return 'mdi:snowflake';
          return 'mdi:cloud';
        icon_color: >
          if (state === 'spring') return 'green';
          if (state === 'summer') return 'yellow';
          if (state === 'autumn') return 'orange';
          if (state === 'winter') return 'blue';
          return 'grey';
#        _stateDisplay: >
#          function capitalizeFirstLetter(string) {return string.charAt(0).toUpperCase() + string.slice(1).toLowerCase();}
#          string = state;
#          return capitalizeFirstLetter(string);

translation file:

{
    "state": {
        "autumn": "Autumn",
        "spring": "Spring",
        "summer": "Summer",
        "winter": "Winter"
    }
}
@Mariusthvdb
Copy link
Contributor Author

update

just to add that behavior seems to be different on various devices. Got a new iPhone on which the states are always correct (for now), while desktop browsers show the changing states mentioned in the first post.

Also notable: the sensors seem to be trading places: when moon is displaying lowercase state, season is correct, and vice versa..

Schermafbeelding 2019-11-13 om 07 27 21

btw this is a fine example for the need to upgrade the moon sensor to show these icons depending on state:

Schermafbeelding 2019-11-13 om 07 28 42

will check that independently from this bug report ;-)

@cyberjunky
Copy link
Contributor

cyberjunky commented Nov 13, 2019 via email

@Mariusthvdb
Copy link
Contributor Author

Mariusthvdb commented Nov 13, 2019

since you mentioned it here, you can also customize the moon sensor with this icon template:

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

@cyberjunky
Copy link
Contributor

cyberjunky commented Nov 13, 2019 via email

@springstan
Copy link
Member

Very similar to home-assistant/frontend#2372

@stale
Copy link

stale bot commented Apr 14, 2020

There hasn't been any activity on this issue recently. Due to the high number of incoming GitHub notifications, we have to clean some of the old issues, as many of them have already been resolved with the latest updates.
Please make sure to update to the latest Home Assistant version and check if that solves the issue. Let us know if that works for you by adding a comment 👍
This issue now has been marked as stale and will be closed if no further activity occurs. Thank you for your contributions.

@stale stale bot added the stale label Apr 14, 2020
@Mariusthvdb
Copy link
Contributor Author

please keep open, still here on 108.3:

Schermafbeelding 2020-04-14 om 14 07 02

@stale stale bot removed the stale label Apr 14, 2020
@stale
Copy link

stale bot commented Jul 13, 2020

There hasn't been any activity on this issue recently. Due to the high number of incoming GitHub notifications, we have to clean some of the old issues, as many of them have already been resolved with the latest updates.
Please make sure to update to the latest Home Assistant version and check if that solves the issue. Let us know if that works for you by adding a comment 👍
This issue now has been marked as stale and will be closed if no further activity occurs. Thank you for your contributions.

@stale stale bot added the stale label Jul 13, 2020
@stale stale bot closed this as completed Jul 20, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants