How to make a tailored version of Ruuvitag-Sensor for Raspberry Pi?

#1

I have successfully finished editing the RuuviTag firmware for my purposes and now is is time to move to the receiving end.

I have a Raspberry Pi 3B+ with Raspbian Stretch in Full Desktop mode and Python 3.5.3, and the ruuvitag-sensor installed according to the install_guide_pi.md works fine - sensors are found and their data is printed to the display.

The target now is not to print the sensor data but to generate alarms when the received values are outside of the set limits, and more severe alarms if this continues for a longer period of time.

Raspberry Pi and Python are not familiar to me, so I am wondering what is the best approach.

Would it make sense to modify ruuvitag_sensor by opening it in the Python 3 (IDLE) IDE that is already installed in the Pi, and then first Save As with another name and start editing - or is there a better way?

Does ruuvitag_sensor (ruuvitag-sensor) include timers that could be used for monitoring how long the received values have been outside of the set limits? If not, what would be a good way for implementing the timer functions in Python?

#2

Personally I use InfluxDB & Grafana running on the cloud and I use Grafana’s Telegram integration to send me a text if one of the values is outside of acceptable range. I’m sure there’s a lot of approaches too.

#3

Thanks. But what if I do not want to use an external database / cloud?

#4

It depends on what your goals are. You can for example run InfluxDB and Grafana locally on RPi, or you could modify ruuvitag-sensor for your needs.

#5

OK. For modifying ruuvitag-sensor for my needs, does what I wrote in my original message make any sense?

#6

I generally edit with a plain text editor, but IDE might be convenient.

I’m not 100% certain, but I think ruuvitag-sensor does not store the state of the tags. You’d need to implement local storage for the date of tags and alarm logic which checks that each tag has sent new data and if the data is within limits.

For example this blog post describes different ways to implement a timer with Python.

#7

Thanks.

I will consider the editor choices. It is probably easier if the editing can be done in the Pi.

The link for timer implementation seems very interesting. As the needs here are not very sophisticated, a good solution can probably be found there.

#8

Is Python a requirement for any reason? I have been using RuuviCollector solution from this thread for the second year now: Collecting RuuviTag measurements and displaying them with Grafana
It runs completely on a Raspberry Pi 3, with influxdb and grafana. It’s just brilliant. But it’s not Python.

#9

Thanks for bringing this up. Python is by no means a requirement, but I know it a little better than Java. But it is not a bad thing to get to know more programming languages… I will certainly analyze this as an alternative - maybe start by installing it and trying it out.