Skip to main content

No project description provided

Project description

Programme to take data from various sensors and save

Choose the way you wish to log the data and where you want to get it from.

Then run the appropriate script with command line options.

To run needs a secrets file with the path given as option to the scrpt

so if you want to log from a MQTT server use e.g

python labrat_mqtt.py -secrets "mypath\secrets.toml"

the secrets is a toml in the following form

"MQTT_USERNAME" = ""
"MQTT_KEY" = ""
"MQTT_BROKER" = ""
"MQTT_PORT" = 
"MQTT_TOPIC" = ""
"INATOR_NAME" = ""

if using an sqlite database need a device file in json format Below is the schema More information is here

{
    "$schema": "http://json-schema.org/draft-04/schema#",
    "type": "object",
    "properties": {
        "devices": {
            "type": "array",
            "items": {
                "type": "object",
                "properties": {
                    "device_name": {"type": "string"},
                    "device_guid": {"type": "string"},
                    "num_sensors": {"type": "integer"},
                    "device_info": {"type": "string"},
                    "device_type": {"type": "string"},
                    "device_location": {"type": "string"},
                    "device_active": {"type": "integer"},
                    "connection": {
                        "type": "string",
                        "enum": ["Serial", "MQTT", "Other"],
                    },
                    "sensors": {
                        "type": "array",
                        "items": {
                            "type": "object",
                            "properties": {
                                "sens_name": {"type": "string"},
                                "measures": {"type": "string"},
                                "returns": {"type": "string"},
                                "calib": {"type": "string"},
                                "range": {"type": "string"},
                                "info": {"type": "string"},
                                "comments": {"type": "string"},
                            },
                            "required": [
                                "sens_name",
                                "measures",
                                "returns",
                                "calib",
                                "range",
                                "info",
                                "comments",
                            ],
                        },
                    },
                },
                "required": [
                    "device_name",
                    "device_guid",
                    "num_sensors",
                    "device_info",
                    "device_type",
                    "device_location",
                    "device_active",
                    "connection",
                    "sensors",
                ],
            },
        }
    },
    "required": ["devices"],
}

To run as a daemon supervisord can be used and an example configuration file is provided.

To install (if not already installed)

sudo apt update && sudo apt install supervisor

Edit the config file making sure to change:

  • command= <make sure all the paths are correct to database and secrets file>

  • user= <make sure the correct user name is used>

  • stdout_logfile = <give and appropriate path and filename to log output of programme to >

  • directory = <make sure the correct home directory for MQTT is set >

Then run using

supervisord -c <path to the configuration file>

To monitor and control the program use supervisorctl

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

labrat_project-0.1.0.tar.gz (23.8 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

labrat_project-0.1.0-py3-none-any.whl (32.5 kB view details)

Uploaded Python 3

File details

Details for the file labrat_project-0.1.0.tar.gz.

File metadata

  • Download URL: labrat_project-0.1.0.tar.gz
  • Upload date:
  • Size: 23.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/2.3.1 CPython/3.12.9 Windows/11

File hashes

Hashes for labrat_project-0.1.0.tar.gz
Algorithm Hash digest
SHA256 c7627746fb10760a50eecbb4d35e4a205dfd7a0b3601f251d247cb28ae0fc44d
MD5 4cfff1ec9c21e52a6456eeb7fa5cca6e
BLAKE2b-256 2e514d5fe4fb98e0fbe132951f749f1e70283eaf49d9332978f196ffa03eaa37

See more details on using hashes here.

File details

Details for the file labrat_project-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: labrat_project-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 32.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/2.3.1 CPython/3.12.9 Windows/11

File hashes

Hashes for labrat_project-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 8cf1e4663c9f1c24ae7bc0efb82251bd281067e9538c21a09c6b8b2f3b730352
MD5 809711d789d300db2de241b3dae48c1e
BLAKE2b-256 20444c1034dc96fc2ee2822e77269a4e51a11dc2b08f937d8f0744b32589f1ed

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page