WMR88 + 3 temp sensors (THGR810)

994 views
Skip to first unread message

Graham Davies

unread,
Feb 26, 2013, 2:57:59 PM2/26/13
to weewx...@googlegroups.com
Hi - I'm getting good data from my WMR88 to a raspberry pi using weewx - many thanks!

My question is that I've got 3 temp / humidity sensors (THGR810) rather than the more traditional pond / UV / etc.  So far I've managed to edit the templates and skins.conf to add some of the extra data but I'm a bit stuck with some of the historic data and graphs.

My weewx.sdb file includes the following data by example:

1361907600|16|5||1026.0|1034.64512558988|20.6|3.3|40.0|82.0|0.977142857142857|67.5|4.32|67.5|0.0|0.0|0.524538703591275|3.3|3.3|||||9.4|10.3||||||||69.0||||||||||||||||0.0|0.0|0.0|0.0

But looking at stats.sdb it seems that not all the necessary tables are present, and those that are there are currently empty.  For example:

sqlite> select * from extraTemp1;
1361836800|||||0.0|0

This is because the WMR88 insists that outside temp is channel 1 so extraTemp1 doesn't include any data and my other two sensors are extraTemp2 and 3.

This means that I can hack the index template to show data in the table if I use #if $current.extraTemp2.has_data but not #if $day.extraTemp2.has_data.  It also means that I can't generate graphs of the 2nd and 3rd sensors.

Ideally I'd like to be able to graph inTemp, outTemp, extraTemp2, extraTemp3 on one graph and in, out, extra2, extra3 humidity on another.

The other issue is that there is no barometer data stored in stats.sdb but pressure data is available in the current weewx.sdb table.  

Any help greatly appreciated.

Thanks,
Graham




Thomas Keffer

unread,
Feb 26, 2013, 7:14:38 PM2/26/13
to weewx...@googlegroups.com
Hi, Graham
You didn't include the schemas, but I am assuming that you are using the default archive and stats schemas. If that's the case, the problem is two fold.

First, I probably did not choose the best mappings for extra sensors for the WMR drivers. As you note, channels 2 and 3 are getting mapped to 'extraTemp2' and 'extraTemp3', when it really should be 'extraTemp1' and 'extraTemp2'.  Same with the channel 2 and 3 humidity.

If you're willing to throw away the data you have so far, I've enclosed a modified version of the driver that output

Channel 2: extraTemp1 and extraHumid1
Channel 3: extraTemp2 and extraHumid2

So far so good, but there is a second problem and that there is no slot in the stats database for extraTemp2, extraHumid1, and extraHumid2. You will have to add these. Here's how. Go into the file bin/user/schemas.py and edit the lines 

stats_types = ['barometer', 'inTemp', 'outTemp', 'inHumidity', 'outHumidity', 
               'rainRate', 'rain', 'dewpoint', 'windchill', 'heatindex', 'ET', 
               'radiation', 'UV', 'extraTemp1', 'rxCheckPercent', 'wind']

to read:

stats_types = ['barometer', 'inTemp', 'outTemp', 'inHumidity', 'outHumidity', 
               'rainRate', 'rain', 'dewpoint', 'windchill', 'heatindex', 'ET', 
               'radiation', 'UV', 'extraTemp1', 'extraTemp2', 'extraHumid1', 'extraHumid2', 'rxCheckPercent', 'wind']

I've highlighted the addition in red.

Once you've replaced the driver, stop weewx, delete your old weewx.sdb and stats.sdb files, then restart weewx. Unfortunately, this will cause you to lose any data you already have. If you have a lot of data and really don't want to do that, you could dump the weewx.sdb database, edit the INSERT names and restore to the corrected names. 

As for the missing barometer data --- read the manual, section No barometer data.

-tk





--
You received this message because you are subscribed to the Google Groups "Weewx user's group" group.
To unsubscribe from this group and stop receiving emails from it, send an email to weewx-user+...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.
 
 



--
Tom Keffer
kef...@threefools.org
+1 541-386-8891 (h)
+1 541-490-9507 (c)
Skype: tkeffer
wmrx.py

Graham Davies

unread,
Feb 27, 2013, 3:18:06 PM2/27/13
to weewx...@googlegroups.com
Hi Tom,

