34 lines
842 B
Python
Executable file
34 lines
842 B
Python
Executable file
#!/usr/bin/python3 -u
|
|
|
|
import sys, signal, os
|
|
# sys.path.append('/usr/local/lib/python3.5/dist-packages/sensord')
|
|
|
|
from sensord.RFM69receiver import RFM69Receiver, LogConsole
|
|
from sensord.InfluxDBWriter import InfluxDBWriter
|
|
from sensord.MQTT import MQTT
|
|
|
|
RFM_NODE = 1
|
|
RFM_NETW = 101
|
|
RFM_ENCR = '0123456789ABCDEF'
|
|
|
|
MQTT_HOST = "mqtt.broker"
|
|
MQTT_PORT = 8883
|
|
MQTT_BASE = "sensor/"
|
|
MQTT_USER = "sensor"
|
|
MQTT_PASS = "secretsauce"
|
|
MQTT_CERT = "/etc/mosquitto/ca_certificates/ca.crt"
|
|
|
|
INFLUX_HOST = "influxdb.host"
|
|
INFLUX_PORT = 8086
|
|
INFLUX_DB = "sensors"
|
|
|
|
rfm = RFM69Receiver(RFM_NODE, RFM_NETW, RFM_ENCR)
|
|
|
|
influx = InfluxDBWriter(INFLUX_HOST, INFLUX_PORT, INFLUX_DB)
|
|
mqtt = MQTT(MQTT_HOST, MQTT_PORT, MQTT_BASE, MQTT_USER, MQTT_PASS, MQTT_CERT)
|
|
|
|
rfm.attach_observer(influx)
|
|
rfm.attach_observer(mqtt)
|
|
rfm.attach_observer(LogConsole())
|
|
|
|
rfm.run()
|