Rain database fill errors

Please use template to report bugs and problems. Post here your questions when not sure where else to post
Only for bugs in the Domoticz application! other problems go in different subforums!

Moderators: leecollings, remb0

Forum rules
Before posting here, make sure you are on the latest Beta or Stable version.
If you have problems related to the web gui, clear your browser cache + appcache first.

Use the following template when posting here:

Version: xxxx
Platform: xxxx
Plugin/Hardware: xxxx
Description:
.....

If you are having problems with scripts/blockly, always post the script (in a spoiler or code tag) or screenshots of your blockly

If you are replying, please do not quote images/code from the first post

Please mark your topic as Solved when the problem is solved.
Post Reply
sperate
Posts: 8
Joined: Friday 13 December 2019 19:35
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Rain database fill errors

Post by sperate »

Version: 2024.7 (build 16450)
Platform : RaspberryPi
Hardware : RFLINK v1.1 R50

Hello,
I'm having problems with incorrect rain data in the database, showing exagerated and false values on the dashboard.

rain2.png
rain2.png (291.61 KiB) Viewed 162 times
rain1.png
rain1.png (51.42 KiB) Viewed 162 times
rain3.png
rain3.png (15.2 KiB) Viewed 162 times

Idon't know why those 0 or 0.1 values come to the database. Maybe they are sent from the rainmeter but I can't tell.
I would like to log every frame comming from the rainmeter and sent to domoticz by the rflink. Is it possible ?
The rainmeter probe is an Oregon Rain2 faked with a self programmed device based on OS v3 rainsesor lib from github https://github.com/deberman/OS_V3_rainsensor

Thanks for your help
User avatar
waltervl
Posts: 5361
Joined: Monday 28 January 2019 18:48
Target OS: Linux
Domoticz version: 2024.7
Location: NL
Contact:

Re: Rain database fill errors

Post by waltervl »

The first value is sent by the device, the next exactly the same values are copies of the first value as there is no new value coming from the device. So Domoticz assumes there is no change in value.

You can try to set the "only add new values" setting through menu Setup Settings, tab log history https://wiki.domoticz.com/Application_S ... og_History

Then only the really sent values are being stored.
Domoticz running on Udoo X86 (on Ubuntu)
Devices/plugins: ZigbeeforDomoticz (with Xiaomi, Ikea, Tuya devices), Nefit Easy, Midea Airco, Omnik Solar, Goodwe Solar
sperate
Posts: 8
Joined: Friday 13 December 2019 19:35
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: Rain database fill errors

Post by sperate »

Thanks for your answer !

It means incorrect data comes from the RFLINK. 2 reasons :
- Radio interferences corrupt data and RFLINK think it really receives 0 value.
- Homemade rainsesor sends 0 value beacuse of a bug in the program. But this is strange because the value then returns to normal.

The normal behaviour of my code is :
- on a power cycle the value returns to 0.
- on a counter overflow the value returns to 0 + overflow.

I'd rather think of interferences and a bad RFLINK behaviour because the problem doesn't happen evenly. It just happens sometimes without known reason. And after that everything works well for a moment (couple of weeks).

Is it possible to duplicate the serial stream comming from /dev/ttyUSB0 (RFlink) before sending it to domoticz, or make a copy of the stream to a logfile, in order to see exactly what rflink sends and at what time ?

rain3.png
rain3.png (6.17 KiB) Viewed 153 times

I understand that's rather a Linux than Domoticz question but if you or someone has the answer, it could be helpful.
Thanks
User avatar
waltervl
Posts: 5361
Joined: Monday 28 January 2019 18:48
Target OS: Linux
Domoticz version: 2024.7
Location: NL
Contact:

Re: Rain database fill errors

Post by waltervl »

Search for RF issues on this forum. Could be some other sensor is the culprit and disturbs the RF network.
You have to find the solution in better RF performance as it is difficult to filter out incorrect values (what is incorrect?).
Domoticz running on Udoo X86 (on Ubuntu)
Devices/plugins: ZigbeeforDomoticz (with Xiaomi, Ikea, Tuya devices), Nefit Easy, Midea Airco, Omnik Solar, Goodwe Solar
sperate
Posts: 8
Joined: Friday 13 December 2019 19:35
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: Rain database fill errors