Really appreciate your quick response on this - many thanks.  I've implemented your suggestions and everything seems to be working as you suggest.  I'll play around with the skins files a bit more but it looks like the extra sensors are now being recorded in the stats database.

Thanks again for this and your excellent work in writing and supporting the code.

Regards,
Graham

wysiwyg

unread,
Mar 31, 2013, 3:49:01 AM3/31/13
to weewx...@googlegroups.com
Hello, on My side I have added a swimming pool temp sensor on wmr88 + raspberrypi.
I was do able to get the measurements while I can see it on the station screen.

I removed the if On the pond temp in the standard template.
Following this discussion I tried to add also current.extratemp2 & 3.
but I get only N/A for the 3 value $current.extratemp1,2,3.
Did I miss something to enable extra measurements?

wysiwyg

unread,
Mar 31, 2013, 4:42:17 AM3/31/13
to weewx...@googlegroups.com
Sorry, I meant "I was not able to get the measurement", not "I was do able". (my tablet keyboard, decided for me...)



Le dimanche 31 mars 2013 09:49:01 UTC +2, wysiwyg a écrit:
Bonjour, De mon côté, j'ai ajouté un capteur de température piscine sur wmr88 + raspberrypi.
J'ai été en mesure de faire obtenir les mesures alors que je peux le voir sur l'écran de la station. J'ai enlevé le cas sur la température de l'étang dans le modèle standard. Après cette discussion, j'ai essayé d'ajouter également current.extratemp2 et 3. mais je reçois seulement N / A pour la valeur 3 current.extratemp1 $, 2,3. Ai-je raté quelque chose pour permettre des mesures supplémentaires? Le mercredi 27 février 2013 21:18 : 06 UTC +1, Graham Davies a écrit: > Salut Tom, > > > Vraiment vous remercie de votre réponse rapide sur ce point - merci beaucoup. J'ai mis en place vos suggestions et tout semble fonctionner comme vous le suggérez. Je vais jouer avec les peaux dépose un peu plus, mais il semble que les capteurs supplémentaires sont maintenant enregistrées dans la base de données statistiques. > > > Merci encore pour cela et votre excellent travail par écrit et en soutenant le code. > > > Regards , > Graham




















Thomas Keffer

unread,
Mar 31, 2013, 7:48:29 PM3/31/13
to weewx-user
Hello.

Are you using the WMR100 driver? If so, what version of weewx are you running?

There was an earlier problem with archiving extra sensors with the WMR100 driver, but this was fixed a while ago.

-tk


--
You received this message because you are subscribed to the Google Groups "Weewx user's group" group.
To unsubscribe from this group and stop receiving emails from it, send an email to weewx-user+...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


wysiwyg

unread,
Apr 1, 2013, 4:20:37 AM4/1/13
to weewx...@googlegroups.com
Hello
I am using the wmr100 driver (is there an other one for WMR88?) The station is working with all sensors I had with (wind, rain, outside/inside temp/humidity, barometer).

2 days ago I added this swimming pool sensor that oregon scientific make (THWR800). I set it to channel 2.

On the station screen, I have on channel1 the ouside temp/humidty sensor.
On the channel 2 I have the added pool sensor : it shows only water temperature, there are no humidity data on station screen (only "--" replace humidity). I guess swimming pool humidity is not interesting data :-)).

My weews version is v2.2.1.

regarding the template, I remove the "if" on the pond temperature section and just in case, I added $current.extratemp1, 2 and 3.

3 are N/A.

Thomas Keffer

unread,
Apr 1, 2013, 10:13:50 AM4/1/13
to weewx-user
Could you add the following patch to your driver wmrusb.py?

Index: bin/weewx/wmrx.py
===================================================================
--- bin/weewx/wmrx.py (revision 1137)
+++ bin/weewx/wmrx.py (working copy)
@@ -274,6 +274,7 @@
         if packet[4] & 0x80 : T = -T
         R = float(packet[5])
         channel = packet[2] & 0x0f
+        print "Temperature channel=", channel, "T=", T, "R=", R
         if channel == 0:
             _record['inTemp']      = T
             _record['inHumidity']  = R

What this will do is print out the raw channel number, temperature, and humidity from the data packets.

