[UPDATED] Weewx Weather Driver With External Forecasting

That’s because you can’t use that method with 2 minutes.
It would need to be rewritten to use a cron job for the polling.

Can I ask why you want to poll every 2 minutes?

Andy

Thanks for the reply, Andy.

I actually wanted to poll every 1 minute but I started with 2. We have a water feature in the yard that loses water when the wind blows over 8MPH. Currently, I am polling my PWS every 2 minutes via Ambient Weather API and turning off the water feature when wind_gust >=8.0. I've been on a quest to localize all my HA and hoped to be able to do this with Weewx and Hubitat.

John

Scratch that. It's in another driver.....

Let me get it........

Ok @Cobra

You can hash this out right ???

if (refreshEvery != null) {
"runEvery${refreshEvery}Minutes"(autorefresh)
log.info "Refresh set for every ${refreshEvery} Minutes"
} else {
runEvery30Minutes (autorefresh)
log.info "Refresh set for every 30 Minutes"
}

Just change the runEvery30Minutes to runIn1Minute

That won't work

runEvery only has certain parameters that you can use (5 mins being the smallest)
runIn is a one time thing unless it's looped (it will only run the first time it's called)

This really need to be configured as a cron job

As soon as I get some time to look at this driver, I will

Andy

I thought there was a runEvery1Minute?

If not you could always do runIn and just reschedule it every time..

I don't like using loops using runIn unless I have to
That's why I think it should be converted to a chron schedule

I'm pretty sure they added run every 1 minute after that post was made.

Edit: yes they did. I just looked.

Regardless, if you want to do it with a Cron job that's fine too obviously.

If they did then it's worth a try :slight_smile:

But as I said.. this driver REALLY needs some work as the WU section doesn't work since the WU changes.
I've just not found the time to revisit it

Then the 1 min can easily be added

Yeah, when I get around to looking at this then I'll make it so any number of minutes can be added.
Better in the long run

1 Like

What about a rule ?

I've settled on a different way of doing this. I am running Node-Red on the same VM as Weewx. In Node-Red, I was able to easily poll the daily.json used by this driver, parse out the values I need, and send an "off" command to my water feature device via Maker API. This might ultimately be a better solution, as it off loads the frequent polling from Hubitat and only sends the off command if the wind speed threshold is reached or exceeded. Yes, this adds another "man in the middle", but I am already using Node-Red for other things and have eliminated a cloud dependency.

Thanks for your help!

The rain rate rain/hr is coming across as ‘string’ as opposed to an integer.

I’m using a netatmo to track rain and I cannot use the rain data to trigger automations because it is not a number.

What am I doing wrong?

Can you post your daily.json output here ?

{
  "title":"Current Values",
  "location":"Bennett Ranch, Boca Raton Florida",
  "time":"06/07/19 11:30:00",
  "lat":"26° 21.24' N",
  "lon":"080° 12.48' W",
  "alt":"19 feet",
  "hardware":"netatmo",
  "uptime":"17 days, 17 hours, 45 minutes",
  "serverUptime":"18 days, 20 hours, 46 minutes",
  "weewxVersion":"3.9.1",
  "stats": {
    "current": {
      "outTemp":"89.2°F",
      "windchill":"89.2°F",
      "heatIndex":"105.0°F",
      "dewpoint":"79.0°F",
      "humidity":"72%",
      "insideHumidity":"66%",
      "barometer":"30.164 inHg",
      "barometerTrendDelta":"3 hours",
      "barometerTrendData":"0.023 inHg",
      "windSpeed":"12 mph",
      "windDir":"295°",
      "windDirText":"WNW",
      "windGust":"17 mph",
      "windGustDir":"294°",
      "rainRate":"0.00 in/hr",
      "pondTemp":"77.5°F",
      "insideTemp":"76.6°F"

    },
   "sinceMidnight": {
      "rainSum":"0.00 in",
      "maxtemptoday":"89.6°F",
      "mintemptoday":"78.4°F",
      "maxinsidetemptoday":"76.6°F",
      "mininsidetemptoday":"71.8°F"
}
},

  "almanac":{
    "sun":{
      "sunrise":"06:33:48",
      "sunset":"20:17:31"
    },
    "moon":{
      "phase":"Waxing crescent",
      "fullness":"23%"
    }
  }
}

It's already being parsed as a string.
attribute "rain_rate", "string"

How is it showing after it's parsed ? Oh and do you have Show Units turned on ? If so turn it off.

I need it parsed as an integer. How would I do that?

If the json contains a string (they usually do) then you would need to strip off the unit, convert the string to an integer and change the attribute to present a number instead of a string

No idea how to even begin to do that

If I ever get around to finding time to look at this driver, then I’ll fix everything that is wrong with it.
I’m really struggling atm to get to it.

1 Like