Post by sperate »

HI,
I've tried my best to capture serial data comming from ttyUSB0 (RFLINK) with no success. I never thought it would be so hard to split a serial channel into two streams with regular linux commands demonized and laucnhed at startup in case of a power cycle.

I had a problem in the database this morning.
The total rain value evolved like this :

565.9
565.9
565.9
565.9
10.6
565.9
565.9

After the 10.6 value the chart showed a spike at 180mm of rain in 15 min (which is the update delay of the sensor value when no rain is detected).

Impossible to know how the 10.6 value came into the DB ... That's why I wanted to log all serial data traffic comming from the RFLINK.
With no success unfortunately.
homeJLB
Posts: 61
Joined: Tuesday 16 October 2018 23:01
Target OS: Raspberry Pi / ODroid
Domoticz version: 2024.7
Location: Belgium
Contact:

Re: Rain database fill errors

Post by homeJLB »

sperate
Posts: 8
Joined: Friday 13 December 2019 19:35
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: Rain database fill errors

Post by sperate »

You can try this;

https://unix.stackexchange.com/question ... rt-traffic

.....................................

socat is a tool to connect (nearly) everything to (nearly) everything, and tee can duplicate streams. In your use case you could connect your serial port /dev/ttyS0 to a PTY /tmp/ttyV0, then point your application to the PTY, and have socat tee out Input and Output somewhere for you to observe.

Googling "socat serial port pty tee debug" will point you to several "standard procedure" examples, one being:

Code: Select all

socat  /dev/ttyS0,raw,echo=0  \
    SYSTEM:'tee in.txt | socat - "PTY,link=/tmp/ttyV0,raw,echo=0,waitslave" | tee out.txt'
I've tried it but the virtual serial port "/tmp/ttyV0" is not available in the domoticz serial ports list.
I've tried to use "/dev/ttyV0" instead of "/tmp/ttyV0" but had to be sudo to do it (to have access to the "/dev" directory). Then changed the group setting of "/dev/ttyV0" from "tty" to "dialout" to try to copy the other /dev/tty serial ports but the virtual device "/dev/ttyV0" didn't appear in the serial devices list of Domoticz and only root(sudo) can open the port.

In fact "/tmp/ttyV0" or "/dev/ttyV0" is a symlink to "/dev/pts/1"

Stuck with that ..

I've also compiled and installed "interceptty". It seems to do the same thing : create virtual device in /dev/pts/1 symlink-it from the virtual device named for example /dev/ttyV0

But whatever I do, I can't see the symlink to the virtualserial device appear in the serial ports list of Domoticz. BTW, it is not possible to manually ovveride the the serial com port parameter (only choose from list is permitted)
sperate
Posts: 8
Joined: Friday 13 December 2019 19:35
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: Rain database fill errors

Post by sperate »

Hello,

to get it working you'll have to create your symlink in the "/dev/serial/by-id" directory. This way it would be seen by Domoticz

And i'm using this command as sudo :

Code: Select all

socat -d /dev/ttyUSB0,rawer SYSTEM:'tee /home/pi/ttylog/input.txt | socat - "PTY,link=/dev/serial/by-id/ttyUSB0_fake,rawer,waitslave" | tee /home/pi/ttylog/output.txt'
in the above command you can modify with tou personal parameters :

Code: Select all

original serial device   = /dev/ttyUSB0
new virtual device       = /dev/serial/by-id/ttyUSB0_fake
input log file		 = /home/pi/ttylog/input.txt
output log file          = /home/pi/ttylog/output.txt
I've tried to append a timestamp to the data written to the log files but Domoticz stops reading and writing to the serial port. It is because the timestamps corrupts the serial data comming in and out of Domoticz. It seems that the data in the log files is exactly the data used by the virtual serial port (/ttyUSB0_fake), thus you can't modify it.

If someone has a trick to have separate log data files that can be timestamped (for example I use the "ts" command from the "moreutils" package) it would be great.

To make it work @reboot, you'll have to init the original serial device with the following command (on RFLINK for example) because Domoticz is now linked to the virtual one :

Code: Select all

stty -F /dev/ttyUSB0 57600 -icanon -iexten -echo -isig -opost -icrnl -imaxbel min 1 time 0
Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest