Skip to main content

Jocasta

Library to extract data from serial devices and send it various services.

jocasta is used to read JSON output from a serially attached device and relay it to a another service. For example a database or a local csv file.

Example Arduino code can be found here Sensors_Basic. This is a simple sketch designed to read data from a number of cheap available sensors and return the readings over USB serial as a JSON string.

Quick Start

Installation

pip install jocasta or use sudo to install system wide.

Config File (Optional)

Create a directory in your home directory to store the config file.

cd ~
mkdir .config
cd .config

Create a file called jocasta_config.ini and copy and paste the following into the depending on which services you want.

[csv_file]
path = /tmp/sensor_data.csv

[file_system]
file_name = /tmp/sensor_data.json

[influxdb]
host = 192.168.1.100
port = 8086
password = admin
username = admin
database = greenhouses

[io_adafruit]
username = your_username
key = your_key
# change to match your configured feeds on https://io.adafruit.com
feeds = office.office-temperature,office.office-light,office.office-humidity
# field names in your JSON payload from your sensor
measurements = temperature,light,humidity

[temperature_ranges]
maximum = 55.0
minimum = -10.0

The last section temperature_ranges is a range you add to ensure if your reading called temperature is outside of the values stated it will be ignored. This was added specifically as the ds18b20 sensor can report very large or small numbers when reporting an issue.

Running

Start jocasta by add the path of your serial device. This path can be found from looking in rhe /dev directory on both OSX and Linux.

OSX

The USB device will typically be locate in /dev with a name that starts tty.

$ jocasta -p /dev/tty.usbserial-14230
╒═════════════╤══════════╤══════════╤══════════╤════════╕
│ Temperature │ Location │ Moisture │ Humidity │ Light  │
├─────────────┼──────────┼──────────┼──────────┼────────┤
│ 23.2        │ office   │ 568      │ 61.2     │ 5800.0 │
╘═════════════╧══════════╧══════════╧══════════╧════════╛

Raspberry Pi / Linux

The USB device will typically be locate in /dev with a name that starts ttyUSB

$ jocasta -p /dev/ttyUSB0
╒═════════════╤══════════╤══════════╤══════════╤════════╕
│ Temperature │ Location │ Moisture │ Humidity │ Light  │
├─────────────┼──────────┼──────────┼──────────┼────────┤
│ 23.2        │ office   │ 568      │ 61.2     │ 5800.0 │
╘═════════════╧══════════╧══════════╧══════════╧════════╛

Running

A config file can supplied to the command line call using -c:

$ jocasta -p /dev/tty.usbserial-14230 -c /path/to/config.ini

Supported Services

Services and things Jocasta can send data to.

Adafruit IO - https://io.adafruit.com

Adafruit's beta IoT hosted application.

Config

[io_adafruit]
username = username
key = key
feeds = temperature,light,humidity
measurements = temperature,light,humidity

CSV File

Outputs as csv to a file on disk. This is handy for other applications to access the data.

Config

[csv_file]
path = /tmp/sensor_data.csv

File System

Outputs json to a file on disk. This is handy for other applications to access the data. New readings are appended to the file.

Config

[file_system]
file_name = /tmp/sensor_data.json

InfluxDB - https://www.influxdata.com

Config

Add the following to your jocasta-config.ini file, making sure you update the values to match your InfluxDB server.

[influxdb]
host = 192.168.1.100
port = 8086
password = admin
username = admin
database = greenhouses

Metadata

Release files for jocasta 0.3.2

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for jocasta 0.3.2
File Size Uploaded Provenance Actions
jocasta-0.3.2.tar.gz 9.6 kB Without provenance Details for jocasta-0.3.2.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for jocasta 0.3.2
File Interpreter ABI Platform Actions
jocasta-0.3.2-py3-none-any.whl Python 3 none any Details for jocasta-0.3.2-py3-none-any.whl

Total release size: 21.0 kB

Release files / jocasta-0.3.2.tar.gz

Download URL jocasta-0.3.2.tar.gz
Size 9.6 kB
Tags Source
SHA-256 checksum
How to use checksums
74f92deb623da46c4f511d51b31f4ca5180ac892b1abab2ba2e5da85897783af
BLAKE2b-256 checksum
How to use checksums
810806b3c0c12a760202bd2211cc75f3e3cc5ac4b5cb3c4812a6ce06e351079d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/49.1.0.post20200710 requests-toolbelt/0.9.1 tqdm/4.48.2 CPython/3.8.3

Release files / jocasta-0.3.2-py3-none-any.whl

Download URL jocasta-0.3.2-py3-none-any.whl
Size 11.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
68efd09a18e109761f9f6de6b4e16af952ce11ca412e20a4cf0d0bb51beebd1c
BLAKE2b-256 checksum
How to use checksums
ad949b6d45145b1a8fe116c86d3e848e7966a24a6c6597eb0c7600136bc337a4
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/49.1.0.post20200710 requests-toolbelt/0.9.1 tqdm/4.48.2 CPython/3.8.3

Security for jocasta 0.3.2

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page