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

Conversation

@gadgetchnnel
Copy link
Contributor

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.
@project-bot project-bot bot added this to Needs review in Dev Aug 22, 2019
@gadgetchnnel gadgetchnnel referenced this pull request Aug 22, 2019
2 of 2 tasks complete
Dev automation moved this from Needs review to Review in progress Aug 31, 2019
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
gadgetchnnel added 2 commits Sep 1, 2019
Dev automation moved this from Review in progress to Reviewer approved Sep 1, 2019
Copy link
Member

left a comment

Looks good!

@MartinHjelmare MartinHjelmare merged commit 79488da into home-assistant:dev Sep 1, 2019
11 checks passed
11 checks passed
CI Build #20190901.34 succeeded
Details
CI (FullCheck Mypy) FullCheck Mypy succeeded
Details
CI (FullCheck Pylint) FullCheck Pylint succeeded
Details
CI (Overview CheckFormat) Overview CheckFormat succeeded
Details
CI (Overview Lint) Overview Lint succeeded
Details
CI (Overview Validate) Overview Validate succeeded
Details
CI (Tests PyTest Python36) Tests PyTest Python36 succeeded
Details
CI (Tests PyTest Python37) Tests PyTest Python37 succeeded
Details
cla-bot Everyone involved has signed the CLA
codecov/patch 100% of diff hit (target 94%)
Details
codecov/project 93.9% (target 90%)
Details
Dev automation moved this from Reviewer approved to Done 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
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
Dev
  
Done
3 participants
You can’t perform that action at this time.