Skip to content

A python script to import rtl_433 json files into influxdb.

Notifications You must be signed in to change notification settings

anoduck/flux433

Repository files navigation

Welcome to flux433 👋

Version License: MIT

Python script to import rtl_433 json files into influxdb.

Intro

This project began life as rtl433_influx, was upgraded from InfluxDB v1.x to Influxdb v2.x. If I had known what a pain it would be to make this jump in versions, I never wouild have done it. But, being me, I couldn't stop until it was working.

The purpose of this project is the creation of a repository of decoded rtl_433 captures, documenting when they were captured, how many times they were seen, and provide a means to catalog unidentified captures for further analysis.

Another planned feature is a continual query that will work towards removal of duplicate entries, while increasing the count of how many times the capture was seen.

Forward: Grievances with InfluxDB 2.0

There are some significant differences between influx V1 and V2, that should be mentioned before one chooses to make the migration.

  1. In V2 the flux language is the primary language to interact with the database, yet they announced flux will no longer be supported afterwards. Which raises questions as to why it was even chosen as the primary language over influxql.

  2. The CLI shell is gone. They claim it's available, but it does not accept fluxql as arguments in the same manner as it once did. Which means you have to either interact with the database via the web client or programmatically. Either way, this makes administration and maintenance much more difficult. Also, we have already discovered one of the shell commands is incorrectly documented. The docs claim SHOW TAG VALUES will show you the tags used, but the command is actually SHOW TAG KEYS.

  3. Retention Policies are now referred to as DataBase Retention Policy mappings, and we are currently not sure how to manage or create them, because the method has changed. Supposedly, they can no longer be updated or modified, but can only be overriden.

These are just the few issues we have encountered so far in our light use of the two versions. Why they were allowed to be incorporated into a production release really begs the question concerning quality standards of the project. If the open source community is lucky, perhaps a few braves souls will take version one and fork into into a sustaining project. Regardless, our effort to migrate to V2 has already been completed, so we shall continue the effort for the moment.

Installation

You got two choices for installation, well... actually three. The big decision is if you want to run it as a service or not. If not, then either poetry or pipenv should work. If you want to run it as a service, then you will use the setup.sh script. The setup.sh script will create a systemd service that will run the script.

Uninstall

If you installed it as a service and want to uninstall it, then you can use the uninstall.sh script. If you recieve some error that looks like userdel: user flux433 is currently used by process 1962204, then you can use the kill command to kill the process.

Usage

I have never quite understood why some developers have relied on command line flags and arguments to configure their projects when it was not necessary, so as usual I have allowed some of the configuration to occur via a configuration file. As usual with some of my projects, an empty configuration file is created for the user when first run.

Configuration File

The spec for the configuration file is as follows:

# Organization configured in influxdb
org = string(default='replace with influxdb organization')

# API token generated by influxdb for organization
api = string(default='replace with generated API token')Options = parse(options, dest="Options")

# Bucket name for use in influxdb
bucket = string(default='replace with bucket name')

# Watch for new files?
watch = boolean(default=False)

# Remove files when processed?
remove = boolean(default=False)

# Path to Dir of JSON files or Json File
path = string(default='~/Sandbox/ISM-Research')

# Log level
log_level = string(default='INFO')

# Log file
log_file = string(default='flux433.log')

CLI arguments

There are two arguments that can be passed to the script. The first is the path to the directory that contains the JSON files to process. The second is the path to the configuration file.

poetry run python flux433/start.py --path <path-to-dir or json-file> --config <path-to-config-file>

Author

👤 Anoduck, The Anonymous Duck

🤝 Contributing

Contributions, issues and feature requests are welcome!
Feel free to check issues page.

Show your support

Give a ⭐️ if this project helped you!

📝 License

Copyright © 2024 Anoduck, The Anonymous Duck.
This project is MIT licensed.


This README was generated with ❤️ by readme-md-generator

About

A python script to import rtl_433 json files into influxdb.

Topics

Resources

Stars

Watchers

Forks