Author Topic: NOAA Weather Alert  (Read 3692 times)

0 Members and 1 Guest are viewing this topic.

nime5ter

  • Administrator
  • Hero Member
  • *****
  • Posts: 1999
  • Karma: 61
    • View Profile
    • Getting Started with VoxCommando
NOAA Weather Alert
« on: April 01, 2015, 04:48:36 PM »
This is a NOAA Weather Alert command, designed to work with this IFTTT recipe: https://ifttt.com/recipes/275026-noaa-weather-alert-for-voxcommando.

It:

1. Gives a TTS warning whenever NOAA updates its alert feed (and IFTTT processes it).
2. Displays a bright red OSD warning.
3. Automatically opens the NOAA web page with the weather alert details.

Code: [Select]
<?xml version="1.0" encoding="utf-16"?>
<!--VoxCommando 2.1.4.2-->
<command id="645" name="NOAA weather alert" enabled="true" alwaysOn="False" confirm="False" requiredConfidence="0" loop="False" loopDelay="0" loopMax="0" description="Combine w/ IFTTT recipe https://ifttt.com/recipes/275026-noaa-weather-alert-for-voxcommando">
  <action>
    <cmdType>Results.RegEx</cmdType>
    <params>
      <param>(.*?)issued</param>
      <param />
      <param>{1}</param>
    </params>
    <cmdRepeat>1</cmdRepeat>
  </action>
  <if ifBlockDisabled="False" ifNot="False">
    <ifType>LastActionSuccess</ifType>
    <ifParams>&amp;&amp;</ifParams>
    <then>
      <action>
        <cmdType>TTS.SpeakSync</cmdType>
        <params>
          <param>Weather alert: {Match.1}</param>
        </params>
        <cmdRepeat>1</cmdRepeat>
      </action>
    </then>
    <else>
      <action>
        <cmdType>TTS.Speak</cmdType>
        <params>
          <param>Weather alert: {1}</param>
        </params>
        <cmdRepeat>1</cmdRepeat>
      </action>
    </else>
  </if>
  <action>
    <cmdType>TTS.Speak</cmdType>
    <params>
      <param>Launching weather feed now.</param>
    </params>
    <cmdRepeat>1</cmdRepeat>
  </action>
  <action>
    <cmdType>Launch.OpenURL</cmdType>
    <params>
      <param>{3}</param>
    </params>
    <cmdRepeat>1</cmdRepeat>
  </action>
  <action>
    <cmdType>Results.RegEx</cmdType>
    <params>
      <param>(\w.*?)[\.\.\.|$]</param>
      <param><![CDATA[ ]]></param>
      <param>{2}</param>
    </params>
    <cmdRepeat>1</cmdRepeat>
  </action>
  <action>
    <cmdType>OSD.SetColors</cmdType>
    <params>
      <param>FFFFFF</param>
      <param>FF0000</param>
    </params>
    <cmdRepeat>1</cmdRepeat>
  </action>
  <action>
    <cmdType>OSD.ShowText</cmdType>
    <params>
      <param>Alert:</param>
      <param>8000</param>
      <param>-10</param>
    </params>
    <cmdRepeat>1</cmdRepeat>
  </action>
  <action>
    <cmdType>OSD.AddText</cmdType>
    <params>
      <param>{Match.{i}}</param>
    </params>
    <cmdRepeat>{#M}</cmdRepeat>
  </action>
  <event>NOAA.Alert</event>
</command>

Instructions:

1. In the IFTTT recipe, you should replace the location code with your own.

2. Create a Dropbox folder Dropbox\IFTTT\Alerts, or else change the file path used in the IFTTT recipe.

3. To use IFTTT with VoxCommando, you need to enable the Watcher plugin and watch the appropriate Dropbox folder (see screenshot).

NOTE: NOAA is only useful for U.S. residents, but this can be adapted for other RSS feeds. You'll want to make some changes to the command and the IFTTT recipe. (In this command I'm stripping out "..." characters from the NOAA feed, among other things -- so it's very specific to the NOAA feed.)
TIPS: POST VC VERSION #. Explain what you want VC to do. Say what you've tried & what happened, or post a video demo. Attach VC log. Link to instructions followed.  Post your command (xml)

nime5ter

  • Administrator
  • Hero Member
  • *****
  • Posts: 1999
  • Karma: 61
    • View Profile
    • Getting Started with VoxCommando
Re: NOAA Weather Alert
« Reply #1 on: April 01, 2015, 06:21:40 PM »
P.S. In the above command I change the display message (OSD) to white text on a red background.

You may want to add an action at the end of the command that changes the OSD back to your colour preferences. Otherwise all OSD messages will be displayed as white-on-red until you restart the program. :)
TIPS: POST VC VERSION #. Explain what you want VC to do. Say what you've tried & what happened, or post a video demo. Attach VC log. Link to instructions followed.  Post your command (xml)

