-
-
Notifications
You must be signed in to change notification settings - Fork 7.5k
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
Conversation
- platform: rest | ||
name: OWM_report | ||
json_attributes: main,weather | ||
value_template: '{{value_json["weather"][0]["description"].title()}}' |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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 |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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!
…{% raw %}. Also corrected typos in entity_id entries for examples.
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:
current
. New documentation for platforms/components and features should go tonext
.