Showing posts with label OpenWRT. Show all posts
Showing posts with label OpenWRT. Show all posts

Sunday, June 24, 2018

How to collect wireless sensors readings using rtl_433 and display them using OpenWrt

Goal: to use an OpenWrt capable router to receive wireless sensors reading and log them using OpenWrt luci-app-statistics module.
Why: because my router is always on anyway, so why not to use it to also log wireless sensors readings?
What is needed?
  • A router (or any other device) with USB port(s) that is supported by OpenWrt
  • A RTL-SDR dongle
  • Wireless temperature/humidity sensors supported by the rtl_433 application
Note: I’m referring to the old OpenWrt project name, which is currently called LEDE, which in turn will be called OpenWrt again. It’s because of the nonsense they started some time ago by forking the project and calling it LEDE because they couldn’t agree on which side they should start counting bits. Some of them there little-endians and the others big-endians. Finally they have agreed to use both approaches and now they are busy merging everything back together and use the good old name [sic!]. So the next release is supposed to be called OpenWrt as their branch name suggest. At the moment this branch is not usable but maybe it will be released at the end of the year. It is still not known which year should it be…

Thursday, January 27, 2011

collectd-mod-exec Part 5

Part 1
Part 2
Part 3
Part 4

In this final part I'm publishing a real world example of the collectd-exec usage - weather info collecting script.
I'm using yahoo weather api to get weather information because it sends back very concise xml formatted text file which is only 2k in size. The weather info is updated once per hour so I've added special logic to retrieve it once per hour and feed same values in between.

Wednesday, January 26, 2011

collectd-mod-exec Part 4

Part 1
Part 2
Part 3

There is only one thing left to explain - how to get notified if some values go out of scope. As an example I'm going to send notification emails if CPU temperature reaches 57 degree Celsius. This could be implemented with only one additional if statement and this would work perfectly if I only had one script that sends notifications. It would become cumbersome if I needed to edit multiple scripts to change say an email address where my notifications are sent. In other words the collecting and notification logics shall be separated. To  do this one can use 'PUTNOTIF' statement that shall be sent to the script STDOUT - exactly the same way like 'PUTVAL' is sent. Documentation of the 'PUTNOTIF' arguments can be found on the collect-exec module documentation page. Additionally there shall be some logic added to send notification after some time out period otherwise emails would be sent after each $COLLECTD_INTERVAL which is by default 30 seconds. Updated tmpcollect.sh script is shown below:

Monday, January 24, 2011

collectd-mod-exec Part 3

Part1
Part2

I'll continue with the tmpcollect.sh script from the second part of this How-To. First of all I want to optimize it a bit. Running sed two times is not very performant and is also not necessary. Updated script is shown below:

Friday, January 21, 2011

collectd-mod-exec Part 2

Part1

My router SBC is equipped with two temperature sensors to monitor cpu and board temperatures. Executing 'sensors' command produces the following result:
root@Alix:~# sensors
lm86-i2c-0-4c
Adapter: CS5536 ACB0
temp1:       +36.0 C  (low  =  +0.0 C, high = +70.0 C)
                      (crit = +85.0 C, hyst = +75.0 C)
temp2:       +42.5 C  (low  =  +0.0 C, high = +70.0 C)
                      (crit = +85.0 C, hyst = +75.0 C)
With a bit of the script-fu I'm stripping temperature values and feeding them into the database:

Thursday, January 20, 2011

collectd-mod-exec Part 1

Having some spare time I decided to write about powerful yet not well documented feature of the OpenWRT's luci-app-statistics plugin -- collectd-mod-exec module. This module allows collecting any type of data an external application could supply. In other words the module starts a user specified application which feeds collectd module with data. Principally having this module installed one could simulate all other collectd-mod-* modules.

Saturday, November 13, 2010

IR control for your router

There are no buttons on my router but very often I need to start some task without accessing the shell. For example I want to switch wireless interface off if I don't need it and the problem here is that I cannot switch it on again wirelessly because wireless interface is off. So I thought I need some kind of a one button USB keyboard or mouse but there is no such thing. Second thought was to use some kind of IR receiver with a remote control. As far as I already have a universal remote control Logitech Harmony 885 I only needed an IR receiver that is supported by Linux. So I bought one manufactured by TechniSat for 15,20Euro with delivery (just google for - TechniSat USB IR receiver)
[Image]