maxwellhadley / node-red-contrib-rfxcom

node-RED nodes to access an RFXtrx433 transceiver
BSD 2-Clause "Simplified" License
22 stars 13 forks source link

Support for Oregon PCR800 rain gauge #18

Closed Bjsulla closed 6 years ago

Bjsulla commented 6 years ago

Would it be possible to add support for the Oregon PCR800 Rain Gauge? This is a sample output from RFXmngr: Packettype = RAIN subtype = RAIN2 - PCR800 Sequence nbr = 4 ID = 8600 decimal:34304 Rain rate = 20,62 mm/h Total rain = 148 mm Signal level = 7 -64dBm Battery = OK

Please let me know if I can be of assistance (BTW the Maverick ET-732 code works beautifully) Regards / Bjorn

maxwellhadley commented 6 years ago

The PCR800 should already be supported. Use an rfx-sensor-in node, set to listen to 'RAIN2' topics (or just any topic). You will need to enable reception of the Oregon protocol in the RFXtrx433E, best done using RFXCOM's rfxmgr program on your PC.

Bjsulla commented 6 years ago

I am already seeing the Oregon wind sensor WGR800 and two Oregon temp/humidity THGR810 with no problems using the sensor node. However I receive no information from the rain gauge unless I connect it directly to RFXmngr.

Not being experienced enough but I looked at the code and it seems that it is expecting a property called "rainfall" but this is seems to be reported as "Rain rate" instead by the PCR800. Could this be a problem?

maxwellhadley commented 6 years ago

That shouldn't be an issue, as the property names used in node-rfxcom are not exactly the same as the ones used by RFXmgr. I've checked consistency between node-red-contrib-rfxcom & node-rfxcom and the event property names all match. Could you possibly send me a copy of the hexadecimal data from a packet received by RFXmgr? That might help

Bjsulla commented 6 years ago

Sure but I can't find any way to tell RFXmngr to show the hexadecimal data. Could you please tell me how to do that?

maxwellhadley commented 6 years ago

Actually there isn't a way - you have to be running the developer version of RFXmgr that comes with the SDK - sorry about that! As an alternative, you can tell node-RED to run node-rfxcom in debug mode, in which mode it will write each message it receives to the console. To do this, stop node-RED, create an environment variable called RED_DEBUG with value "rfxcom", then restart Node-RED from the command line. You should see a series of debug messages appear. On my test system, I get this:

[rfxcom] on /dev/tty.usbserial-A1R1A6A - Sent    : 0D,00,00,00,00,00,00,00,00,00,00,00,00,00
[rfxcom] on /dev/tty.usbserial-A1R1A6A - Sent    : 0D,00,00,01,02,00,00,00,00,00,00,00,00,00
[rfxcom] on /dev/tty.usbserial-A1R1A6A - Received: 14,01,00,01,02,53,11,00,00,27,00,01,03,1C,03,00,00,00,00,00,00
[rfxcom] on /dev/tty.usbserial-A1R1A6A - Sent    : 0D,00,00,02,07,00,00,00,00,00,00,00,00,00
Device initialised
[rfxcom] on /dev/tty.usbserial-A1R1A6A - Received: 14,01,07,02,07,43,6F,70,79,72,69,67,68,74,20,52,46,58,43,4F,4D
[rfxcom] on /dev/tty.usbserial-A1R1A6A - Copyright RFXCOM
[rfxcom] on /dev/tty.usbserial-A1R1A6A - Started command message queue
[rfxcom] on /dev/tty.usbserial-A1R1A6A - Received: 0B,11,00,00,00,1E,F1,CE,01,01,0F,70

The last line is a received message from a HomeEasy remote control. A received message from the Oregon rain sensor should look like:

[rfxcom] on /dev/tty.usbserial-A1R1A6A - Received: 0B,55,02,17,B6,00,00,00,00,4D,3C,69

Where the important things are the second & third bytes: 0x55 = packet type rain, and 0x02 = subtype RAIN2 (Oregon PCR800). This debug output should appear even if the message is not being handled properly. Let me know what bytes you see, and I will replay them through my test system and see if they are being handled correctly or not.

Bjsulla commented 6 years ago

I captured a few of them. The first four lines should be with no rainfall reported and the last three with some rainfall simulated. Let me know if this helps.

[rfxcom] on /dev/ttyUSB0 - Received: 0B,55,02,06,86,00,00,00,00,06,DD,79
[rfxcom] on /dev/ttyUSB0 - Received: 0B,55,02,1E,86,00,00,00,00,06,DD,79
[rfxcom] on /dev/ttyUSB0 - Received: 0B,55,02,2D,86,00,00,00,00,06,DD,79
[rfxcom] on /dev/ttyUSB0 - Received: 0B,55,02,4A,86,00,00,00,00,06,DD,79
[rfxcom] on /dev/ttyUSB0 - Received: 0B,55,02,6F,86,00,60,C7,00,07,13,79
[rfxcom] on /dev/ttyUSB0 - Received: 0B,55,02,87,86,00,1A,8F,00,07,3E,69
[rfxcom] on /dev/ttyUSB0 - Received: 0B,55,02,97,86,00,1A,8F,00,07,3E,69
maxwellhadley commented 6 years ago

OK I'll take a look - may be a few days though...

maxwellhadley commented 6 years ago

I have just published version 1.4.1 to npm, which should now work. Please can you confirm, and if it is OK I will close this issue. A silly little copy-and-paste bug.

Bjsulla commented 6 years ago

Thank you! I'm on vacation but I will try it out next week and report back.

Bjsulla commented 6 years ago

Yes now it is working. Thank you!

{ "topic": "RAIN2/0x8600", "status": { "rssi": 7, "battery": 9 }, "payload": { "rainfall": { "total": { "value": 256.5, "unit": "mm" }, "rate": { "value": 64.31, "unit": "mm/hr" } } }, "_msgid": "553878d9.26b838" }

maxwellhadley commented 6 years ago

That is very heavy rainfall you have there!!!