You're correct. In its current implementation, the plugin first clears the alert text state (and most other states) just before setting the state to the new value. Honestly, that method is mostly a hack and is generally a poor design IMO. When I reworked the device state names in version 1.1, comparing so many old and new states became very inefficient so I chose to update states by first clearing them then setting them to the new value (if there was one). Eventually, I'll get around to rewriting that state updating algorithm, but for now, adding a condition to your triggers similar to Dewster35 (or by checking that value of the alertText state is not equal to blank text), you can work around the double triggering.automaton wrote:Nathan,
I'm evaluating the weatherAdvisory1Text (and 2+3) in a script to look for important watches or warnings. I'm triggering the script on any change in weatherAdvisory1Text. Although this does work, I've noticed that the trigger is actuated twice for each 15 minute weather cycle. I'm guessing that you may be clearing the old weatherAdvisory1Text and then posting the new weatherAdvisory1Text, and that is why I see two triggers. Is this correct? Any recommendations on which parameter to trigger from that would only create one actuation of the trigger?
Thanks.
NOAA Weather Plus discussions
Re: NOAA Weather Plus discussions
Re: NOAA Weather Plus discussions
If the state is ALWAYS changed to blank, you can simply have that as a conditional in the trigger rather than setup a variable. Just have it watch for any changes, only trigger if the state is not equal to "blank". I've not tested this yet, but I would think it would work. We'll see the next time a weather advisory pops up.
Re: NOAA Weather Plus discussions
Yes, checking for a blank as a condition seems to work. Thanks.
Re: NOAA Weather Plus discussions
Nathan,
I THINK I know what WeatherAdvisory1EndTime is or I guess what it is intended to be... but currently mine shows 2-04-13 for the end date. Just curious how that is being populated? If it is not changed if that state isn't updated on the NOAA data does it retain an older date? We have a fog advisory here and according to the weather channel it should dissipate by tonight... so I am not sure what the scoop is. My primary NOAA Station is KMGN - Harbor Springs, Michigan.
I THINK I know what WeatherAdvisory1EndTime is or I guess what it is intended to be... but currently mine shows 2-04-13 for the end date. Just curious how that is being populated? If it is not changed if that state isn't updated on the NOAA data does it retain an older date? We have a fog advisory here and according to the weather channel it should dissipate by tonight... so I am not sure what the scoop is. My primary NOAA Station is KMGN - Harbor Springs, Michigan.
Re: NOAA Weather Plus discussions
The WeatherAdvisory*Time values are taken directly out of the NOAA feed and are not calculated. The only manipulation done by the plugin is to remove a "T" character from the date/time data. So, I'm not sure how NOAA decides that it'll be foggy for 6 strait days.Dewster35 wrote:Nathan,
I THINK I know what WeatherAdvisory1EndTime is or I guess what it is intended to be... but currently mine shows 2-04-13 for the end date. Just curious how that is being populated? If it is not changed if that state isn't updated on the NOAA data does it retain an older date? We have a fog advisory here and according to the weather channel it should dissipate by tonight... so I am not sure what the scoop is. My primary NOAA Station is KMGN - Harbor Springs, Michigan.
Re: NOAA Weather Plus discussions
18 Degrees on Thursday... if they think it will be foggy until then, I think I found myself a new job!
Just out of curiosity with how it is being populated... can you compare it to the previous end time and if it is the same, blank it as well? We had a freezing rain advisory and the end time was the same as what is listed for the fog.
That may cause issues I guess if the same end time is kept, but say it moves from an advisory to a warning... not sure what a good solution is, but I'm sure you're more creative than me.
I wonder if I complained to them about it if they would update it?
Just out of curiosity with how it is being populated... can you compare it to the previous end time and if it is the same, blank it as well? We had a freezing rain advisory and the end time was the same as what is listed for the fog.
That may cause issues I guess if the same end time is kept, but say it moves from an advisory to a warning... not sure what a good solution is, but I'm sure you're more creative than me.
I wonder if I complained to them about it if they would update it?
Re: NOAA Weather Plus discussions
Yes, it's technically possible to blank out the state if the previous state value was the same, but since the plugin queries NOAA for changes every 15 minutes, that end time would be populated for 15 minutes then be blank for the rest of the time until NOAA inserted a different value. That would essentially make that device state unusable though. I'd rather not attempt to algorithmically determine what NOAA is trying to imply with the values they provide (at least not as a built-in function of the plugin). I think it's probably better, at least from a support standpoint, to provide the data as-is and let each user decide how they want to use/interpret it. Your interpretation and solution may not be the best for others, for example. So i'd rather let everyone choose their own solutions for working with cryptic NOAA data.Dewster35 wrote:18 Degrees on Thursday... if they think it will be foggy until then, I think I found myself a new job!
Just out of curiosity with how it is being populated... can you compare it to the previous end time and if it is the same, blank it as well? We had a freezing rain advisory and the end time was the same as what is listed for the fog.
That may cause issues I guess if the same end time is kept, but say it moves from an advisory to a warning... not sure what a good solution is, but I'm sure you're more creative than me.
I wonder if I complained to them about it if they would update it?
Re: NOAA Weather Plus discussions
Understand completely... I'll figure something out. I usually end up going to a weather app to find out all the nasty details anyway... and those always have the end time.
Just for fun I'll ping NOAA and see if I get a response. Probably a pretty big long shot but who knows.
Thanks for the help and the awesome plugin. The oddest stuff gets the wife's approval factor boost... getting a text from the house saying that there was severe weather is one of them. Who knew... guess that means I'm ok to buy some more hardware
Just for fun I'll ping NOAA and see if I get a response. Probably a pretty big long shot but who knows.
Thanks for the help and the awesome plugin. The oddest stuff gets the wife's approval factor boost... getting a text from the house saying that there was severe weather is one of them. Who knew... guess that means I'm ok to buy some more hardware
Re: NOAA Weather Plus discussions
You may indeed get a response from NOAA. I got a response when I pointed out data missing in their feed. Though they didn't fix it right away (or at all in some cases), they did at least reply to my email.
Sounds to me like you're cleared for some nice new hardware!
Sounds to me like you're cleared for some nice new hardware!
Re: NOAA Weather Plus discussions
My family room is basically lots of windows and clapboard, and is remarkably porous. When the temp is down and wind is blowing it gets chilly, and we need to turn up the furnace a couple of degrees -- and we like it cool anyway. After reading the last few posts in this thread I realized we needed to base our heat set temp on the wind chill, not just the outdoor temperature, so I started using the wind chill idea in a script:
but it turns out wind chill is not calculated if the temp is 46 or more, thus resulting in either a number greater than the actual temp (run the above formula with a temp of 65 and a wind speed of 0), or even blank or "undefined". So, the following might be helpful if one needs a value in the wind chill box, as I do in the script above. (I changed "hometemp" etc to "weathertemp" etc just for sorting purposes.)
thanks for the great idea! I am hoping for some cold days to check out if it makes a difference!
Code: Select all
tell application "IndigoServer"
if if value of variable "WindChill" is greater than or equal to "45" then
set cool setpoint of device "Thermostat Fam Room" to "76"
set heat setpoint of device "Thermostat Fam Room" to "69"
set cool setpoint of device "Thermostat Fam Study" to "76"
set heat setpoint of device "Thermostat Fam Study" to "69"
end if
if if value of variable "WindChill" is greater than or equal to "45" then
set cool setpoint of device "Thermostat Fam Room" to "78"
set heat setpoint of device "Thermostat Fam Room" to "71"
set cool setpoint of device "Thermostat Fam Study" to "78"
set heat setpoint of device "Thermostat Fam Study" to "71"
end if
end tellCode: Select all
tell application "IndigoServer"
if value of variable "WeatherTemp" is less than 46 then
set TEMP to 1
set WIND to 1
set WC to 1
set TEMP to (value of variable "WeatherTemp") as number
if (value of variable "WeatherWind") is not equal to "0" then
set WIND to (value of variable "WeatherWind") as number
else
set WIND to "1"
end if
set WC to round (35.74 + (0.621 * TEMP) - (35.75 * (WIND ^ 0.16)) + (0.4275 * (TEMP * (WIND ^ 0.16))))
set (value of variable "WeatherWindChill") to WC
else
set value of variable "WeatherWindChill" to value of variable "WeatherTemp"
end if
end tell
Last edited by hamw on Fri Feb 01, 2013 9:09 pm, edited 1 time in total.
Re: NOAA Weather Plus discussions
Nice idea! Thanks for sharing.
Re: NOAA Weather Plus discussions
Edited the above script to take care of "0" wind speed.
Re: NOAA Weather Plus discussions
Is there an easy way to have NOAA+ email you today's (worded) forecast? I tried using the applescript, but failed miserably.
Re: NOAA Weather Plus discussions
I think the easiest way is to create an Indigo schedule that executes at whatever time in the morning you'd like to have the email sent, then create 2 actions associated with that schedule. The first would be to use the "Insert Device State into Variable" action (action type: Variable Actions -> Insert Device State into Variable). Select the NOAA Weather Plus device. In the Edit Action Settings dialog, select "forecastTodayWorded" as the state whose value to insert and whatever Indigo variable you'd like as the destination for the state value. For the 2nd action, delay it by 1 second (check box at the bottom of the dialog) to be sure the state has been inserted into the variable successfully before the email is sent. The action type should be "Execute Script" (action type: Server Actions -> Script and File Actions -> Execute Script). Select AppleScript as the embedded script type. Use the below code to send an email to whatever address you like with the contents of the worded forecast.
Code: Select all
set theForecast to value of variable "YourVariableName"
send email to "[email protected]" with subject "Today's Forecast" with body "Today's forecast: " & theForecast- jay (support)
- Site Admin
- Posts: 19232
- Joined: Wed Mar 19, 2008 11:52 am
- Location: Austin, Texas
- Contact:
Re: NOAA Weather Plus discussions
Or you could save yourself an action and a variable by just doing the whole thing in a Python script:
theForecast = indigo.devices[DEVICEID].states['STATENAME']
indigo.server.sendEmailTo("EMAILADDRESSHERE", subject="Today's Forecast", body="Today's forecast: " + theForecast)