Skip to content

Instantly share code, notes, and snippets.

SUMMARY = "Provides dbus control of inverters on Venus"
LICENSE = "MIT"
LIC_FILES_CHKSUM = "file://LICENSE;md5=ce8464bf9333255588d9f64d05730589"
inherit ve_package
inherit daemontools
inherit python-compile
SRC_URI = "gitsm://github.com/osaether/dbus-inverter-ctrl.git;protocol=https;tag=v${PV}"
from time import sleep
import ssl
import json
import os
from paho.mqtt.client import Client
username = "your VRM email"
password = "your VRM pasword"
portal_id = "your VRM portal ID"
from time import sleep
import ssl
import json
import os
from paho.mqtt.client import Client
username = "your VRM email"
password = "your VRM pasword"
portal_id = "your VRM portal ID"
@osaether
osaether / relays-state.py
Created December 8, 2018 16:12
Show state of Venus GX Relays
#!/usr/bin/env python
from pymodbus.constants import Defaults
from pymodbus.constants import Endian
from pymodbus.client.sync import ModbusTcpClient as ModbusClient
from pymodbus.payload import BinaryPayloadDecoder
Defaults.Timeout = 25
Defaults.Retries = 5
client = ModbusClient('ipaddress.of.venus', port='502')
result = client.read_input_registers(806, 2)
@osaether
osaether / relay2-off.py
Created December 8, 2018 16:12
Turn Venus GX Relay 2 off
#!/usr/bin/env python
from pymodbus.constants import Defaults
from pymodbus.client.sync import ModbusTcpClient as ModbusClient
Defaults.Timeout = 25
Defaults.Retries = 5
client = ModbusClient('ipaddress.of.venus', port='502')
client.write_register(807, 0)
@osaether
osaether / relay2-on.py
Created December 8, 2018 16:11
Turn Venus GX Relay 2 on
#!/usr/bin/env python
from pymodbus.constants import Defaults
from pymodbus.client.sync import ModbusTcpClient as ModbusClient
Defaults.Timeout = 25
Defaults.Retries = 5
client = ModbusClient('ipaddress.of.venus', port='502')
client.write_register(807, 1)
@osaether
osaether / relay1-off.py
Created December 8, 2018 16:10
Turn Venus GX Relay 1 off
#!/usr/bin/env python
from pymodbus.constants import Defaults
from pymodbus.client.sync import ModbusTcpClient as ModbusClient
Defaults.Timeout = 25
Defaults.Retries = 5
client = ModbusClient('ipaddress.of.venus', port='502')
client.write_register(806, 0)
@osaether
osaether / relay1-on.py
Created December 8, 2018 16:09
Turn Venus GX Relay 1 on
#!/usr/bin/env python
from pymodbus.constants import Defaults
from pymodbus.client.sync import ModbusTcpClient as ModbusClient
Defaults.Timeout = 25
Defaults.Retries = 5
client = ModbusClient('ipaddress.of.venus', port='502')
client.write_register(806, 1)