Announcement

Collapse
No announcement yet.

Get local weather data by Big5 and API (no equipment needed)

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

  • logman
    replied
    Originally posted by socalsharky View Post

    Thanks Barry. Can I paste this code into the middle of the current JSON call, or does it need to be a separate call?
    Yes, you can paste them in the existing call and replace the other two.

    --Barry

    Leave a comment:


  • socalsharky
    replied
    Originally posted by logman View Post

    No problem... Sometimes these can get confusing and a fresh set of eyes helps.

    Here you go, one for the 1h total and one for the 3h total:

    Code:
    If (RegExMatch(input, "1h"),round(JSON_num(input, "rain.1h")/25.4,2),0)
    
    If (RegExMatch(input, "3h"),round(JSON_num(input, "rain.3h")/25.4,2),0)
    This will return the converted rain total rounded to 2 places past the decimal if a total exists. If no total exists, it will simply return 0.

    --Barry
    Thanks Barry. Can I paste this code into the middle of the current JSON call, or does it need to be a separate call?

    Leave a comment:


  • logman
    replied
    Originally posted by socalsharky View Post
    I found a new location that had rain in the 1 hour field, but not the 3 hour field...not sure how that is possible since rain in the last hour also is rain in the last 3 hours, but whatever. ...

    Thanks for looking at this
    No problem... Sometimes these can get confusing and a fresh set of eyes helps.

    Here you go, one for the 1h total and one for the 3h total:

    Code:
    If (RegExMatch(input, "1h"),round(JSON_num(input, "rain.1h")/25.4,2),0)
    
    If (RegExMatch(input, "3h"),round(JSON_num(input, "rain.3h")/25.4,2),0)
    This will return the converted rain total rounded to 2 places past the decimal if a total exists. If no total exists, it will simply return 0.

    --Barry

    Leave a comment:


  • socalsharky
    replied
    I found a new location that had rain in the 1 hour field, but not the 3 hour field...not sure how that is possible since rain in the last hour also is rain in the last 3 hours, but whatever. Here is the input file:

    Code:
    {"coord":{"lon":-107.01,"lat":37.27},"weather":[{"id":502,"main":"Rain","description":"heavy intensity rain","icon":"10n"},{"id":701,"main":"Mist","description":"mist","icon":"50n"}],"base":"stations","main":{"temp":52,"pressure":1028,"humidity":100,"temp_min":48,"temp_max":54},"visibility":6437,"wind":{"speed":3.36,"deg":340},"rain":{"1h":0.76},"clouds":{"all":90},"dt":1568608922,"sys":{"type":1,"id":5411,"message":0.0092,"country":"US","sunrise":1568551801,"sunset":1568596609},"timezone":-21600,"id":5433784,"name":"Pagosa Springs","cod":200}
    Here are the devices that are being created by Big5, using the code above:

    Click image for larger version

Name:	Capture9.JPG
Views:	163
Size:	15.2 KB
ID:	1326800

    The JSON calls are identical for both devices, with the exception of rain.1h and rain.3h:

    Code:
    JSON(input, "main.temp") && JSON(input, "main.humidity") && JSON(input, "main.pressure") && JSON(input, "wind.speed") && JSON(input, "wind.deg") && JSON(input, "weather[0].main") && JSON(input, "weather[0].description") && JSON(input, "clouds.all") && JSON(input, "weather[0].icon") && JSON_NUM(input, "rain.1h")/25.4 && JSON_NUM(input, "rain.3h")/25.4 && JSON(input, "name")
    Thanks for looking at this.

    Leave a comment:


  • logman
    replied
    Originally posted by socalsharky View Post
    I got this up and running, and so far it's working pretty well. The default station nearest to my house appears to have bad data, so I adjusted the lat/lon to somewhere close by with more accurate data. However, I am having a problem with retrieving the rain data. When there has been rain in the last 1 or 3 hours, I can get data for rain.1h and rain.3h. But when there is no rain, I get this:

    Click image for larger version  Name:	Capture7.JPG Views:	0 Size:	18.2 KB ID:	1326707
    Here is a screenshot of when the JSON file had a rain value of 0.51mm for 1 hour (different lat/lon):

    Click image for larger version  Name:	Capture8.JPG Views:	0 Size:	15.5 KB ID:	1326708


    How can I fix this? I noticed that the JSON file does not include rain data at all if it is 0. So Big5 can't simply retrieve the "0" value for rain. Is there a way to insert an if statement, so that if the data is not there, it will insert a "0" as the device value?
    Yes, you can wrap the JSON call with an IF statement. However we really need to see your input string to determine what the correct syntax should be. Likely it would look something like this:

    Code:
    If (RegExMatch(input, "1h"),JSON_num(input, "rain.[0]")/25.4 ,0)
    Paste the JSON input string that you are getting back from the weather service and we'll take a better look at it.

    --Barry

    Leave a comment:


  • socalsharky
    replied
    I got this up and running, and so far it's working pretty well. The default station nearest to my house appears to have bad data, so I adjusted the lat/lon to somewhere close by with more accurate data. However, I am having a problem with retrieving the rain data. When there has been rain in the last 1 or 3 hours, I can get data for rain.1h and rain.3h. But when there is no rain, I get this:

    Click image for larger version

