It’s a frequently asked question and I’ve been reading thread after thread but cant figure out how to pull this json value.
{
“attributes”: {
“friendly_name”: “Office Office Temperature”,
“icon”: “mdi:thermometer”,
“unit_of_measurement”: “\u00b0F”
},
“context”: {
“id”: “fc2fed0200fb41628de81efa4e522d4d”,
“user_id”: null
},
“entity_id”: “sensor.office_office_temperature”,
“last_changed”: “2018-09-22T01:40:23.374059+00:00”,
“last_updated”: “2018-09-22T01:40:23.374059+00:00”,
“state”: “73.38”
}
sensor:
I keep getting a response as unknown.
Any help is truly appreciated.
That sure looks like it should work. FWIW, typically the value_template would be written this way:
value_template: "{{ value_json.state }}"
But what you have I would think should work.
Can you expand on that? E.g., do you mean the state of sensor.office_ha_temp is ‘unknown’? Or are you getting an error that the response is not the JSON you expect, but instead something like this: {"message": "Entity not found."}
?
I am getting the unknown value under 'States"
https://imgur.com/a/qhpqGGn
Well you’re pretty much doing exactly what this example shows. For grins, did you try changing the value_template to what I showed? (Although, like I said, I really don’t expect that to make any difference.)
I realized my error. Simple typo:
/api/states/sensor.office_office_temperature?api_password=mypass
D’oh! Sorry, I should have noticed that. When I tried it myself I typed it in based on the docs, and no matter how many times I compared that to what you showed I looked right past the missing ‘s’, too. Glad you have it working!