I’m trying to pull some level and messages from the freenas api.
What I would like is the system level and messages in the json format. If I open http://192.168.1.9/api/v1.0/system/alert/?format=json in my browser it returns:
I have tried to use a value templete of ‘{{ value_json[0].level }}’ to pull out the level which is showing “critical” now but all I get is unknown.
Here is my sensor code. Not sure what I’m missing.
- platform: rest
name: FN_alert_level
json_attributes:
- level
resource: http://192.168.1.9/api/v1.0/system/alert/?format=json
value_template: '{{ value_json[0].level }}'
username: myusername
password: mypassword
authentication: basic
headers:
Content-Type: application/json