This happens because you are trying to reference an array of JSON objects.
After converting the current XML to JSON we get:
{
"rss": {
"channel": {
"title": "CAISO Flex Alert Notice Log",
"link": "http://www.caiso.com/awe/ noticelogflex.html",
"description": "Flex Alert Notice Log",
"language": "en-us",
"item": {
"title": "No Flex notices issued in last 90 days",
"link": "http://www.caiso.com/informed/Pages/Notifications/Flex-Alerts.aspx",
"description": ""
}
},
"_version": "0.91"
}
}
Notice how item
is a single JSON object. When there haven’t been any caiso flex alerts for a while, the xml will be formatted in this error producing style. Once flex alerts start rolling in, something like the following is produced:
{
"rss": {
"channel": {
"title": "CAISO Flex Alert Notice Log",
"link": "http://www.caiso.com/awe/ noticelogflex.html",
"description": "Flex Alert Notice Log",
"language": "en-us",
"item": [{
"title": "First alert",
"link": "http://www.caiso.com/informed/Pages/Notifications/Flex-Alerts.aspx",
"description": "first random description"
},
{
"title": "Second alert",
"link": "http://www.caiso.com/informed/Pages/Notifications/Flex-Alerts.aspx",
"description": "second specific description"
}
]
},
"_version": "0.91"
}
}
Notice how item
now contains an array of JSON objects? This is what json_attributes_path
is trying to reference.
I’ve got the same sensor in my setup (gotta love rolling blackouts). Unfortunately, I haven’t figured out a way to avoid the error. It does seem to only occur when the XML source initially switches into the glitchy format. When the flex alerts populate, so will the sensor attributes. It’s not ideal, but you’ll (probably) have to wait until the alerts start happening to finetune your sensor.