PegLegTV

  • $upporter
  • Sr. Member
  • *****
  • Posts: 497
  • Karma: 43
    • View Profile
Re: NOAA Weather Alert
« Reply #2 on: November 05, 2015, 07:02:23 PM »
I created a similar Setup to Nime5ter's NOAA Weather Alert

you still need to use IFTTT as described above in nime5ter's post

This NOAA Alert will scroll the weather alert across the bottom of the screen using an HTML page and the RoboB plugin



you will need to place NOAAScroll.html in your VC Folder - Attached below

you may need to adjust the size and or the position of the popup scroll depending on your screen resolution,
you can change the window size/position in the Scrolling Popup command with the RoboB.SetWinSize action (I have it setup for 1920x1080)


Code: [Select]
<?xml version="1.0" encoding="utf-16"?>
<!--VoxCommando 2.2.0.9-->
<commandGroup open="True" name="NOAA Scrolling Alert" enabled="True" prefix="" priority="0" requiredProcess="" description="">
  <command id="453" name="Scrolling Popup" enabled="true" alwaysOn="False" confirm="False" requiredConfidence="0" loop="False" loopDelay="0" loopMax="0" description="">
    <action>
      <cmdType>Results.RegEx</cmdType>
      <params>
        <param>(.*?)issued</param>
        <param />
        <param>{1}</param>
      </params>
      <cmdRepeat>1</cmdRepeat>
    </action>
    <if ifBlockDisabled="False" ifNot="False">
      <ifType>LastActionSuccess</ifType>
      <ifParams>&amp;&amp;</ifParams>
      <then>
        <action>
          <cmdType>TTS.Speak</cmdType>
          <params>
            <param>Weather alert: {Match.1}</param>
          </params>
          <cmdRepeat>1</cmdRepeat>
        </action>
      </then>
      <else>
        <action>
          <cmdType>TTS.Speak</cmdType>
          <params>
            <param>Weather alert: {1}</param>
          </params>
          <cmdRepeat>1</cmdRepeat>
        </action>
      </else>
    </if>
    <action>
      <cmdType>RoboB.Select</cmdType>
      <params>
        <param>NOAAScroll</param>
      </params>
      <cmdRepeat>1</cmdRepeat>
    </action>
    <action>
      <cmdType>WUnder.GetCustom</cmdType>
      <params>
        <param>s:&lt;/span&gt;{C.weather}&lt;span style="color:#00F5FF"&gt; Temp:&lt;/span&gt;{C.temp_f}F&lt;span style="color:#00F5FF"&gt; Winds:&lt;/span&gt;{C.wind_dir} at {C.wind_mph}mph&lt;/d</param>
      </params>
      <cmdRepeat>1</cmdRepeat>
    </action>
    <action>
      <cmdType>Results.SetVar</cmdType>
      <params>
        <param>Current</param>
        <param>{LastResult}</param>
      </params>
      <cmdRepeat>1</cmdRepeat>
    </action>
    <action>
      <cmdType>Results.SetLastResult</cmdType>
      <params>
        <param>{2}</param>
      </params>
      <cmdRepeat>1</cmdRepeat>
    </action>
    <action>
      <cmdType>Results.RegExReplace</cmdType>
      <params>
        <param>\.\.\.</param>
        <param><![CDATA[ ]]></param>
      </params>
      <cmdRepeat>1</cmdRepeat>
    </action>
    <action>
      <cmdType>Results.SetVar</cmdType>
      <params>
        <param>Alert</param>
        <param>{LastResult} --- </param>
      </params>
      <cmdRepeat>1</cmdRepeat>
    </action>
    <action>
      <cmdType>File.Read</cmdType>
      <params>
        <param>{Path.VC}\NOAAScroll.html</param>
      </params>
      <cmdRepeat>1</cmdRepeat>
    </action>
    <action>
      <cmdType>Results.RegExReplace</cmdType>
      <params>
        <param>s:&lt;/span&gt;(.*?)&lt;s.*?n&gt;(.*?)&lt;s.*?n&gt;(.*?)&lt;/d</param>
        <param>{Var.Current}</param>
      </params>
      <cmdRepeat>1</cmdRepeat>
    </action>
    <action>
      <cmdType>Results.RegExReplace</cmdType>
      <params>
        <param>&lt;span style="color:red"&gt;Weather Alert:&lt;/span&gt;(.*?)&lt;span style="color:red"&gt;Weather Alert:&lt;/span&gt;(.*?)&lt;span style="color:red"&gt;Weather Alert:&lt;/span&gt;(.*?)&lt;/marquee&gt;</param>
        <param>&lt;span style="color:red"&gt;Weather Alert:&lt;/span&gt; {1} -- {Var.Alert} --- &lt;span style="color:red"&gt;Weather Alert:&lt;/span&gt; {1} -- {Var.Alert} --- &lt;span style="color:red"&gt;Weather Alert:&lt;/span&gt; {1} -- {Var.Alert} --- &lt;/marquee&gt;</param>
      </params>
      <cmdRepeat>1</cmdRepeat>
    </action>
    <action>
      <cmdType>File.Write</cmdType>
      <params>
        <param>{Path.VC}\NOAAScroll.html</param>
        <param>{LastResult}</param>
      </params>
      <cmdRepeat>1</cmdRepeat>
    </action>
    <action>
      <cmdType>RoboB.Navigate</cmdType>
      <params>
        <param>{Path.VC}\NOAAScroll.html</param>
      </params>
      <cmdRepeat>1</cmdRepeat>
    </action>
    <action>
      <cmdType>RoboB.Wait</cmdType>
      <params />
      <cmdRepeat>1</cmdRepeat>
    </action>
    <action>
      <cmdType>RoboB.Show</cmdType>
      <params>
        <param>True</param>
      </params>
      <cmdRepeat>1</cmdRepeat>
    </action>
    <action>
      <cmdType>RoboB.ShowFrame</cmdType>
      <params>
        <param>False</param>
      </params>
      <cmdRepeat>1</cmdRepeat>
    </action>
    <action>
      <cmdType>RoboB.SetWinSize</cmdType>
      <params>
        <param>1920</param>
        <param>92</param>
        <param>0</param>
        <param>990</param>
      </params>
      <cmdRepeat>1</cmdRepeat>
    </action>
    <action>
      <cmdType>VC.StopEventTimer</cmdType>
      <params>
        <param>Hide Weather Alert</param>
      </params>
      <cmdRepeat>1</cmdRepeat>
    </action>
    <action>
      <cmdType>VC.SetEventTimer</cmdType>
      <params>
        <param>3m</param>
        <param>Hide Weather Alert</param>
      </params>
      <cmdRepeat>1</cmdRepeat>
    </action>
    <phrase>Show scroll bar</phrase>
    <event>NOAA.Alert</event>
  </command>
  <command id="428" name="hide Scrolling Popup" enabled="true" alwaysOn="False" confirm="False" requiredConfidence="0" loop="False" loopDelay="0" loopMax="0" description="">
    <action>
      <cmdType>RoboB.Select</cmdType>
      <params>
        <param>NOAAScroll</param>
      </params>
      <cmdRepeat>1</cmdRepeat>
    </action>
    <action>
      <cmdType>RoboB.Dispose</cmdType>
      <params />
      <cmdRepeat>1</cmdRepeat>
    </action>
    <phrase>hide scroll bar</phrase>
    <event>Hide Weather Alert</event>
  </command>
