¿ªÔÆÌåÓý

Re: Weewx to Direwolf


 

Fortran, haven't thought about that since engineering school (long ago).? Well maybe a touch with antenna modeling, but not really.

I am not a fan of switching 100% to Zero.? Makes no sense to me.
However, in this case it makes less sense.? You set a real value to zero, then not save the report because it IS zero?? At least at 99, the data is recorded.

Is there really a difference between 99% and 100% (can you tell)?
? Was it rounded up to report 100% in the first place?
? Reality i, EVERY value is +/- 1, so why not just report 99?

Rob KB8RCO


On Tue, Sep 28, 2021 at 19:07, Greg D
<ko6th.greg@...> wrote:
Hi Rob,

I was just hacking at it and once it seemed to be working I left it.? I should know (and do) better, as I used to actually write code for a living.? Bad coder!? No biscuit!?

The APRS spec does define 100% humidity as represented by a value of zero.? It's Bob being his usual ultra frugal self with his bytes.? I just should have added a bit more code to combine the 100% case with the writing to the file with a forced-zero value.? That's me being just a little too frugal with the code.? Including the broader range of values (negative and > 100) in the test covered for any mystery glitches that might show up, for robustness.? I just didn't think the format fix through in the context of the bad data hack, since I hadn't documented it in the code, even thought it's just two lines down.

It has been said that any programmer worth their salt can write Fortran in any language.? I think that's now proven. (*)

Greg? KO6TH

(*)? No shade intended on Fortran.? I cut my high-level programming teeth on Fortran-II on an IBM 1620.


Rob Giuliano via groups.io wrote:
I noticed the check is not as described exactly:
?? if data['outHumidity'] < 0 or 100 <= data['outHumidity']:
That's < 0 (negative) or >= 100.

What I'd suggest (not a python coder either):
??? if data['outHumidity'] < 0:
????data['outHumidity'] = 0
? if 100 < data['outHumidity']:
????data['outHumidity'] = 99
This would comply with the 2-digit humidity, and removes any negative values. ? If the values were negative, or actually zero, there would not be output because of the if statement before the file write.

Robert Giuliano
KB8RCO



On Tuesday, September 28, 2021, 04:56:51 PM EDT, J K via groups.io <kuhnje@...> wrote:


Greg,

Awesome! ?Thanks, that is something I can Siri with. That makes great sense, no humidity - not a good packet! ?I¡¯ll chew on this and get to work.

Thanks again!

11 Max Pro

On Sep 28, 2021, at 4:39 PM, Greg D <ko6th.greg@...> wrote:

?
Found the cwxn.py code that I hacked...? It's an older version (# $Id: cwxn.py 1280 2015-03-01 17:01:56Z mwall $), but perhaps still relevant.? Both changes - null records and format change - were all in the write_data routine, at the bottom of the source file.? Warning:? this was done before I knew anything about writing in Python, so there will be better / cleaner ways to do this.

Basically, I noticed that all of the bad records had a zero value for humidity in common.? Since a truly zero humidity is effectively impossible, I used that as the key for skipping writing the data.? The formatting issue was that humidity wasn't being handled right as a 2-digit number, so my D74 wasn't decoding it properly.?

I just noticed that a true 100% humidity would get rejected too, as it is represented as zero in the output, so my two fixes are kind of broken when taken together.? {sigh}? We hardly ever get 100% humidity here, so it hasn't exactly been a problem.? Wish it were (we need the rain!).? With those excuses, here's the snippet of code:
?def write_data(self, data):
??????? fields = []
??????? fields.append("%03d" % int(data['windDir']))
??????? fields.append("/%03d" % int(data['windSpeed']))
??????? fields.append("g%03d" % int(data['windGust']))
??????? fields.append("t%03d" % int(data['outTemp']))
??????? fields.append("r%03d" % int(data['hourRain'] * 100))
??????? fields.append("p%03d" % int(data['rain24'] * 100))
??????? fields.append("P%03d" % int(data['dayRain'] * 100))
??????? if data['outHumidity'] < 0 or 100 <= data['outHumidity']:
??????????? data['outHumidity'] = 0
??????? # 2-15-2019 changed humidity format to 2 digits, per spec and for Kenwood D74 compatibility
??????? fields.append("h%02d" % int(data['outHumidity']))
??????? fields.append("b%05d" % int(data['barometer'] * 10))
??????? if data['outHumidity'] > 0:
??? ??? with open(self.filename, 'w') as f:
??????????????? f.write(time.strftime("%b %d %Y %H:%M\n",
??? ??? ??? time.localtime(data['dateTime'])))
??????????????? f.write(''.join(fields))
??????????????? f.write("\n")
Hope this helps, and apologies for the kludge,

