add source

This commit is contained in:
Norbert
2023-07-04 09:32:58 +02:00
parent ea08f00fdf
commit f8d1716a8b
16 changed files with 3560 additions and 0 deletions

19
source/example.py Normal file
View File

@@ -0,0 +1,19 @@
from solaxx3.rs485 import SolaxX3
# adjust the serial port and baud rate as necessary
s = SolaxX3(port="/dev/ttyUSB0", baudrate=115200)
if s.connect():
s.read_all_registers()
available_stats = s.list_register_names()
for stat in available_stats:
print(stat)
battery_temperature = s.read("temperature_battery")
print(f"\n\nBattery temperature: {s.read('temperature_battery')}")
else:
print("Cannot connect to the Modbus Server/Slave")
exit()