[UPDATED] Weewx Weather Driver With External Forecasting

community_driver

#162

I had not touched Groovy before (I am Python and Perl person :slight_smile: among other things ) but I do not see fcode defined anywhere as in
dewpointRaw1 = dewpointRaw1.replace(fcode, "")


#163

def getFcode(){
def charF1 ="&-#-1-7-6-;-F"
def charF = charF1.replace("-", "")
return charF
}

As HE is web based, you can't just use the ascii code you need to 'fudge' it a bit and add some stuff then remove it again :slight_smile:


#164

Was trying to make some code changes to see if I can figure out what the issue is, however for the life of me can not figure out how to make changes to take effect...
I would save changes in IDE screen, and save device, save properties.
Do I need to delete the driver and reinstall with new changes?


#165

Not normally no.
I made driver/app changes all the time without reinstalling
Usually just saving is enough.
After saving did you ‘poll’?


#166

Thank you. Just saving works.
Also it seems that daily.json from the weewx has an extra unocde char in temperature fields that has to be accounted for:

{
"title":"Current Values",
"location":"Ada, MI",
"time":"02/12/2019 09:20:00 PM",
"lat":"42° 58.21' N",
"lon":"085° 33.40' E",
"alt":"830 feet",
"hardware":"AcuRite 01536",
"uptime":"1 day, 4 hours, 51 minutes",
"serverUptime":"3 days, 2 hours, 54 minutes",
"weewxVersion":"3.8.2",
"stats": {
"current": {
"outTemp":"28.4°F",
"windchill":"28.4°F",
"heatIndex":"28.4°F",
"dewpoint":"28.2°F",
"humidity":"99%",
"insideHumidity":" N/A",
"barometer":"29.976 inHg",
"barometerTrendDelta":"3 hours",
"barometerTrendData":"0.012 inHg",
"windSpeed":"1 mph",
"windDir":"280°",
"windDirText":"W",
"windGust":"2 mph",
"windGustDir":" N/A",
"rainRate":"0.00 in/hr",
"insideTemp":"63.0°F"

},

"sinceMidnight": {
"rainSum":"0.00 in",
"maxtemptoday":"31.8°F",
"mintemptoday":"23.7°F",
"maxinsidetemptoday":"64.1°F",
"mininsidetemptoday":"61.6°F"
}
},

"almanac":{
"sun":{
"sunrise":"08:19:51 PM",
"sunset":"06:44:07 AM",
},
"moon":{
"phase":"First quarter",
"fullness":"48%"
}
}
}


#167

There is a problem with daily.json.tmpl from Hubitat/daily.json.tmpl at master · CobraVmax/Hubitat · GitHub

line 85
#else
"sun":{
"sunrise":"$almanac.sunrise",
"sunset":"$almanac.sunset",
},
"moon":{
"phase":"$almanac.moon_phase",
"fullness":"$almanac.moon_fullness%"
}
#end if

replace with

#else
"sun":{
"sunrise":"$almanac.sunrise",
"sunset":"$almanac.sunset"
},
"moon":{
"phase":"$almanac.moon_phase",
"fullness":"$almanac.moon_fullness%"
}
#end if

Also degree symbol can be sneaky Degree symbol - Wikipedia


#168

The daily.json.tmp was not saved in UTF-8 so those odd characters are because of that.

Andy needs to correct that :slight_smile:


#169

Removing extra comma in daily.json.tmpl (see previous comment) and replacing function cal to fcode with unicode search string solved double °F°F issue

ex: temperatureRaw1 = temperatureRaw1.replace("\u00B0F", "")


#170

@Cobra Thanks for this. BTW, line 85 in the template file (Hubitat/daily.json.tmpl at master · CobraVmax/Hubitat · GitHub) shouldn't have a comma after it. Only reason I found out is because php's json_decode wouldn't accept it. Let me know if I need to do a pull request; figured it'd be easier to just tell you here.


#171

Any suggestions on fixing this issue?
Screen%20Shot%20on%202019-03-06%20at%2019%3A35%3A47


#172

Edit daily.json.tmp and correct the symbol and save the file as UTF-8

Are you using my weewx extension ?


#173

The template file doesn't have the symbol; it's coming from Weewx I believe:

I've already added a version of this to all the temp vars in the code:
temperatureRaw1 = temperatureRaw1.replace("\u00B0F", "")


#174

strange and you are using 3.9.1 ??


#175

Yes


#176

I have seen other issues with weewx and output values.... I wonder if it's the WS console that is actually setting this on output and not weeWX doing it.

My Ambient WS2902A doesn't do this.


#177

I believe wee was gets formatting information weewx.conf file to format variables. For some things like outTemp you can specify them in the .tmpl file as $current.outTemp.raw and get the actual value.


#178

Thanks. I tried to change them to raw, some worked, some didn’t. Looks like the almanac temps worked. I’ll keep messing.

@weewx:/etc/weewx/skins/Hubitat# diff daily.json.tmpl daily.json.tmpl.orig 15,18c15,19 < "outTemp":"$current.outTemp.raw", < "heatIndex":"$current.heatindex.raw", < "dewpoint":"$current.dewpoint.raw", < "humidity":"$current.outHumidity.raw", > "outTemp":"$current.outTemp", > "windchill":"$current.windchill", > "heatIndex":"$current.heatindex", > "dewpoint":"$current.dewpoint", > "humidity":"$current.outHumidity", 30c31


#179

My mistake, try ".formatted" rather than ".raw" that might give you the formatted number without the label.


#181

So I know enough about Linux to break stuff so I'm not surprised I'm having issues. I wiped a clean RPi and installed weewx with my Vantage Pro and all that ran smoothly. The station is reporting weather via 192.168.1.20/weewx

I created a daily.json.tmpl in /etc/weewx/skins/Standard
I added this code to /etc/weewx/skins/skin.conf
[[[json]]]
template = daily.json.tmpl

I restarted the service but for some reason I'm not getting a valid daily.json output.

404 Not Found error

The requested URL /weewx/daily.json was not found on this server.

I'm not sure what to check next, any help would be appreciated!


#182

Welcome to the Hubitat Community!

I'll apologize in advance. It's been a while since I set mine up. I do recall something about needing to have that template at the www root.

Layout

The installation will place WeeWX in the /home/weewx directory with the following layout:

executable: /home/weewx/bin/weewxd
configuration file: /home/weewx/weewx.conf
skins and templates: /home/weewx/skins/
sqlite databases: /home/weewx/archive/
generated web pages and images: /home/weewx/public_html/
documentation: /home/weewx/docs/
examples: /home/weewx/examples/
utilities: /home/weewx/bin/