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

Added documentation for the json_attributes configuration. #4046

Merged
merged 4 commits into from
Dec 3, 2017

Conversation

nickovs
Copy link
Contributor

@nickovs nickovs commented Nov 22, 2017

Description:

Documentation for a new json_attributes configuration option in the RESTful sensor component.

Pull request in home-assistant (if applicable): Unpacking RESTful sensor JSON results into attributes.

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.

@frenck frenck added Enhancement new-feature This PR adds documentation for a new Home Assistant feature to an existing integration labels Dec 1, 2017
- platform: rest
name: OWM_report
json_attributes: main,weather
value_template: '{{value_json["weather"][0]["description"].title()}}'
Copy link
Member

Choose a reason for hiding this comment

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

Like all other templates will this be rendered empty, see https://home-assistant.io/developers/documentation/standards/#templates.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Oops. Sorry about that. I shall fix it.

owm_weather:
value_template: '{{states.sensor.owm_report.attributes.weather[0]["description"].title()}}'
icon_template: '{{"http://openweathermap.org/img/w/"+states.sensor.owm_report.attributes.weather[0]["icon"]+".png"}}'
entity_id: sensor.owm_report
Copy link
Member

Choose a reason for hiding this comment

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

Please remove or update (the last two sensors) the entity_id: entries. It's advance feature and not needed to get the sensors running. Minimal samples are easier to understand for new users.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

OK. The inclusion of the entity_id was deliberate since without this the template gets re-evaluated periodically, which is rather inefficient. Since most of the pushback that I had in proposing this feature in the first place was to do with efficiency issues I thought I would make the example as efficient as possible!

nickovs and others added 2 commits December 2, 2017 11:30
…{% raw %}.

Also corrected typos in entity_id entries for examples.
@fabaff fabaff merged commit 1f65b9b into home-assistant:current Dec 3, 2017
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.

3 participants