Skip to content

Instantly share code, notes, and snippets.

@rufik
rufik / sdm630_to_mqtt.py
Created June 12, 2019 20:14
Python script to read SDM630 power meter and publish to mqtt
#!/usr/bin/python
import minimalmodbus
import paho.mqtt.client as mqtt
import paho.mqtt.publish as pub
# RS485 serial settings
DEVICE="/dev/ttyUSB0"
SLAVE=2
DEBUG=False
FUNCODE=4