Hey everyone, First I would like to thank everyone here as this is a great and helpful community!
I'm not a programmer but I work in the automation industry. So I understand most programming with working with logic. And Automation logic doesn't cross over that much with programming applications.
So please forgive me on my lack of experience!
Here is what I'm wanting the end goal to be.
Node-Red connects to my Dashboard's API to collect a JSON file once every minute.
The JSON is parsed and we look at the city names.
If there is a City name that is equal to Chicago-IL then we send an email or SMS email to my phone.
If there is an entry of Chicago-IL, I get an email or SMS text every minute until Chicago-IL is no longer in the JSON file.
What I've tried.
Being a automation engineer, I've tried what I know and that is basic logic. The only issue is, in this programming, I've not been able to get the logic to work.
Here is a basic rundown of what my planed logic would look like:
If JSON file contains Chicago-IL and Bool equals False, then send email and set Bool to True
If JSON file does not contain Chicago-IL then set Bool to False
The idea of this would be that if the Chicago-IL entry pops up, the email would send and the Bool variable would get set to true. This way when the code runs again. I don't get another email until the Chicago-IL entry is gone at which the Bool variable would reset.
Where I run into issues with this logic, is each time the code was triggered, the Bool would reset and I would receive the email again and again.
Is there a way to get a Bool variable to retain it's true setting?
Do you have a better recommendation on how to pull this off?
Thank you in advance!