</commandGroup>




nime5ter

  • Administrator
  • Hero Member
  • *****
  • Posts: 1999
  • Karma: 61
    • View Profile
    • Getting Started with VoxCommando
Re: NOAA Weather Alert
« Reply #3 on: November 06, 2015, 07:48:10 AM »
Great idea! I like the multiple font colours you've got going on, along with the scrolling effect. Very au-then-tik. :)

So do you recommend 3 minutes as a good length of time to show the scrolling message? Seems reasonable, but as we don't tend to have urgent weather situations up here, I'm not a good judge.



« Last Edit: November 06, 2015, 08:20:14 AM by nime5ter »
TIPS: POST VC VERSION #. Explain what you want VC to do. Say what you've tried & what happened, or post a video demo. Attach VC log. Link to instructions followed.  Post your command (xml)

jitterjames

  • Administrator
  • Hero Member
  • *****
  • Posts: 7714
  • Karma: 116
    • View Profile
    • VoxCommando
Re: NOAA Weather Alert
« Reply #4 on: November 06, 2015, 08:22:40 AM »
Very fancy!

PegLegTV

  • $upporter
  • Sr. Member
  • *****
  • Posts: 497
  • Karma: 43
    • View Profile
Re: NOAA Weather Alert
« Reply #5 on: November 06, 2015, 12:33:23 PM »
Great idea! I like the multiple font colours you've got going on, along with the scrolling effect. Very au-then-tik. :)

So do you recommend 3 minutes as a good length of time to show the scrolling message? Seems reasonable, but as we don't tend to have urgent weather situations up here, I'm not a good judge.

Thanks  :)

3 minutes works well, with an average length Alert it will scroll 1 and half times, with a shorter alert it will scroll 3+ times, that's why I have it write the statement 3 times to the html page otherwise it will leave a blank scroll bar before the next one will start. and some times NOAA will issues more then one warning at once so I have it cancel the old 3 minute event timer and start a new one.

I'm trying to find a good "Breaking news" feed to use with the scroll, but so far all I have found are "Latest News" feeds and I only want it for breaking news feed,

I might even use it with the VC RSS Feed  ;)