Comments (6)
Thanks! And thank you for the documentation update on the Server ID. Mine was set to 00
by default. I set it to 01
and uncommented SUNSYNK.server_id = 1
and that fixed it for me!
Out of interest, does it matter if the inverter is set as a master or slave?
I'll close this issue, but do you want me to add a PR for the script with the changes you suggested (or just feel free to copy it in yourself if it's easier)? I guess sunsynk/scripts/comms-test.py
or similar, and a mention in the README?
from sunsynk.
Hi, the sunsynk library is used extensively by the homeassistant addon, in the same repo:
Init the driver and then simply read values with await read_sensors(list_of_sensors)
You can see this library as a wrapper (with sunsynk register info) over either one of the two modbus drivers: umodbus or pymodbus
from sunsynk.
Thanks for the speedy response! I just tried this, but sadly no luck:
import asyncio
import pprint
from sunsynk.definitions import ALL_SENSORS, DEPRECATED
from sunsynk.sunsynk import Sensor, Sunsynk
from sunsynk.pysunsynk import pySunsynk
from sunsynk.usunsynk import uSunsynk
#pprint.pp(ALL_SENSORS)
SERIAL = ALL_SENSORS["serial"]
sensors = [ALL_SENSORS["pv1_power"], ALL_SENSORS["pv2_power"]]
SUNSYNK = uSunsynk()
#SUNSYNK = pySunsynk()
SUNSYNK.port = "serial:///dev/ttyUSB0"
#SUNSYNK.server_id = 1
#SUNSYNK.timeout = 10
#SUNSYNK.read_sensors_batch_size = 60
async def main():
print("Connecting...");
await SUNSYNK.connect()
print("Connected. Reading...")
await asyncio.wait_for(SUNSYNK.read_sensors([SERIAL]), 10)
print("Serial "+SERIAL.value)
#print("Reading 2...")
#await asyncio.wait_for(SUNSYNK.read_sensors(sensors), 10)
#print(sensors[0].value)
#print(sensors[1].value)
print("Finished");
LOOP = asyncio.get_event_loop()
LOOP.set_debug(True)
LOOP.run_until_complete(main())
LOOP.close()
It gives me a timeout:
Connecting...
Connected. Reading...
Traceback (most recent call last):
File "test.py", line 34, in <module>
LOOP.run_until_complete(main())
File "/usr/lib/python3.8/asyncio/base_events.py", line 616, in run_until_complete
return future.result()
File "test.py", line 23, in main
await asyncio.wait_for(SUNSYNK.read_sensors([SERIAL]), 10)
File "/usr/lib/python3.8/asyncio/tasks.py", line 501, in wait_for
raise exceptions.TimeoutError()
asyncio.exceptions.TimeoutError
It's a SunSynk 8,8kW, wired to the RS485 connector, with the wiring and USB adaptor as shown (using pins 1+2) in the pics on https://github.com/kellerza/sunsynk#hardware (there's no GND since the adaptor doesn't have it).
Does it look like the code I've got there is ok? Is there anything else I need to set up in the inverter to enable RS485?
edit: One thought - I do already have a Wifi adaptor plugged in the bottom. Could that be causing some kind of conflict? I also don't have a battery installed (still waiting for shipping!).
If/when I finally get this going, it is worth me doing a quick PR for it?
from sunsynk.
Hi, I would simpy change the read to await SUNSYNK.read_sensors(sensors)
So your main method would be:
async def main():
print("Connecting...");
await SUNSYNK.connect()
print("Connected. Reading...")
await SUNSYNK.read_sensors(sensors)
print(", ".join(f"{s.name}={s.value} {s.unit}" for s in sensors))
print("Finished");
from sunsynk.
Also check the server ID & multiple serial connections - here
from sunsynk.
PRs are always welcome, you can add comms-example.py
The master/slave setting is only used for a multi-inverter setup. From my understanding is is not related to or affects the modbus master/slave client/server in any way
from sunsynk.
Related Issues (20)
- Prog{x} Time select list HOT 5
- I have just updated sunsynk add on, and am now getting 2 or 3 decimal places for all values. HOT 5
- Unable to successfully connect to Sunsynk inverter HOT 3
- Custom Sensors seems not to work HOT 7
- "PV3 Sensor" definition for Sunsynk 16Kw single phase inverter HOT 4
- Python Error HOT 2
- Batterie und RS485 Adapter an der Deye Schnittstelle ? Möglich? HOT 1
- Parallel support HOT 1
- 3 phase Grid Trickle Feed HOT 5
- Integration hangs regularly on reading/writing data HOT 17
- Use_timer: Unknown register value 1 HOT 9
- CRC validation failed: Sofar HYD-5000-EP HOT 5
- Slider scaling HOT 3
- Version b381a73 WARNING use_timer: Unknown register value 255 The Problem HOT 2
- Addon reading incorrect data after connection is lost HOT 5
- Possibility of use in sofar 5 ktlm g3? HOT 1
- Issue with the SOC figure since HA upgraded HOT 18
- grid_connected always OFF: Deye 3-phase HOT 3
- RWSensor System Zero Export power MinMax Value HOT 7
- USR-W630 IncompleteReadError HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from sunsynk.