You will have to run weewx from the console (NOT as a daemon). See what it prints out on the console.

-tk

wysiwyg

unread,
Apr 1, 2013, 11:52:16 AM4/1/13
to weewx...@googlegroups.com
Hello,

1st, I had some error messages like this:
pi@raspberrypi /usr/share/weewx $ weewxd /etc/weewx/weewx.conf
Traceback (most recent call last):
 
File "/usr/bin/weewxd", line 71, in <module>
    weewx
.wxengine.main(options, args)
 
File "/usr/share/weewx/weewx/wxengine.py", line 838, in main
    engine
= EngineClass(config_dict)
 
File "/usr/share/weewx/weewx/wxengine.py", line 61, in __init__
   
self.setupStation(config_dict)
 
File "/usr/share/weewx/weewx/wxengine.py", line 82, in setupStation
    __import__
(driver)
 
File "/usr/share/weewx/weewx/wmrx.py", line 284
   
if channel == 0:
   
^
IndentationError: unexpected indent
pi@raspberrypi
/usr/share/weewx $

 I tried to add some ():
print ("Temperature channel=", channel, "T=", T, "R=", R)

And it worked well.

I have plenty of messages from channel 0 & 1 but not others (while my station screen still report channel 2.

Messages were like this:
     
('Temperature channel=', 0, 'T=', 19.6, 'R=', 44.0)
('Temperature channel=', 1, 'T=', 10.0, 'R=', 88.0)

I had alos many LOOP messages with other data.

On my side, I also tried yesterday some syslog command and use weewx daemon.
syslog.syslog(syslog.LOG_ERR, "wmrx: Fred test T %s" % T)
syslog.syslog(syslog.LOG_ERR, "wmrx: Fred test ch %s" % channel)
syslog.syslog(syslog.LOG_ERR, "wmrx: Fred test H %s" % R)

it is a little bit sorcerer apprentice as I have no python knowledge at all, but, I also get only channel 0 & 1 (inside / outside temp)


I am wondering if the THWR800 has maybe different frame as it sense only temp but not humidity
This is only hypothesis if humidity is a NULL value of whatever, is there some reason that the wmrx.py would filter it?

 
       
       




       
       
               
               

Thomas Keffer

unread,
Apr 1, 2013, 4:36:22 PM4/1/13
to weewx-user
It's sure looking like the WMR88 doesn't report extra temperature and humidity sensors at all. They may be showing up on the console, but they don't seem to be appearing in the data packets.

Make sure you watch long enough. I've found with the WMR100 that it can take 10 minutes before some of the data shows up.

-tk


--
You received this message because you are subscribed to the Google Groups "Weewx user's group" group.
To unsubscribe from this group and stop receiving emails from it, send an email to weewx-user+...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.
 
 

wysiwyg

unread,
Apr 1, 2013, 5:14:29 PM4/1/13
to weewx...@googlegroups.com
I will try longer time (I think it was about 10 minutes, but cannot be sure.

Do you think I could use
syslog.syslog("Temperature channel=", channel, "T=", T, "R=", R)

The station is running on a raspberry pi but not at my place, I use ssh access. syslog could be easier for long check.

I dont know python, so I am not sure of the syntax for my syslog suggestion.

Best regards,

wysiwyg

unread,
Apr 1, 2013, 6:45:39 PM4/1/13
to weewx...@googlegroups.com
Hello ,
Just a couple of extra info:
accordingto this wview user, wmr88 report the pool sensor on usb but wview (like weewx) does get it.

I found a document about Oregon protocol :
http://wmrx00.sourceforge.net/Arduino/OregonScientific-RF-Protocols.pdf
It talk about thwr800 Page 10 and 11
It look like ID is different and it is shorter frame without humidity

wysiwyg

unread,
Apr 1, 2013, 7:29:34 PM4/1/13
to weewx...@googlegroups.com
Hi again,
I think I get closer.
I compared the IDs from the wmrx00 document from my previous post with wmrx.py dispatch dictionnary.
When considering the document, you can see for instance rain sensor ID: 2914.
this 14 gives 41 in wmrx.py dispatch dict.
It same for many sensors: temp/RH is F824,this 24 gives 42 in wmrx.py etc...

Swimming pool sensor is id c844 which shall give 44 in dispatch dict,but it is missing !
That may explain why we saw nothing with previous debug!!
!

Thomas Keffer

unread,
Apr 1, 2013, 10:00:17 PM4/1/13
to weewx-user
Hello,

You're almost correct. Try (NOT TESTED):

syslog.syslog(syslog.LOG_NOTICE, "Temperature channel=%d; Temperature=%f, Humidity=%f" % (channel, T, R))

-tk

wysiwyg

unread,
Apr 2, 2013, 3:57:30 AM4/2/13
to weewx...@googlegroups.com
Hello,
Thank for the syslog suggestion.
I added it and get only channel 0& 1 (running about 1h30).

Following my idea, I added also the following in wmrx.py (added line are the 3 last ones in bold:
def genLoopPackets(self):
       
"""Generator function that continuously returns loop packets"""

       
# Get a stream of raw packets, then convert them, depending on the
       
# observation type.

       
for _packet in self.genPackets():
            _packet_type
= _packet[1]
           
if _packet_type in WMR_USB._dispatch_dict:
                _record
= WMR_USB._dispatch_dict[_packet_type](self, _packet)
               
if _record is not None :
                   
yield _record
           
elif _packet_type == 0x44:
                T
= (((_packet[4] & 0x7f) << 8) + _packet[3])/10.0
                syslog
.syslog(syslog.LOG_NOTICE, "Packet44 Temperature=%f" % T)

I get about 40 lines like:
Apr  2 08:22:45 raspberrypi weewx[7136]: Packet44 Temperature=19.700000

(with 19.7 or 19.6 °C).

Can you confirm my added code looks right ? I get it by copy paste from other part of the code but I 'm not fully sure about it.

I you confirm, I really think we have to process a packet 0x44 to get my pool temp.
Message has been deleted

wysiwyg

unread,
Apr 2, 2013, 8:05:07 AM4/2/13
to weewx...@googlegroups.com
I have modified my syslog test to add channel number (4 last lines)

def genLoopPackets(self):
       
"""Generator function that continuously returns loop packets"""

       
# Get a stream of raw packets, then convert them, depending on the
       
# observation type.

       
for _packet in self.genPackets():
            _packet_type
= _packet[1]
           
if _packet_type in WMR_USB._dispatch_dict:
                _record
= WMR_USB._dispatch_dict[_packet_type](self, _packet)
               
if _record is not None :
                   
yield _record
+            elif _packet_type == 0x44:
+                T = (((_packet[4] & 0x7f) << 8) + _packet[3])/10.0
+                channel = packet[2] & 0x0f
+                syslog.syslog(syslog.LOG_NOTICE, "Packet44 Ch:%d Temperature=%f" % (channel, T))

I have now some line like this in syslog:

Apr  2 13:55:15 raspberrypi weewx[7940]: Packet44 Ch:2 Temperature=19.200000

So this should be the right sensor.


Tom,
do you think I can simply:
- cut and paste the bloc  def _temperature_packet(self, packet):
- rename it as "_temperature_only_packet"
- modify it so that Humidity and other unavailable data are filled with dummy values (instead of trying to read the packed).
- add 0x44 in dispatch dictionnary so that it is connected with the new "_temperature_only_packet"

Then, in case of using swimming pool sensor on channel x, it shall be available in extratempx (extrahumidx will be set to dummy value).
If mixing with standard sensors, channel number shall discriminate if we go through temperature_packet or temperature_only_packet.

This is max I think I can do (considering I read my first python code by discussing in this topic)

What do you think ? (maybe I missed a lot of critical things).







wysiwyg

unread,
Apr 2, 2013, 2:40:45 PM4/2/13
to weewx...@googlegroups.com
Ok, here is my trial:

I copy paste def _temperature_packet function, named it _temperatureonly_packet, added 0x44 in dispatch dictionnary and it works !!

the pool temp get out on extratemp2.

There is probably some remaining debug syslog lines in the file.





wmrx.py

Thomas Keffer

unread,
Apr 2, 2013, 3:09:44 PM4/2/13
to weewx-user
Right now I'm away from my office until Wednesday night, but it seems like you're on the right track.

Just out of curiosity, how did you find out that the extra sensor data was in packet type 0x44?

-tk

wysiwyg

unread,
Apr 2, 2013, 4:48:05 PM4/2/13
to weewx...@googlegroups.com
Hello,

there are some details in some of my previous posts.
it comes from this document:
http://wmrx00.sourceforge.net/Arduino/OregonScientific-RF-Protocols.pdf

I have searched my sensor (THWR800) in  it and found a corresponding ID C844.
I compared other sensors ids from this document with dispatch dictionnary from wmrx.py.

it was looking like temperature sensor with humidity was F824 in the document and 42 in your wmrx.py
I made same comparison with other sensors and found that 2 last digit of IDs from document was same as dispatch dictionnary but reversed : 24 become 42 etc...

wysiwyg

unread,
Apr 3, 2013, 1:50:32 AM4/3/13
to weewx...@googlegroups.com
By the way Tom,
What are the conditions to set ".has_data" ?

My pool temp is well displayed with $current.extraTemp2.
daypond.png also works since I modified skin.conf to have extraTemp2 in it but $day.extraTemp2.has_data remain to false.

Tom Keffer

unread,
Apr 15, 2013, 12:51:30 PM4/15/13
to weewx...@googlegroups.com
I finally had a chance to look at the version of wmrx.py that you sent along.

Looks pretty good. I made a few minor changes (mostly, got rid of the humidity and dewpoint calculations --- better to leave them unspecified, than to hardwire humidity to 100%) and checked it into SourceForge.

My copy is attached.

-tk
wmr100.py

Frederic Stuyk

unread,
Apr 16, 2013, 3:34:22 AM4/16/13
to weewx...@googlegroups.com
Hello,
Thank for you review !
That was newbie job, I tried to modify as less as possible.
Can I update with your version without any risk? (now I have it running with some "100%" humidity data.

I guess I will have to change from extratemp2 to extratemp1 if I read your code correctly?

Will you integrate this in the next weewx update?






2013/4/15 Tom Keffer <tke...@gmail.com>
--
You received this message because you are subscribed to a topic in the Google Groups "Weewx user's group" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/weewx-user/NJ-S8-TyvRE/unsubscribe?hl=en-US.
To unsubscribe from this group and all its topics, send an email to weewx-user+...@googlegroups.com.

Thomas Keffer

unread,
Apr 16, 2013, 10:23:14 AM4/16/13
to weewx-user
Frederic,

No, you cannot do a simple substitution of my version for your version for two reasons:
  1. The signature of the function loader() is slightly different;
  2. The name of the module has changed (from wmrx.py to wmr100.py)
Yes, the extra sensor will now appear as extraTemp1.

These changes will appear in the next weewx update.

-tk


--
You received this message because you are subscribed to the Google Groups "Weewx user's group" group.
To unsubscribe from this group and stop receiving emails from it, send an email to weewx-user+...@googlegroups.com.

For more options, visit https://groups.google.com/groups/opt_out.
 
 

wysiwyg

unread,
Jul 31, 2013, 6:04:26 AM7/31/13
to weewx...@googlegroups.com
Hello !
It's a looong time I didnt post here, I still have an issue with my pool sensor.

current.extratemp2 is working as well as graphs but:  day.extratemp2.has_data, as well as max/min/maxtime/mintime does not work (same for week/month/year)

The funny thing is that cheetah just display the labels as they are in my template: $week.extraTemp2.max at $week.extraTemp2.maxtime
$week.extraTemp2.min at $week.extraTemp2.mintime.
I though it would raise en error in syslog...

Are these issues corrected in your update and is this update integrated in the last weewx 2.3.3 ?

(I kept my modified 2.2.1 at the moment, the station is at my parents place and I do not dare to make this update using SSH access)

Thomas Keffer

unread,
Jul 31, 2013, 10:11:42 AM7/31/13
to weewx-user
Hello,

(The correct labels are $week.extraTemp2.max --- note the capital 'T'. I'm assuming what you wrote below was just a typo)

By default, "extraTemp2" (and 3) are not included in the stats database. You have to add them to bin/user/schemas.py then rebuild the stats database by deleting it and letting weewx regenerate it.

-tk


Reply all
Reply to author
Forward
0 new messages