Announcement

Collapse
No announcement yet.

Do_More Forecast

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


  • Do_More Forecast

    I'd like to get the weather forecast into a BRX so it can make better control decisions. Does anybody know of a IOT Broker that publishes that data, or could a guy stream in a RSS Feed and decipher that within the BRX?
    Would the BRX be able to make a API request? or maybe I'm better of doing it with a arduino then feeding it into the PLC. It doesn't have to be bullet proof,it's for a home project.
    I know its a long shot and not what the PLC was intended for but I thought I'd ask.
    Last edited by pbw; 09-10-2018, 09:48 AM.


  • #2
    I would use a Raspberry pi and query Weather Underground and publish the Forecast via MQTT topic to the BRX.

    Comment



    • #3
      No idea if Do-More can do a Get() or not, but there's nice realish-time (like updated once an hour) weather data at www.weather.gov/xml/current_obs/[FLC].xml, where FLC is the four-letter code for the nearest NOAA weather station, which you can also find out at www.weather.gov. The FLC nearest Jonesborough, TN, for example is KTRI, which is at Bristol/Johnson/Kingsport Regional Airport.

      Here's a sample of the XML:

      <?xml version="1.0" encoding="ISO-8859-1"?>
      <?xml-stylesheet href="latest_ob.xsl" type="text/xsl"?>
      <current_observation version="1.0"
      xmlns:xsd="http://www.w3.org/2001/XMLSchema"
      xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
      xsi:noNamespaceSchemaLocation="http://www.weather.gov/view/current_observation.xsd">
      <credit>NOAA's National Weather Service</credit>
      <credit_URL>http://weather.gov/</credit_URL>
      <image>
      <url>http://weather.gov/images/xml_logo.gif</url>
      <title>NOAA's National Weather Service</title>
      <link>http://weather.gov</link>
      </image>
      <suggested_pickup>15 minutes after the hour</suggested_pickup>
      <suggested_pickup_period>60</suggested_pickup_period>
      <location>Bristol / Johnson / Kingsport, Tri-City Regional Airport, TN</location>
      <station_id>KTRI</station_id>
      <latitude>36.4797</latitude>
      <longitude>-82.3989</longitude>
      <observation_time>Last Updated on Sep 18 2018, 6:53 pm EDT</observation_time>
      <observation_time_rfc822>Tue, 18 Sep 2018 18:53:00 -0400</observation_time_rfc822>
      <weather>A Few Clouds</weather>
      <temperature_string>82.0 F (27.8 C)</temperature_string>
      <temp_f>82.0</temp_f>
      <temp_c>27.8</temp_c>
      <relative_humidity>56</relative_humidity>
      <wind_string>Calm</wind_string>
      <wind_dir>North</wind_dir>
      <wind_degrees>0</wind_degrees>
      <wind_mph>0.0</wind_mph>
      <wind_kt>0</wind_kt>
      <pressure_string>1012.3 mb</pressure_string>
      <pressure_mb>1012.3</pressure_mb>
      <pressure_in>29.97</pressure_in>
      <dewpoint_string>64.9 F (18.3 C)</dewpoint_string>
      <dewpoint_f>64.9</dewpoint_f>
      <dewpoint_c>18.3</dewpoint_c>
      <heat_index_string>84 F (29 C)</heat_index_string>
      <heat_index_f>84</heat_index_f>
      <heat_index_c>29</heat_index_c>
      <visibility_mi>10.00</visibility_mi>
      <icon_url_base>http://forecast.weather.gov/images/wtf/small/</icon_url_base>
      <two_day_history_url>http://www.weather.gov/data/obhistory/KTRI.html</two_day_history_url>
      <icon_url_name>few.png</icon_url_name>
      <ob_url>http://www.weather.gov/data/METAR/KTRI.1.txt</ob_url>
      <disclaimer_url>http://weather.gov/disclaimer.html</disclaimer_url>
      <copyright_url>http://weather.gov/disclaimer.html</copyright_url>
      <privacy_policy_url>http://weather.gov/notice.html</privacy_policy_url>
      </current_observation>
      Last edited by ControlsGuy; 09-18-2018, 06:29 PM.

      Comment



      • #4
        Do you need to get current conditions? If so it may be easier to put in an outdoor sensor. You can get analog (4-20MA for temp and RH) or you can get then either serial or ethernet. The serial/ethernet can be setup to just udp stream values to an iport of your choosing. I have used devices from omega, vaisala, and rotronic before.
        At my house I have an ACI analog outdoor temp/RH probe.

        Comment



        • #5
          Version 2.3 of Do-more can do an MQTT subscribe to a weather service that could get you the data. The returned data will be in a String; you can then parse the data using the other String functions.

          The ability to do an HTTP Get(), Head(), Put(), Post(), and Delete(), and the ability to parse & build JSON-formatted records is coming in the next release.

          Comment



          • #6
            That's awesome.

            Comment



            • #7
              Hey pbw, I just noticed this post. I have done (almost) exactly what you are doing on a BRX. Only I am grabbing current conditions. Forecast wouldn't be much different. I did it all through api.wunderground.com, the only catch is that for simplicity, I am parsing the data into simpler output on a web server local to the PLC's network. It could be any PC or server on the network, it's really quite simple once I got it all figured out. Let me know if you want more info.

              Comment



              • #8
                Originally posted by Bolt View Post
                Hey pbw, I just noticed this post. I have done (almost) exactly what you are doing on a BRX. Only I am grabbing current conditions. Forecast wouldn't be much different. I did it all through api.wunderground.com, the only catch is that for simplicity, I am parsing the data into simpler output on a web server local to the PLC's network. It could be any PC or server on the network, it's really quite simple once I got it all figured out. Let me know if you want more info.
                Yes, I do want to know more!
                I decided to put it off for a while and wait for the up coming Do-More release, but if you're willing to point me in the right direction, I'd gladly start with grabbing the current condition and then work up to the forecast.

                Comment



                • #9
                  The file on my server looks like this:
                  Code:
                  <?php 
                  $json = file_get_contents("http://api.wunderground.com/api/abcdefghijkl/conditions/q/12345.json");
                  $json_data = json_decode($json,true);
                  echo "[epoch]";
                  echo($json_data[current_observation][observation_epoch]);
                  echo "[tempf]";
                  echo($json_data[current_observation][temp_f]);
                  echo "[humid]";
                  echo($json_data[current_observation][relative_humidity]);
                  echo "[windd]";
                  echo($json_data[current_observation][wind_degrees]);
                  echo "[winds]";
                  echo($json_data[current_observation][wind_mph]);
                  echo "[windg]";
                  echo($json_data[current_observation][wind_gust_mph]);
                  echo "[dewpt]";
                  echo($json_data[current_observation][dewpoint_f]);
                  echo "[feels]";
                  echo($json_data[current_observation][feelslike_f]);
                  echo "[weathdone]";
                  ?>
                  abcdefghijkl being your API login, 12345 being your zip code.

                  The BRX does a scheduled STREAMOUT (no more than once every 3 minutes to stay within terms of API) to the WebServer,
                  Code:
                  GET http://serverip/weather.php$0D$0A
                  This returns a string,
                  Code:
                  [epoch]1539700907[tempf]41.7[humid]83%[windd]23[winds]4[windg]0[dewpt]36[feels]39[weathdone]
                  This can be used with STRFIND and STRSUB and STR2INT, etc to get the values into a variable.

                  I got a lot of help in this post:

                  Comment



                  • #10
                    Y'all gonna like what's coming. HTTPCMD will reduce the web query to a single box. Output from query is then fed into one or more JSONPARSE instructions to access content. The web server tools will make it easy to push info back out too. Neat stuff coming.

                    Comment



                    • #11
                      Thanks Bolt. Will look at this.

                      Comment

                      Working...
                      X