Announcement

Collapse
No announcement yet.

Weather Warnings Script Update

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    #16
    Originally posted by simonmason View Post
    Thanks for the Expired warning code. I made this change and will watch to see if I get anything.

    Another question. I have a universal event running in the house between 11 and 7am that turns off text to speech. It sets hs.MuteSpeech to TRUE or FALSE. I noticed this morning that before 7am I got the beep from the weather script and no speech so I decided to dig in and turn the beep off during these times.
    That's smart!

    Yes I have something similar in the second part. That's where you want to put your code.

    I am turning off the warnings inside the script between similar times and also check for different types of warnings that I exclude from being shut off. For example, if a tornado warning comes during the night, will you hear it (I assume you want to)?

    I'd love to see your final code (for turning them off during certain times and also overriding that for certain warnings).

    Comment


      #17
      But they still work

      Originally posted by stevea View Post
      The funny thing is that their beta alerts page still provides a list of the old county designators and the old area designators, even though none of are used any more (like your TNZ018).
      They still work, however, since one can go to the page by using the url and designator. Perhaps they are keeping them operative while bringing the new version on line. What are they using now - the FIPS code that you have in your config page? How could I log onto using that?

      Tony

      Comment


        #18
        Originally posted by atalbert View Post
        They still work, however, since one can go to the page by using the url and designator. Perhaps they are keeping them operative while bringing the new version on line. What are they using now - the FIPS code that you have in your config page? How could I log onto using that?

        Tony
        I think they are keeping the old pages alive a while longer. My guess is that when the effectively pulled the plug temporarily, more important people than us HS users realized suddenly they were ill equipped for the transition.

        The new set-up they have uses the FIPS code. If you are asking how to make the old script use the new stuff, I don't think it will be real simple. Before, you could simply go to a page for the county / region you were interested in. Now you have to load a state-level XML file, and find the URL to another XML file for individual alerts. The URL will be that long - probably random - string that you found. My initial simple script did that much, finding any alerts that matched a set of FIPS codes I was interested in. So now I'm putting the stuff around that to do all the other things I have in the config page.

        I'm going kinda slow right now, not just because of my day job, but also because my HS system seems to be in a death spiral. I bought parts yesterday and built a new Win7 PC, so now I have to go through the painful process of trying to get everything moved over. Anyway, it's taking time away from all my coding projects here. I still hope to have some initial alpha stuff this weekend.

        Tony - If you would be interested / willing to try some early stuff, send me an email. It will be pretty rough, but your feedback so far has been really helpful to me already.

        Steve

        Comment


          #19
          Originally posted by GatorEye View Post
          That's smart!

          Yes I have something similar in the second part. That's where you want to put your code.

          I am turning off the warnings inside the script between similar times and also check for different types of warnings that I exclude from being shut off. For example, if a tornado warning comes during the night, will you hear it (I assume you want to)?

          I'd love to see your final code (for turning them off during certain times and also overriding that for certain warnings).
          Gator,

          I don't know if you ever got my candidate config ASPX page up (over here: http://board.homeseer.com/showpost.p...7&postcount=20 - make sure you install the XML file in the DATA/Snevl/Weather subdirectory), but I think I have stuff in there to exclude some warnings, to have announcment windows of time, and to override those times based on either severity or warning type. The override announcements (kind of "Hi Priority" events) also have their own customizable template and pre-/post- WAV/MP3 sounds.

          Steve

          P.S. By the way, I plan on releasing this as source code, although with some hesitation. I don't mind people seeing and even re-using my code, but I don't want to get in the habit of trying to fix things that other people break in my code.

          Comment


            #20
            Oh No!

            On both counts. The trials and tribulations of setting up a new machine and the new system for the NWS pages. Ah, our governement at work! Perhaps there is an advantage to the newer system that I don't understand. Surely a governmental agency wouldn't change things and make our lives more difficult for no good reason! ;-)

            Basically though, it appears that any work on the old script is going to be wasted!

            Steve, I've sent you an email through the board.

            Tony

            Comment


              #21
              I have just made your modifications to the script, and it tests out okay do far... we are currently under a winter storm watch, and the script picked it up as it should. Thanks!

              Comment


                #22
                I have noticed that the new feed seems to repeat the warnings a lot more than the old one. Today I got exactly the same warning at 11:18am, 11:23am (they added "..." in one sentence!), then again at 1:07pm, 2:27pm, 2:53pm, and again at 3:07pm before moving it from a watch to warning at 3:29pm and then repeating it (so far) 4 more times!

                I was wondering if we could insert some code to keep the body of the last watch in the ini file and then compare the current to the old and only broadcast when there is a difference?

                Comment


                  #23
                  In follow-up to my comment about muting the warning beep I added the following line to the code shown below in bold red. I have an event that sets hs.MuteSpeech on each night and off each morning. By adding this line to the code it tests to see if hs.MuteSpeech is false and then plays the beep and speaks the warning.

                  In the first half of this code snippet I also added in the command "hs.MuteSpeech = FALSE" before the speech command on warnings that override the mute. Therefore, if I have the house set to mute, and a warning appears that is supposed to override the mute (tornado, for example) it will say the warning. I suppose to make this cleaner I should really test to see if mute is on, and then turn it off and then on again. However it occurred to me that in the even that one of these warnings comes up I probably want to leave mute off from then on to hear anything else the house has to say!

                  I can't really test the second part of this. To my knowledge we have never had one of these severe warnings where we live in the NY area!



                  Code:
                          'code for tts to speak warnings
                          if hs.IsOn(HouseCode & DeviceNum) and warning <> "None" then
                              'checks to see if it should override speech. kind of warning
                              if Ucase(UseSpeech) = Ucase("FALSE") then
                                 count = 0
                                 Do
                                    count = count + 1
                                    warntyp = trim(hs.stringItem(OverRideSpeech, count, ","))
                                   if warningtype = warntyp then
                                        if Ucase(SpeakWholeWarn) = Ucase("True") then
                                            if wavepath <> "" then
                                                hs.PlayWavFile wavepath
                                            end if
                                            [COLOR=Red][B]hs.MuteSpeech = FALSE[/B][/COLOR]
                                            hs.Speak warning,True
                                        else
                                            if wavepath <> "" then
                                                 hs.PlayWavFile wavepath
                                            end if
                                            [B][COLOR=Red]hs.MuteSpeech = FALSE[/COLOR][/B]
                                            hs.Speak warningtype,True
                                        end if
                                    end if
                                    hs.waitevents
                                 Loop Until warntyp = ""
                              else [B][COLOR=Red]if hs.MuteSpeech = FALSE then[/COLOR][/B]
                                   if Ucase(SpeakWholeWarn) = Ucase("True") then
                                       if wavepath <> "" then
                                            hs.PlayWavFile wavepath
                                       end if
                                       hs.Speak warning,True
                                   else
                                       if wavepath <> "" then
                                            hs.PlayWavFile wavepath
                                       end if
                                       hs.Speak warningtype,True
                                   end if
                              end if
                          end if

                  Comment


                    #24
                    Originally posted by simonmason View Post
                    I have noticed that the new feed seems to repeat the warnings a lot more than the old one. Today I got exactly the same warning at 11:18am, 11:23am (they added "..." in one sentence!), then again at 1:07pm, 2:27pm, 2:53pm, and again at 3:07pm before moving it from a watch to warning at 3:29pm and then repeating it (so far) 4 more times!

                    I was wondering if we could insert some code to keep the body of the last watch in the ini file and then compare the current to the old and only broadcast when there is a difference?
                    As I'm beta testing my new .NET script, I've hit this same problem. I currently have it set up to handle up to three alerts, and right now all three slots are filled with essentially the same alert. There are very slight differences in the warning itself (maybe a sentence out of the entire alert), and the area affected is slightly different (but all three include my county). As a result of filling up all three, there are more alerts that I don't have room for. I am not clear on how to handle it.

                    Steve

                    Comment


                      #25
                      If they change the text at all then there is not much you can do without making it too complicated. However, there are definitely repeated alerts that appear to be identical in content. Perhaps comparing them will prevent the repeating. I am going to look into modifying the script to store the last warning in the ini file and then checking the new one against it.

                      Comment


                        #26
                        Yeah I was hoping that with the update of the warnings and a lot of added XML nodes broken out for things like severity, urgency, certainty, etc. that they could have added one for a description that was formatted normally using proper grammar and punctuation. My script is littered with code to replace things like "...", the issuers name, weird characters, the name of the 20+ cities that are always affected by the warnings., etc.

                        Definitely disappointing and troublesome when they continue to make new warnings caused by extra punctuation.

                        Comment


                          #27
                          Today I received 7 warnings in a row that were identical. So I think it is worth adding some code to check current against previous and not trigger the warning if it is the same.

                          I looked briefly at the code and I see that the contents of the warning are stored in the variable "warning". I cannot find where the ini file is being written so that I can store this in the ini file and then retrieve it each time a new warning is located?

                          I will look more deeply but any pointers would be helpful. Thanks.

                          Comment


                            #28
                            I'm about to release the new script, and would like to know what - if anything - should be done with nearly identical warnings. They are never exactly identical, so...

                            Comment


                              #29
                              Originally posted by simonmason View Post
                              Today I received 7 warnings in a row that were identical. So I think it is worth adding some code to check current against previous and not trigger the warning if it is the same.

                              I looked briefly at the code and I see that the contents of the warning are stored in the variable "warning". I cannot find where the ini file is being written so that I can store this in the ini file and then retrieve it each time a new warning is located?

                              I will look more deeply but any pointers would be helpful. Thanks.
                              Search the code for this line:

                              hs.SaveINISetting "Settings", "Numwarning", timesspoke, "weatherwarnings.ini"

                              The scripts numwarning parameter should prevent warnings that are exactly the same from playing more than the number of times you have that value set, of course except in the case they continue issuing new warnings with the same text, which I do think is happening.

                              You could save the warning text and if the code that is about to process it sees that it is the same, you could set the blnFind variable to true so it doesn't process and force the the value of numwarnings = RepeatWarnings + 1, so the rest of the code thinks it has been played enough. I'd have to check on that last part though.

                              Again, these are all kludges for this script. Steve's should work better or at least be easier to integrate logic for stuff like this.

                              Comment


                                #30
                                Originally posted by stevea View Post
                                I'm about to release the new script, and would like to know what - if anything - should be done with nearly identical warnings. They are never exactly identical, so...
                                I'm not sure there is much we really can do easily if they issue a new warning with a minor change to the text. Some comparison would need to be done to see what the difference is, and even at that, I'm not sure how to handle the logic. I don't know why that is happening.

                                Comment

                                Working...
                                X