oviwox

Overview

Oviwox is a standalone application designed to collect data from two different sources: weather station data via an RTL-SDR (Realtek RTL2838) dongle and Vinduino sensor data via a Cypress USB-UART LP dongle. The collected data is processed, converted to JSON format, and sent to a web service (webhook) for further analysis. The entire output from the application is logged to a file located at /var/log/oviwox.log.

Components

  1. Weather Station Data: Collected using rtl_433, which processes data from weather sensors connected via the RTL-SDR dongle.

  2. Vinduino Sensor Data: Collected from Vinduino sensors connected via the Cypress USB-UART LP dongle and read through the /dev/ttyACM0 interface.

Features

  • Weather Station Data Processing: The weather station data from rtl_433 is filtered, processed, and sent as JSON to a webhook. Data such as windspeed is converted from kilometers per hour (kph) to knots.

  • Vinduino Sensor Data Processing: The Vinduino data is parsed from raw sensor readings, converted into JSON, and sent to the same webhook as the weather data.

  • Logging: All console output, including errors and standard log messages, is sent to /var/log/oviwox.log.


Installation and Setup

1. Python Environment

Ensure that you have Python 3 and the necessary Python libraries installed:

  • requests

  • pyserial

You can install these dependencies with:

sudo apt-get install python3-pip pip3 install requests pyserial

2. File Structure

Place the following two files in your system:

  1. oviwox.py: The Python script that handles both weather and Vinduino data processing.

  2. oviwox.sh: The shell script that starts the Python program and redirects all output to /var/log/oviwox.log.

3. Make the Shell Script Executable

Make the oviwox.sh script executable:

chmod +x oviwox.sh

4. Log File Setup

The shell script ensures that the log file exists and has the proper permissions. You can manually create and set permissions for the log file beforehand if needed:

sudo touch /var/log/oviwox.log sudo chmod 666 /var/log/oviwox.log


How to Run Oviwox

  1. Start the Application: Run the shell script to start the Oviwox application:

    bash

    Copy code

    sudo ./oviwox.sh

  2. Logging: All output from the script, including weather data, Vinduino data, and any errors or logs, will be written to /var/log/oviwox.log.

  3. Stopping the Application: You can stop the application by killing the process or closing the terminal if the script was run interactively.


Data Processing Details

Weather Station Data

  • Data is received from rtl_433 in JSON format.

  • Only relevant fields are processed:

    • batterylow → Sent as wx_batterylow.

    • avewindspeed and gustwindspeed → Converted from kph to knots.

    • Other fields (winddirection, cumulativerain, temperature, humidity, light, and uv) are kept as is.

  • The processed data is sent to the webhook as a JSON POST request.

Vinduino Sensor Data

  • Data is received from the Cypress dongle as raw serial input.

  • The packet is parsed and converted into JSON format with fields for sensor data at different depths (0.05m, 0.5m, 1m, and 2m), along with battery voltage and temperature.

  • The processed data is sent to the webhook as a JSON POST request.


Web Service Configuration

The script sends data to a configurable webhook. Make sure to update the WEB_SERVICE_URL variable in the oviwox.pyfile to point to the correct endpoint:

WEB_SERVICE_URL = "https://your-webhook-url.com/api/sensors"


Troubleshooting

  1. Log File: Check /var/log/oviwox.log for any issues. The log file will contain all standard output and errors from the application, including information on data processing, JSON errors, network errors, and more.

  2. Permissions: If you encounter permission issues with the log file, ensure it has the correct write permissions:

    sudo chmod 666 /var/log/oviwox.log

  3. Missing Data: If no data is being received from the weather station or Vinduino sensors, ensure that the devices are correctly connected and the correct drivers are installed.


Conclusion

Oviwox collects weather station and Vinduino sensor data, processes it into JSON, and sends it to a webhook, with all output logged for easy monitoring and debugging. By using a shell script wrapper, the Python code is executed as a standalone service with minimal setup and maintenance required.

Let me know if you need further details or adjustments!