GithubHelp home page GithubHelp logo

inonoob / pylarexx Goto Github PK

View Code? Open in Web Editor NEW

This project forked from redflo/pylarexx

0.0 0.0 0.0 259 KB

Python DataLogger for Arexx Multilogger Devices

License: Apache License 2.0

Python 98.73% Shell 1.27%

pylarexx's People

Contributors

inonoob avatar redflo avatar

pylarexx's Issues

Start scripts with Root security issue

Starting scripts with root is dangerous and might be a security issue.

The case here is that the scripts needed to be started as root because access to hardware is reserved for Root. In this case the script wants to access the USB device which is reserve for root.

in order to fix it we will add a usb rule to udev and add this device to the "plugdev" group which the user pi is part of. This will make all the scripts Arexx script and the pylarrexx.py script exactable without root.

  • go to the Arexx webpage and download the rf_usb_http_rpi_ 0_6 script for raspberry pi

  • Extract the files

  • Copy 51-rf_usb.rules to /lib/udev/rules.d/

  • Open 51-rf_usb.rules and add the following GROUP="Plugdev"to the end of the file. it should look lik this:
    SUBSYSTEM=="usb", ATTRS{idVendor}=="0451", ATTRS{idProduct}=="3211", MODE="0666", GROUP="Plugdev"

  • add/ensure that "user" or here user "pi" is part of that group
    adduser username plugdev

  • force udev to restart
    sudo udevadm control --reload
    sudo udevadm trigger

  • Finaly unplug and plug back the device

you should now be able to start the scripts without root rights.

BS-510 initialisation issue

After a restart of the Raspberry pi and restart of pylarrex, it seems that the BS-510 Logger can't initialise it self.

My config:

BS-510 with 11 sensor TSN-TH70E

Issue

  • When pylarexx -vvv starts, it gets the sensors configuration from /etc/pylarexx.yml. And starts spamming the console every milisecond with the value of the sensors. Those value are wrong as temperature rises with the time. Also the time seems to not being set right.

, 181, 37, 9, 167, 77, 5, 33, 89, 234, 181, 37, 9, 43, 78, 4, 234, 94, 234, 181, 37, 0, 0, 0, 0, 0, 0, 0, 0, 0]) 2020-01-19 10:27:07,929 - root - INFO - Datapoint: sensorid 19878, raw data: 6392 cooked: 24.320000 °C timestamp: 1579360182 from sensor Kueche type Temperature 2020-01-19 10:27:07,935 - root - INFO - Datapoint: sensorid 20101, raw data: 1332 cooked: 44.978173 %RH timestamp: 1579360184 from sensor Flur type Humidity 2020-01-19 10:27:07,942 - root - INFO - Datapoint: sensorid 19947, raw data: 1249 cooked: 42.216497 %RH timestamp: 1579360186 from sensor Abstellkammer type Humidity 2020-01-19 10:27:07,948 - root - INFO - Datapoint: sensorid 16605, raw data: 1228 cooked: 41.511645 %RH timestamp: 1579360192 from sensor Schlafzimmer type Humidity 2020-01-19 10:27:07,955 - root - INFO - Datapoint: sensorid 19879, raw data: 1313 cooked: 44.349387 %RH timestamp: 1579360201 from sensor Kueche type Humidity 2020-01-19 10:27:07,961 - root - INFO - Datapoint: sensorid 20011, raw data: 1258 cooked: 42.517821 %RH timestamp: 1579360206 from sensor Arbeitszimmer type Humidity 2020-01-19 10:27:07,967 - root - DEBUG - write and read data from device 2020-01-19 10:27:07,986 - root - DEBUG - array('B', [0, 9, 220, 64, 25, 18, 96, 234, 181, 37, 9, 157, 77, 4, 246, 98, 234, 181, 37, 9, 166, 77, 24, 248, 105, 234, 181, 37, 9, 134, 79, 24, 207, 106, 234, 181, 37, 9, 184, 64, 24, 226, 110, 234, 181, 37, 9, 132, 78, 24, 216, 111, 234, 181, 37, 0, 0, 0, 0, 0, 0, 0, 0, 0]) 2020-01-19 10:27:07,992 - root - INFO - Datapoint: sensorid 16604, raw data: 6418 cooked: 24.580000 °C timestamp: 1579360208 from sensor Schlafzimmer type Temperature 2020-01-19 10:27:07,998 - root - INFO - Datapoint: sensorid 19869, raw data: 1270 cooked: 42.918880 %RH timestamp: 1579360210 from sensor Wohnzimmer type Humidity 2020-01-19 10:27:08,004 - root - INFO - Datapoint: sensorid 19878, raw data: 6392 cooked: 24.320000 °C timestamp: 1579360217 from sensor Kueche type Temperature 2020-01-19 10:27:08,010 - root - INFO - Datapoint: sensorid 20358, raw data: 6351 cooked: 23.910000 °C timestamp: 1579360218 from sensor Kinderzimmer type Temperature 2020-01-19 10:27:08,016 - root - INFO - Datapoint: sensorid 16568, raw data: 6370 cooked: 24.100000 °C timestamp: 1579360222 from sensor Badezimmer type Temperature 2020-01-19 10:27:08,023 - root - INFO - Datapoint: sensorid 20100, raw data: 6360 cooked: 24.000000 °C timestamp: 1579360223 from sensor Flur type Temperature 2020-01-19 10:27:08,029 - root - DEBUG - write and read data from device 2020-01-19 10:27:08,049 - root - DEBUG - array('B', [0, 9, 42, 78, 24, 201, 125, 234, 181, 37, 9, 135, 79, 4, 245, 126, 234, 181, 37, 9, 185, 64, 4, 224, 129, 234, 181, 37, 9, 221, 64, 4, 204, 129, 234, 181, 37, 9, 235, 77, 4, 224, 131, 234, 181, 37, 9, 167, 77, 5, 33, 137, 234, 181, 37, 0, 0, 0, 0, 0, 0, 0, 0, 0]) 2020-01-19 10:27:08,055 - root - INFO - Datapoint: sensorid 20010, raw data: 6345 cooked: 23.850000 °C timestamp: 1579360237 from sensor Arbeitszimmer type Temperature 2020-01-19 10:27:08,061 - root - INFO - Datapoint: sensorid 20359, raw data: 1269 cooked: 42.885489 %RH timestamp: 1579360238 from sensor Kinderzimmer type Humidity 2020-01-19 10:27:08,067 - root - INFO - Datapoint: sensorid 16569, raw data: 1248 cooked: 42.182989 %RH timestamp: 1579360241 from sensor Badezimmer type Humidity 2020-01-19 10:27:08,073 - root - INFO - Datapoint: sensorid 16605, raw data: 1228 cooked: 41.511645 %RH timestamp: 1579360241 from sensor Schlafzimmer type Humidity 2020-01-19 10:27:08,079 - root - INFO - Datapoint: sensorid 19947, raw data: 1248 cooked: 42.182989 %RH timestamp: 1579360243 from sensor Abstellkammer type Humidity 2020-01-19 10:27:08,086 - root - INFO - Datapoint: sensorid 19879, raw data: 1313 cooked: 44.349387 %RH timestamp: 1579360249 from sensor Kueche type Humidity

