Sign inSign up

rafaelwastaken/iotawatt-clickhouse

By rafaelwastaken

•Updated 8 months ago

An IoTaWatt to ClickHouse exporter

Image
0

2.8K

rafaelwastaken/iotawatt-clickhouse repository overview

⁠iotawatt-clickhouse⁠

GitHub Workflow Status Docker Image Version (latest by date)

An IoTaWatt to ClickHouse exporter

⁠Requirements

Python requirements are listed in requirements.txt.

⁠Environment Variables

Application and database configuration

NameTypeRequiredDefaultDescription
LOG_LEVELstrNoINFOLogging level (DEBUG, INFO, WARNING, ERROR, CRITICAL)
FETCH_INTERVALintNo60Interval (in seconds) between fetching data from devices, >= 5 seconds
CLICKHOUSE_URLstrYesClickHouse URL
CLICKHOUSE_USERNAMEstrYesClickHouse login username
CLICKHOUSE_PASSWORDstrYesClickHouse login password
CLICKHOUSE_DATABASEstrYesClickHouse database name
CLICKHOUSE_TABLEstrNoiotawattClickHouse modem stats table name
CLICKHOUSE_QUEUE_LIMITintNo1000Max number of data waiting to be inserted to ClickHouse (minimum 25)

⁠devices.json

IoTaWatt device and channel configuration

⁠Device fields
FieldTypeRequiredDescription
namestringYesIoTaWatt device name
ipstringYesIoTaWatt device IP or DNS name
fetch_intervalintNoInterval (in seconds) between fetching data from the device (overrides FETCH_INTERVAL environment variable), >= 5 seconds
auto_discover_channelsbooleanYesAuto-discover available input/output channels. channels is ignored if true
channelsarrayNoList of channels to export. Required if auto_discover_channels is false
⁠Channel fields (within channels array)
FieldTypeRequiredDescription
namestringYesHuman-readable channel name
idstringYesChannel name on the IoTaWatt (NOT the channel number)
typestringYesChannel type: vt (voltage transformer) or ct (current transformer)
⁠Notes
  • Setting auto_discover_channels to true in the device will cause channels to be ignored

⁠Example Configuration

Environment Variables

LOG_LEVEL=INFO
CLICKHOUSE_URL=http://10.0.0.1:8123
CLICKHOUSE_USERNAME=exporter
CLICKHOUSE_PASSWORD=hunter2
CLICKHOUSE_DATABASE=metrics
CLICKHOUSE_TABLE=iotawatt
CLICKHOUSE_QUEUE_LIMIT=5000

devices.json

[
    {
        "name": "IotaWatt 1",
        "ip": "192.168.1.5",
        "auto_discover_channels": true
    },
    {
        "name": "IotaWatt 2",
        "ip": "iotawatt2.local",
        "auto_discover_channels": false,
        "channels": [
            {
                "name": "Input 1",
                "id": "Input_0",
                "type": "vt"
            },
            {
                "name": "Living Room Receptacles",
                "id": "LivingRmRecept",
                "type": "ct"
            }
        ]
    },
    {
        "name": "IotaWatt 3",
        "ip": "192.168.1.6",
        "auto_discover_channels": false,
        "channels": [
            {
                "name": "Input 1",
                "id": "Input_0",
                "type": "vt"
            },
            {
                "name": "Input 2",
                "id": "Input_1",
                "type": "vt"
            },
            {
                "name": "Input 3",
                "id": "Input_2",
                "type": "vt"
            },
            {
                "name": "Living Room Receptacles",
                "id": "LivingRmRecept",
                "type": "ct"
            },
            {
                "name": "EV Charger",
                "id": "EVCharger",
                "type": "ct"
            },
        ]
    }
]

Tag summary

Content type

Image

Digest

sha256:6fab615bc…

Size

28.3 MB

Last updated

8 months ago

docker pull rafaelwastaken/iotawatt-clickhouse