Greg? KO6TH


J K via groups.io wrote:
Hello,

Yes, all the logs look clean. ? I looked at all the syslogs, messages, kernel messages, etc, and nothing stands out. Sure, I wouldn¡¯t mind liking at your .py if you have it to see how you blocked the ones that didn¡¯t decode properly. Roughly half of the writes to wxnow aren¡¯t decoding properly, leaving 0¡¯s as values, which is causing a ¡°zigsaw¡± chart pattern. ?I¡¯m using Weewx 4.4, cwxn 0.6, and an Acurite 02064. ?Everything decodes properly for my weewx page, WU, CWOPS, etc, just doesn¡¯t get written correctly as wxnow.txt half the time by cwxn. ?I double and triple checked to make sure it wasn¡¯t from sharing a directory, trying both samba and nfs, but the share is fine, it¡¯s just not writing correctly half the time which I can monitor locally to the actual directory wxnow.txt gets saved to my cwxn. ?Thought for a second maybe it was just the RPi1B that weewx/cwxn is on just isn¡¯t fast enough, but it should be (?). ?The DireWolf and the radio itself is running on a RPi4(8GB), so that obviously fine. ?It¡¯s not being used really for anything else (yet), but one the APRS stuff is fully working, probably will use it as a SDR server too with a RTL-SDR V3, Ham-It-Up upconverter, etc. ?Have another RPi4 (4GB) with 10¡± touchscreen that I mainly use as a portable device to run CubicSDR, Xastir, etc. ?If weewx/cwxn really needs more resources, have a few extra RPi3B+¡¯s nor doing much that could be used. ?I just thought since I had a RPi1B still sitting around (first RPi I got), it¡¯s be an ok fit. ?Have more RPi¡¯s total now than I can remember and count, lll. ?Using them for all sorts of things: Kodi/Retropie for each TV, WX, ADS-B, a few AllStar nodes, SDR, PiHole, Printer server, DNS/email servers, bunch of mmdvm¡¯s, etc, etc. ?

Just at a loft why cwxn isn¡¯t decoding half the time, so sure, if your .py is conveniently by, wouldn¡¯t mind taking a look. ?Maybe cwxn just doesn¡¯t like certain Acurites (?). ?No idea, but weewx is running great. ?I have two receivers/displays for the sensor, one sends to MyAcurite and other is fir weewx.

Thanks!


11 Max Pro

On Sep 27, 2021, at 8:06 PM, Greg D <ko6th.greg@...> wrote:

?With my Acurite station, I had to filter out (not write to wxnow.txt) the bad records. I tested for humidity=0 as the indicator. I also fixed a small formatting bug with something else, where the telemetry wouldn't decode properly on my Kenwood TH-D74. I forget what it was, though. Possibly humidity of 100% or something like that. The field didn't fit.

I can probably find the source file, if needed. Let me know.

Greg KO6TH

On September 27, 2021 12:34:06 PM PDT, Travis Bully <tbully@...> wrote:
How do your Weewx logs (in debug) look?? It's been awhile since I've looked at the code but I think all the plugin does is query the database for the last readings from your weather station.? I'm wondering if you're not getting consistent data from your sensors.



On Mon, Sep 27, 2021 at 3:31 PM J K via <kuhnje=[email protected]> wrote:
I¡¯ve tried everything I could think of and still getting charts that look like a zigsaw.? I¡¯m wondering now if it just isn¡¯t creating the wxnow file fast enough.? Using just my original RPi1B for weewx since I thought it would be an ok fit as didn¡¯t anticipate it really needing a lot of resources.? I have a few RPi3B+¡¯s I guess could switch it to one of them and have a ton of RPi0W¡¯s, but it doesn¡¯t seem like it would need to much resource to just run weewx and cwnx (?).? That¡¯s the only thing I can thing of trying now.





-- This space for rent...


Join [email protected] to automatically receive all group messages.