Possible fix or how I get it work:

  • if you download from the Arexx webpage the raspberry pi bash script install all according to the Readme.
    So then if you start the script it will show the same issue as the pylarexx.

NEGLECT [1] time 1414255843 (1579429716), type 1, id 16568, value 46.53 NEGLECT [10] time 1414255845 (1579429716), type 1, id 19878, value 31.77 NEGLECT [19] time 1414255851 (1579429716), type 1, id 20010, value 42.6 NEGLECT [28] time 1414255853 (1579429716), type 3, id 16604, value 25.4887 NEGLECT [37] time 1414255861 (1579429716), type 3, id 20358, value 14.8705 NEGLECT [46] time 1414255873 (1579429716), type 3, id 19878, value 35.4034 NEGLECT [1] time 1414255881 (1579429716), type 1, id 19868, value 29.7 NEGLECT [10] time 1414255884 (1579429716), type 1, id 16604, value 35.72 NEGLECT [19] time 1414255895 (1579429716), type 3, id 19946, value 13.9617 NEGLECT [28] time 1414255905 (1579429716), type 1, id 20358, value 45.13 NEGLECT [37] time 1414255912 (1579429716), type 3, id 16568, value 13.0496 NEGLECT [46] time 1414255920 (1579429716), type 1, id 19946, value 45.54 NEGLECT [1] time 1414255922 (1579429716), type 1, id 19878, value 32.02 NEGLECT [10] time 1414255924 (1579429716), type 3, id 20010, value 16.4532 NEGLECT [19] time 1414255924 (1579429716), type 3, id 16604, value 25.2352 NEGLECT [28] time 1414255931 (1579429716), type 3, id 19868, value 35.9912 NEGLECT [37] time 1414255946 (1579429716), type 3, id 19946, value 14.0375 NEGLECT [46] time 1414255954 (1579429716), type 3, id 20358, value 14.9461 NEGLECT [1] time 1414255968 (1579429716), type 1, id 16568, value 46.62

But after let's say 3 to 4 min the bash output changes and the correct value are displayed the script sends the correct http request with the correct values.

`1: Predicting!: time = 1579433285, before last ( 1579429934 now, d= 3351 sec)
NEGLECT [1] time 1579429724 (1579429934), type 1, id 20358, value 22.53
NEGLECT [10] time 1579429737 (1579429934), type 3, id 19868, value 43.1525
NEGLECT [19] time 1579429772 (1579429934), type 3, id 19878, value 45.8682
NEGLECT [28] time 1579429838 (1579429934), type 1, id 16568, value 22.54
RECENT [1] time 1579429879, type 8003, id 19946, value 40.0268
request to 192.168.2.35, 49161
POST / HTTP/1.1
Host:192.168.2.35
Content-Type: application/x-www-form-urlencoded
Connection: close
Content-Length: 66

type=3&id=19946&time=632745079&v=40%2E0&rssi=-86&missing=632745079
`

Proposed ugly fix:
update the pylarrex python script

  • start the Arexx bash script from python, let the script initialise the BS-510 Logger.
  • check the output for the finished init signal (script start sending http requests)
  • kill the bash script
  • start the Logging process

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.