{"action":"created","issue":{"url":"https://api.github.com/repos/balloob/home-assistant/issues/745","labels_url":"https://api.github.com/repos/balloob/home-assistant/issues/745/labels{/name}","comments_url":"https://api.github.com/repos/balloob/home-assistant/issues/745/comments","events_url":"https://api.github.com/repos/balloob/home-assistant/issues/745/events","html_url":"https://github.com/balloob/home-assistant/pull/745","id":122146059,"number":745,"title":"Template support for numeric state","user":{"login":"philipbl","id":1527647,"avatar_url":"https://avatars.githubusercontent.com/u/1527647?v=3","gravatar_id":"","url":"https://api.github.com/users/philipbl","html_url":"https://github.com/philipbl","followers_url":"https://api.github.com/users/philipbl/followers","following_url":"https://api.github.com/users/philipbl/following{/other_user}","gists_url":"https://api.github.com/users/philipbl/gists{/gist_id}","starred_url":"https://api.github.com/users/philipbl/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/philipbl/subscriptions","organizations_url":"https://api.github.com/users/philipbl/orgs","repos_url":"https://api.github.com/users/philipbl/repos","events_url":"https://api.github.com/users/philipbl/events{/privacy}","received_events_url":"https://api.github.com/users/philipbl/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":3,"created_at":"2015-12-14T22:26:34Z","updated_at":"2015-12-15T16:04:56Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/balloob/home-assistant/pulls/745","html_url":"https://github.com/balloob/home-assistant/pull/745","diff_url":"https://github.com/balloob/home-assistant/pull/745.diff","patch_url":"https://github.com/balloob/home-assistant/pull/745.patch"},"body":"Add template support for numeric state trigger and condition (#730).\r\n\r\nI wasn't sure the best way of exposing the state data in the template. I ended up having a `value` key, similar to `render_with_possible_json_value`. The value of this key is the actual state object. It works, but it makes for long templates. For example, to get an attribute of the state, the template would be this:\r\n\r\n```\r\n{{ value.attributes.name_of_attribute }}\r\n```\r\n\r\nOr if you just want to get the state of the state object, it would be:\r\n\r\n```\r\n{{ value.state }}\r\n```\r\n\r\nAn alternative that I considered was to use the `state.as_dict()` method and expose all of its properties to the template directly, rather than having to go through the `value` key first. I chose to go with `value` because it is more consistent with other templates, but I am open to suggestions."},"comment":{"url":"https://api.github.com/repos/balloob/home-assistant/issues/comments/164809055","html_url":"https://github.com/balloob/home-assistant/pull/745#issuecomment-164809055","issue_url":"https://api.github.com/repos/balloob/home-assistant/issues/745","id":164809055,"user":{"login":"philipbl","id":1527647,"avatar_url":"https://avatars.githubusercontent.com/u/1527647?v=3","gravatar_id":"","url":"https://api.github.com/users/philipbl","html_url":"https://github.com/philipbl","followers_url":"https://api.github.com/users/philipbl/followers","following_url":"https://api.github.com/users/philipbl/following{/other_user}","gists_url":"https://api.github.com/users/philipbl/gists{/gist_id}","starred_url":"https://api.github.com/users/philipbl/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/philipbl/subscriptions","organizations_url":"https://api.github.com/users/philipbl/orgs","repos_url":"https://api.github.com/users/philipbl/repos","events_url":"https://api.github.com/users/philipbl/events{/privacy}","received_events_url":"https://api.github.com/users/philipbl/received_events","type":"User","site_admin":false},"created_at":"2015-12-15T16:04:56Z","updated_at":"2015-12-15T16:04:56Z","body":"We will just need to make it clear in the documentation. For sensors (at least command line and rest), we use `value` to get the value of the sensor, but for numeric state (and maybe others), we use `state`.\r\n\r\nDo you want me to expose the whole state object like I am currently doing? For example, if you want the state of the state, you would do\r\n\r\n```\r\n{{ state.state }}\r\n```\r\n\r\nOr if you wanted to get an extra attribute of the state, you would do\r\n\r\n```\r\n{{ state.attributes.name_of_attribute }}\r\n```"}}