Skip to content

Template Sensor add device_class support#14034

Merged
balloob merged 3 commits intohome-assistant:devfrom
OttoWinter:template-sensor-device-class
May 1, 2018
Merged

Template Sensor add device_class support#14034
balloob merged 3 commits intohome-assistant:devfrom
OttoWinter:template-sensor-device-class

Conversation

@OttoWinter
Copy link
Copy Markdown
Member

@OttoWinter OttoWinter commented Apr 21, 2018

Description:

Sensor now can have device classes too (see #14010) and AFAIK they're now the recommended to use instead of the old icon: configuration option.

Related issue (if applicable): fixes #

Pull request in home-assistant.github.io with documentation (if applicable): home-assistant/home-assistant.io#5220

Example entry for configuration.yaml (if applicable):

sensor:
  - platform: template
    battery:
      value_template: "{{ states.device_tracker.iphone.attributes.battery }}"
      device_class: battery

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 does not interact with devices:

  • Tests have been added to verify that the new code works.


from homeassistant.core import callback
from homeassistant.components.sensor import ENTITY_ID_FORMAT, PLATFORM_SCHEMA
from homeassistant.components.sensor import ENTITY_ID_FORMAT, PLATFORM_SCHEMA, \
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

line too long (80 > 79 characters)

Copy link
Copy Markdown
Member

@pvizeli pvizeli left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Need tests

@OttoWinter
Copy link
Copy Markdown
Member Author

Tests have been added :)

@balloob balloob dismissed pvizeli’s stale review May 1, 2018 18:32

Concerns addressed

@balloob balloob merged commit 9bc8f66 into home-assistant:dev May 1, 2018
@balloob balloob mentioned this pull request May 11, 2018
@home-assistant home-assistant locked and limited conversation to collaborators Sep 5, 2018
@OttoWinter OttoWinter deleted the template-sensor-device-class branch September 29, 2018 10:32
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants