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

New template sensor attributes #26127

Merged
merged 14 commits into from
Sep 1, 2019
Merged

New template sensor attributes #26127

merged 14 commits into from
Sep 1, 2019

Conversation

gadgetchnnel
Copy link
Contributor

@gadgetchnnel gadgetchnnel commented Aug 22, 2019

Description:

Similar to PR #22664, which did this for the template binary sensor, this adds an option to add custom attributes to the sensor via a new attribute_templates config option.

Related issue (if applicable): fixes #

Pull request with documentation for home-assistant.io (if applicable): home-assistant/home-assistant.io#10204

Example entry for configuration.yaml (if applicable):

sensor:
  - platform: template
    sensors:
      test_sensor:
        value_template: >-
          {{ states.device_tracker.my_phone.state }}
        attribute_templates:
          latitude: >-
            {{ states.device_tracker.my_phone.attributes['latitude'] }}
          longitude: >-
            {{ states.device_tracker.my_phone.attributes['longitude'] }}

Checklist:

  • The code change is tested and works locally.
  • Local tests pass with tox. Your PR cannot be merged unless tests pass
  • There is no commented out code in this PR.
  • I have followed the development checklist

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.

homeassistant/components/template/sensor.py Outdated Show resolved Hide resolved
homeassistant/components/template/sensor.py Outdated Show resolved Hide resolved
homeassistant/components/template/sensor.py Outdated Show resolved Hide resolved
Copy link
Member

@MartinHjelmare MartinHjelmare left a comment

Choose a reason for hiding this comment

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

Looks good!

@MartinHjelmare MartinHjelmare merged commit 79488da into home-assistant:dev Sep 1, 2019
pgilad added a commit to pgilad/home-assistant that referenced this pull request Sep 1, 2019
…into improve-bluetooth-tracker

* 'dev' of https://github.com/home-assistant/home-assistant: (229 commits)
  New template sensor attributes (home-assistant#26127)
  Add BeeWi SmartClim BLE sensors (home-assistant#26174)
  UniFi - Simplify getting controller from config entry (home-assistant#26335)
  Inverted rflink cover (home-assistant#26038)
  Upgrade tibber library (home-assistant#26332)
  Migrate Axis, deCONZ and UniFi to use config entry subclass (home-assistant#26173)
  Upgrade sqlalchemy to 1.3.8 (home-assistant#26331)
  Change evohome to asyncio client (home-assistant#26042)
  Add support for Supla switches (home-assistant#26188)
  Add a keypress service for AlarmDecoder (home-assistant#26100)
  Fix google_maps scan interval (home-assistant#26328)
  Upgrade youtube_dl to 2019.09.01 (home-assistant#26330)
  Fix onvif camera setup error (home-assistant#24585)
  UniFi - use entity registry disabled_by to control available entities  (home-assistant#26141)
  Fetch Onkyo current radio preset (home-assistant#26211)
  Add precision argument to the Range Filter (home-assistant#25874)
  Fix alexa bad temp sensors (home-assistant#26307)
  deCONZ - Dont update entry if data is equal
  Add Withings support (home-assistant#25154)
  Add support for Homekit accessory battery sensors (home-assistant#26210)
  ...
@lock lock bot locked and limited conversation to collaborators Sep 2, 2019
@gadgetchnnel gadgetchnnel deleted the new-template-sensor-attributes branch February 21, 2020 18:36
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants