We Californians get Flex Alerts quite often during the summer. I’ve created some basic sensors to gather that information and present it in Home Assistant. Please note that the automation only presents the NEWEST alert or cancellation.
This code goes out and grabs the RSS feed provided by CAISO that has the latest flex alerts.
sensor:
- platform: rest
resource: http://content.caiso.com/awe/noticeflexRSS.xml
scan_interval: 300 #5 minutes
name: Flex_Alert_Newest
value_template: "OK" #'{{ value_json["rss"]["channel"]["item"][0] |truncate(210,True) }}' #255 character max?
json_attributes_path: "$.rss.channel.item.[0]"
json_attributes:
- title
- link
- description
This code provides the times that the latest flex alert applies to.
You might double check the YAML/Jinja lines for the rest sensor and make sure your editor did not modify it in some way. The YAML/Jinja code in this section does seem to confuse my syntax checker in Sublime Text but does not modify. Other editors might try to be ‘helpful’ .
The sensor values for my setup, as shown in the ‘Developer Tools’ section of Home Assistant are shown below:
Thank you for this info/clarification.
AFAICT everything is working OK on my system, I changed one line of your code, which explains the difference I was seeing. If I were to change it back, I would get exactly the same thing you showed above, this is very helpful.
Thank you again!
P.S. It would “sure be nice” if CAISO also published FlexAlerts in a more structured machine-to-machine format, e.g. JSON…
I ended up spending some time yesterday evening getting binary_sensors for the Flex/EEA1/EEA2/EEA3 alerts. In case someone else finds this useful, here is the AppDaemon app.
This is great, thank you for developing this and sharing!
I’ve never used AppDaemon, so I am slogging through that, and hope to have this running today or tomorrow
You’re welcome. I’ve added another AppDeamon app to adjust the thermostat temperature in response to alerts. This is still a work in progress though so there may be bugs. I’m hoping to test it tonight.
region - Statewide, Northern CA, Southern CA, and/or Valley Electric Association (VEA region)
AFAICT there may be one or two binary characters at the start of the returned file, which upsets/breaks some clients, curl and Firefox don’t like it, but Chrome seems to just handle it.
According to CAISO:
The value of the “ID” of a specific FlexAlert remains constant for the life of that FlexAlert
The file will refresh every minute
While Flex Alerts include the region – Statewide, No Cal, So Cal or VEA – the ISO doesn’t specifically define these regions nor do all of the customers in these regions fall in the ISO’s balancing area
VEA is located in Pahrump, NV, and is part of our balancing area although we’ve never called a Flex Alert specifically for VEA.
FYI, my long term wish/goal is to read/parse this JSON file, and publish them to MQTT, and then configure MQTT sensors in Home Assistant (because I prefer running things thru MQTT so more than just HA can see/use them…)