Name:	Capture7.JPG
Views:	168
Size:	18.2 KB
ID:	1326707
    Here is a screenshot of when the JSON file had a rain value of 0.51mm for 1 hour (different lat/lon):

    Click image for larger version

Name:	Capture8.JPG
Views:	156
Size:	15.5 KB
ID:	1326708


    How can I fix this? I noticed that the JSON file does not include rain data at all if it is 0. So Big5 can't simply retrieve the "0" value for rain. Is there a way to insert an if statement, so that if the data is not there, it will insert a "0" as the device value?

    Leave a comment:


  • risquare
    replied
    Try "weather[0].main"
    Always test your RegEx in RegEx sandbox before using them. The sandbox is available at HS3-->Plugins-->Big5-->Documentation.
    RegEx format to use in the sandbox is ${ body } .
    After you verify your RegEx you strip ${ } and use only body in the Big5 profile setup.

    Leave a comment:


  • dalwilli
    replied
    I'm having trouble pulling the Weather Main & Description. It's only pulling 0. This is what I have...

    JSON(input, “weather.0.main") && JSON(input, "weather.0.description") && JSON(input, "main.temp") && JSON(input, "main.pressure") && JSON(input, "main.humidity") && JSON(input, "main.temp_min") && JSON(input, "main.temp_max") && JSON(input, "wind.speed") && JSON(input, "name")

    This is from the API...
    weather
    0
    id 803
    main "Clouds"
    description "broken clouds"
    icon "04d"
    I'm sure my syntax is wrong. Can someone help me with it?

    Leave a comment:


  • ChrisH
    replied
    I have this in place and the weather is updating on a schedule. I was having problems with it showing rain amounts on a nice sunny day. As it turns out openweathermap does not send a rain=0 element when there is no rain. For example if I pull a forecast right now there is no rain 0. My devices in HomeSeer are showing the old value from when there was rain. I just wanted to let everyone know to watch out for this. I'm planning on zeroing out the rain and snow values before I call the API.

    Leave a comment:


  • joesch
    replied
    I think you are right with the dot and the comma. In europe the comma is that what in usa is the dot.
    I found a link explaining the settings for windows, works perfectly now. after changing settings hs has to be restarted for taking effect.
    here is the link for anyone who is interested in perhaps having the same problem:
    https://resrequest.helpspot.com/inde...kb.page&id=279

    Leave a comment:


  • risquare
    replied
    1. No it will not change as it is related to other important functionality.
    2. No it doesn't make your HTTP profile obsolete as the profile tells Big5 how to process the incoming data and what HS3 devices to create.
    3. It works for me perfectly as far as temperature readings. You may play with the device settings in HS3 in the tab "status graphics". Also decimal dot vs decimal comma that is used in Europe may have something to do with it. Just guessing.
    4. Yes. In order to update the values you need to trigger your HS3 event periodically.

    Leave a comment:


  • joesch
    replied
    so i have to copy the url from the http profile and input it again in field "override request body"? do you want to change this is next version or is this going to stay. if so i dont understand the sence to type a url twice. wouldnt different profils be needless then?

    im just interested to get the correct temperature but i still have problems to get the right value. if the openweathermap api says its 1.99 degrees, i always get 199 degrees. do you have an idea how to change to see the correct value?


    there is just another thing i do not understand yet. to create a temperature device, i have to trigger an event with big5 http action. do i regulary have to trigger this event for updating value or does it do automatically?

    Leave a comment:


  • risquare
    replied
    Resolved. Tested. No need for software update. Just the new version 1.26 treats data differently. In this case you need to setup and save the whole URL in the data box of the Big5 HTTP output command (not just in the profile). Note is taken and the online documentation will be updated.

    Leave a comment:


  • risquare
    replied
    Confirmed. Working on it.

    Leave a comment:


  • MattL0
    replied
    Originally posted by joesch View Post



    im still testing big5 since today. 30 days left. So i guess its the newest version.
    In the api you can see now "1.99" but the value is 199 to me.
    here are the screenshots, perhaps I missed something:




    omg. after updating from version 1.25.0.0 to 1.26.0.0 NOTHING works anymore. no device will be created.
    YUP..... my guess is ti wait for risquare on this...

    Leave a comment:

Working...
X