Can someone possibly help me build this code. I live on the Neshaminey creek my house floods and getting a prediction like text of updates from the website could make the difference between all my stuff being destroyed or still in tack. I’ll upload the code that Chat GPT game mw
platform: rest
name: Neshaminey Creek Flood Prediction
resource: URL_TO_FLOOD_PREDICTION_DATA
value_template: ‘{{ value_json.flood_prediction }}’
unit_of_measurement: ‘STATUS’
scan_interval: 3600 # Adjust based on how often you want to check for updates, this example checks every hour.
After I gave it the site it wrote this python code. I’m not great at coding I want it to notify me of the prediction not just the current levels. I would like it to send me a notification if it’s prediction is in my house. Which is 16 feet. That’s the level where it goes into my house. It’s only happened 4 times as you can see this website. But it could happen tomorrow the last flood it wasn’t even raining and this site said it could go to 21 feet I had no idea it was going to flood that bad my neighbor came over and said it might be able to be in my house. That’s the only reason why I saved thousand of dollars of stuff. Now I have even more I have a full server rack that costs over 10,000. If someone could help this could save everything. This is the website that has my local flood gate. Any help would be appreciated I can’t code well.
First, please don’t use ChatGPT to build automations and expect results. Because public GPT instances are usually woefully out of date and HA is a fast moving open source project It’s great at spilling nonsense that LOOKS great
Sorry to have to do this:
So basically everything above - toss it.
I have no idea what it was. Trying to do except it got rest sensor right…
Start looking for something at that website that looks like a restful api and has the data you want. The you can create a restful sensor. And finally trigger an automation and likely a notification based on the results of that sensor. Once you’ve located the rest api endpoints then you’re ready to start.
So you could set up a template sensor (via the UI, under Helpers) with that as the state template, and then create an automation to notify you if it gets above a certain value.
If you need the time as well, these templates should help. Play with them in Developer Tools / Template:
{% set c = state_attr('sensor.creek_height','forecast')['datum'] %}
{% set m = c|map(attribute='primary.#text')|map('float')|max %}
{{ m }}
{{ c|selectattr('primary.#text','eq','%.2f'%m)|map(attribute='valid.#text')|first }}
And Why not make “precautions” like Place your stuff/Rack what ever, at a higher level
Why even calculate for a disaster 5 feet i just about 1,5m, sure you can lift your electronics.
Im Puzzled, it all sounds “strange” to me, IF yo know there is a risk. Don’t place the stuff at floor level
You might not even be at home, or able to get to your home, to move the stuff or what ever your “plan” is
" Ehhh ok, the “prediction” says Flood 21 feet, Time to shut down everything, And move the Servers( And the Whole Rack etc ) to a higher level , Disasters mostly happens “unexpected/uncalculated” btw ( i.e unreliable predictions, or as “sudden fall” )
Like I said the last time it wasn’t even raining. I had no idea I wouldn’t of saved lots of my stuff because it took all day. I’m doing this so I get an instant warming.