I have created an extension, FilePile <https://github.com/tkeffer/filepile>, that automates a lot of this. You specify what unit system your incoming data is in, and it will automatically convert it to the unit system used by the incoming record.
Take a look at the README and see if everything is clear. -tk On Sat, Feb 2, 2019 at 4:33 AM John Masters <jbertmast...@gmail.com> wrote: > > Yes Folks, > > @Gary, that's explained a likely cause, thanks for taking the time to > investigate. Something like the Mars Climate Orbiter, but a lot less > critical! > > @tk, Yes, but i want to put to bed the idea that my temperature sensor is > randomly switching from degrees_F to degrees_C by itself. > The sensor is a DS18B20 1wire connected to a remote RPi. It outputs a > number which can be interpreted by humans to be a temperature reading. It > is just a number, with no units attached. > A script reads this number and inserts it into a MySQL database, which is > read by php into a graph (see attached pondgraph.jpg). As you can see, the > temperature is natively and continuously in degrees_C. > > The script also writes the number to a plain file, pond.txt, which is > scp'd every 5 mins to /var/tmp/pond.txt on the Rpi that hosts weewx. It is > only a number, with no formatting. > pondservice.py then does it's thing with the number in pond.txt. > > When i initially saw that something was going wrong with the resulting > extraTemp1, and that degrees_C was being interpreted as degrees_F, i wrote > a conversion into my script so that the number inserted into pond.txt could > be sent as degrees_F. All that means is that pond.txt contains e.g. instead > of the number 10 (degrees_C), the number 50 (its Fahrenheit equivalent). > It is only I who makes that change, by commenting out the conversion in my > script. See the attached daypond.jpg > > Daypond shows pond temperature being sent as a degrees_F number (just a > plain text number) up until point 1, when i restarted weewx a few times to > capture the logs that i attached to my post last night, as @Andrew > suggested. > Point 2 shows where i commented out the conversion part of my script and > sent pond temperature as a degrees_C number (again, just a plain text > number, no units attached), and restarted weewx a couple of times to > capture more logs, and then let it run like that for a while. > Point 3 shows where i uncommented the conversion part of my script, and > continued sending as a degrees_F value, with no restart. > At no time did i change any other values or settings. > Every time the file is scp'd there is an entry in the syslog on the remote > RPi, and the values sent do not change from Degree_C to degrees_F unless i > comment or uncomment the conversion line in my script, > > If i send pond.txt as degrees_F, there is an initial high reading where > the Fahrenheit number is interpreted as degrees_C, but subsequent readings > are converted and shown as degrees_C. (e.g. the number 50 in pond.txt is > initially interpreted as 50 degrees_C in the REC packet, but subsequently > converted to 10 degrees_C) > If i send pond.txt as degrees_C, the number is interpreted as its > Fahrenheit equivalent. (so if pond.txt contains the number 10, it is > interpreted as 10 degrees_F) > > If you follow the Wiki https://github.com/weewx/weewx/wiki/add-sensor and > install pondservice.py, and create /var/tmp/pond.txt and put any number in > it, you should see the problem > > Phew, you'll all be sick of all this by now, but i hope i have made it > more clear. > > Regards > John > > -- > You received this message because you are subscribed to the Google Groups > "weewx-user" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to weewx-user+unsubscr...@googlegroups.com. > For more options, visit https://groups.google.com/d/optout. > -- You received this message because you are subscribed to the Google Groups "weewx-user" group. To unsubscribe from this group and stop receiving emails from it, send an email to weewx-user+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.