Giter Site home page Giter Site logo

Log records about rtl_433 HOT 8 CLOSED

merbanan avatar merbanan commented on August 28, 2024
Log records

from rtl_433.

Comments (8)

Batilan avatar Batilan commented on August 28, 2024

Hi Denoo, this is a good question. Currently the output of rtl_433 is rather free-format and is determined by the writers of the callback routines. If you are interested in adapting it for specific sensors it wouldn't be too hard to make the output more structured (like csv) yourself. Another possibility is to parse the current output using a scripting language like perl or python and generate csv from that.

At this moment I'm working on a version of rtl_433 that implements plugins for the different callbacks. Once I have the plugin infrastruture ready I planned on creating a generic output interface that can be used from the individual callbacks for writing output in different output formats (like csv). I think also (epoch) timestamps needs to be added so when parsing the output on a later time it is still possible to generate historic data (like required when feeding data in rdd files or graphite/whisper files).

Is this kind of what you are looking for?

from rtl_433.

deennoo avatar deennoo commented on August 28, 2024

This is, i'm still not enought educated about programing to do it my self.

Using fprintf ?

from rtl_433.

deennoo avatar deennoo commented on August 28, 2024

Ok got succes.

Using fprintf I start to create a txt file for each protocol, and it works, each time a callback give a result, it create a txt file (by overwriting the one create before).

First Probleme :
On this kind of line
fprintf(stderr, "battery = %s\n",bb[1][1]&0x80?"OK":"Low")

  • stderr is replace by f

fprintf(f, "battery = %s\n",bb[1][1]&0x80?"OK":"Low")

the string is well write on the txt file but nothng is shown on the rtl_433 screen, how can do both ?

from rtl_433.

Batilan avatar Batilan commented on August 28, 2024

Please send me a personal message and I will try to help: github at atilas . nl

from rtl_433.

deennoo avatar deennoo commented on August 28, 2024

i send you a mail, did you recieve it ?

from rtl_433.

VigibotDev avatar VigibotDev commented on August 28, 2024

You can disable the buffering for stdin and stderr, to get grep/awk working

(root|~/rtl_433/src) git diff
diff --git a/src/rtl_433.c b/src/rtl_433.c
index fc85f0d..48406ef 100644
--- a/src/rtl_433.c
+++ b/src/rtl_433.c
@@ -987,6 +987,9 @@ int main(int argc, char **argv) {
     char vendor[256], product[256], serial[256];
     int have_opt_R = 0;

+    setbuf(stdout, NULL);
+    setbuf(stderr, NULL);
+
     demod = malloc(sizeof (struct dm_state));
     memset(demod, 0, sizeof (struct dm_state));

from rtl_433.

VigibotDev avatar VigibotDev commented on August 28, 2024
(root|~) cat rtl_433.sh
#!/bin/bash

dir=/var/www/meteo

/usr/local/bin/rtl_433 \
| tee >(stdbuf -o0 fgrep 'Weather Sensor THGR810  Channel 1' > $dir/TH1.txt) \
| tee >(stdbuf -o0 fgrep 'Weather Sensor THGR810  Channel 2' > $dir/TH2.txt) \
| tee >(stdbuf -o0 fgrep 'Weather Sensor THGR810  Channel 3' > $dir/TH3.txt) \
| tee >(stdbuf -o0 fgrep 'Weather Sensor UVN800 Channel 1' > $dir/UV.txt) \
| tee >(stdbuf -o0 fgrep 'Weather Sensor WGR800' > $dir/WG.txt)

(root|/var/www/meteo) cat TH1.txt
Weather Sensor THGR810 Channel 1 Temp: 9.1C 48.4F Humidity: 90%
Weather Sensor THGR810 Channel 1 Temp: 9.1C 48.4F Humidity: 90%
Weather Sensor THGR810 Channel 1 Temp: 9.1C 48.4F Humidity: 90%

(root|/var/www/meteo) cat WG.txt
Weather Sensor WGR800 Wind Gauge Gust Wind Speed : 0 m/s Wind direction 180 dgrs
Weather Sensor WGR800 Wind Gauge Gust Wind Speed : 2 m/s Wind direction 202 dgrs
Weather Sensor WGR800 Wind Gauge Gust Wind Speed : 1 m/s Wind direction 248 dgrs

And for Cacti :

(root|~) cat /usr/share/cacti/site/scripts/meteo.sh
#!/bin/bash

dir=/var/www/meteo

a=$(cat $dir/TH1.txt | tail -n 1 | tr 'C' ' ' | tr '%' ' ' | awk '{print $7}')
b=$(cat $dir/TH1.txt | tail -n 1 | tr 'C' ' ' | tr '%' ' ' | awk '{print $10}')
c=$(cat $dir/TH2.txt | tail -n 1 | tr 'C' ' ' | tr '%' ' ' | awk '{print $7}')
d=$(cat $dir/TH2.txt | tail -n 1 | tr 'C' ' ' | tr '%' ' ' | awk '{print $10}')
e=$(cat $dir/TH3.txt | tail -n 1 | tr 'C' ' ' | tr '%' ' ' | awk '{print $7}')
f=$(cat $dir/TH3.txt | tail -n 1 | tr 'C' ' ' | tr '%' ' ' | awk '{print $10}')
g=$(cat $dir/UV.txt | tail -n 1 | awk '{print $8}')
h=$(cat $dir/WG.txt | tail -n 1 | awk '{print $10}')
i=$(cat $dir/WG.txt | tail -n 1 | awk '{print $14}')

echo -n T1:$a H1:$b T2:$c H2:$d T3:$e H3:$f UV:$g WS:$h WD:$i

(root|/usr/share/cacti/site/scripts) ./meteo.sh
T1:9.0 H1:90 T2:12.0 H2:71 T3:11.9 H3:62 UV:0 WS:1 WD:248

Result : http://www.serveurperso.net/meteo/

from rtl_433.

merbanan avatar merbanan commented on August 28, 2024

CSV support is added now which should take care of this issue.

from rtl_433.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.