Skip to content

Add Template Sensor device_class support #5220

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

Merged

Conversation

OttoWinter
Copy link
Member

@OttoWinter OttoWinter commented Apr 21, 2018

Description:

Add a device_class attribute to the sensor.template platform. Requires #5219 for sensor device_class docs.

Pull request in home-assistant (if applicable): home-assistant/core#14034

Checklist:

  • Branch: Fixes, changes and adjustments should be created against current. New documentation for platforms/components and features should go to next.
  • The documentation follow the standards.

@OttoWinter OttoWinter added the new-feature This PR adds documentation for a new Home Assistant feature to an existing integration label Apr 21, 2018
@@ -47,17 +47,6 @@ sensor:
friendly_name: Pixel of Paulus
unit_of_measurement: "%"
value_template: '{{ states.device_tracker.paulus_pixel.attributes.battery|int }}'
icon_template: >-
Copy link
Member Author

Choose a reason for hiding this comment

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

I removed this nice template here because the device_class does the dynamic battery level icon. Still, this template is quite a nice way to learn more about the template engine, at least I myself learned a lot about how jinja2 worked using this template.

mdi:battery-alert
{% endif %}
entity_id:
- device_tracker.paulus_pixel
Copy link
Member Author

Choose a reason for hiding this comment

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

Manual entity_id selection should no longer be necessary in most cases (including this one). So to keep the docs a bit simple, I removed it here.

@balloob balloob merged commit dcda30e into home-assistant:next May 1, 2018
Danielhiversen added a commit that referenced this pull request May 3, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
new-feature This PR adds documentation for a new Home Assistant feature to an existing integration
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants