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

Add season icons #18221

Merged
merged 4 commits into from Nov 6, 2018

Conversation

Projects
None yet
6 participants
@tjorim
Contributor

tjorim commented Nov 5, 2018

Description:

This PR adds icons to display the current season.
Currently the season icon has the default eye icon.

Related issue (if applicable): fixes # NA

Pull request in home-assistant.io with documentation (if applicable): home-assistant/home-assistant.io#<home-assistant.io PR number goes here> NA

Checklist:

  • The code change is tested and works locally.
  • Local tests pass with tox. Your PR cannot be merged unless tests pass

If user exposed functionality or configuration variables are added/changed:

If the code communicates with devices, web services, or third-party tools:

  • New dependencies have been added to the REQUIREMENTS variable (example).
  • New dependencies are only imported inside functions that use them (example).
  • New or updated dependencies have been added to requirements_all.txt by running script/gen_requirements_all.py.
  • New files were added to .coveragerc.

If the code does not interact with devices:

  • Tests have been added to verify that the new code works.
Show resolved Hide resolved homeassistant/components/sensor/season.py Outdated
STATE_SPRING: 'mdi:flower',
STATE_SUMMER: 'mdi:sunglasses',
STATE_AUTUMN: 'mdi:leaf',
STATE_WINTER: 'mdi:snowflake'

This comment has been minimized.

@houndci-bot

houndci-bot Nov 5, 2018

undefined name 'STATE_WINTER'

SEASON_ICONS = {
STATE_SPRING: 'mdi:flower',
STATE_SUMMER: 'mdi:sunglasses',
STATE_AUTUMN: 'mdi:leaf',

This comment has been minimized.

@houndci-bot

houndci-bot Nov 5, 2018

undefined name 'STATE_AUTUMN'

@@ -18,6 +18,14 @@
_LOGGER = logging.getLogger(__name__)
SEASON_ICONS = {
STATE_SPRING: 'mdi:flower',
STATE_SUMMER: 'mdi:sunglasses',

This comment has been minimized.

@houndci-bot

houndci-bot Nov 5, 2018

undefined name 'STATE_SUMMER'

@@ -18,6 +18,14 @@
_LOGGER = logging.getLogger(__name__)
SEASON_ICONS = {
STATE_SPRING: 'mdi:flower',

This comment has been minimized.

@houndci-bot

houndci-bot Nov 5, 2018

undefined name 'STATE_SPRING'

@Mariusthvdb

This comment has been minimized.

Mariusthvdb commented Nov 5, 2018

this must be coincidence... as of today this was installed locally:

homeassistant:
  customize:
    sensor.season:
      templates:
        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 'mdi:grey';
        _stateDisplay: >
          return state|title;

please see: Templarian/MaterialDesign#3671 for discussion on MDI about these. Hopefully a new Fall icon will be available. So please consider not setting icons fixed in HA code for this, users can set their own to their liking?

@tjorim

This comment has been minimized.

Contributor

tjorim commented Nov 5, 2018

Is that really the best way? Adding more config options?
I think it would just clutter the docs, since this can be extended to other components as well.

In my opinion this should be done by customizing entities.
Maybe it can be considered as an option for entities in general? So we can let users set certain attributes for specific states (if a component supports it).

PS: is it possible icon_color is not an option in core HA?

@pvizeli

pvizeli approved these changes Nov 6, 2018

@pvizeli pvizeli merged commit 121ec5c into home-assistant:dev Nov 6, 2018

3 of 4 checks passed

continuous-integration/travis-ci/pr The Travis CI build is in progress
Details
Hound No violations found. Woof!
WIP ready for review
Details
cla-bot Everyone involved has signed the CLA

@wafflebot wafflebot bot removed the in progress label Nov 6, 2018

@tjorim tjorim deleted the tjorim:season-icons branch Nov 6, 2018

zxdavb added a commit to zxdavb/home-assistant that referenced this pull request Nov 13, 2018

Add season icons (home-assistant#18221)
* Add season icons

* Use STATE constants

* Calm down hound

* Update season.py

@balloob balloob referenced this pull request Nov 29, 2018

Merged

0.83 #18776

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment