Commit aeb2509f authored by Johann Kellerman's avatar Johann Kellerman
Browse files

images

parent 0548146e
......@@ -54,13 +54,13 @@ If the Inverter is far from the server/SBC running Home Assistant, you have seve
There are several inverters that are rebranded Deye inverters, so you might have success with other inverter brands as well, please add your inverter by editing this file and creating a Pull Request if you are successful.
| Inverter Model | Battery | Version | User | Port(s) |
| -------------- | ----------------- | -------- | ------------- | -------------------------- |
| Sunsynk 3.6kW | Sunsynk SSLB1 | beta/all | @reedy | BMS485 (top left) |
| Sunsynk 5.5kW | Hubble AM-2 | beta/all | @kellerza | BMS485 (top left) |
| Sunsynk 8.8kW | BSL 8.2 kWH | 0.0.8 | @dirkackerman | RS485 (1 in image below) |
| Deye 8kW | Pylontech US3000C | 0.1.3dev | @Kladrie | RS485 (top left) |
| Turbo-E 5kW | DIY with JKBMS | 0.1.4 | @agtconf | BMS485 (top left) |
| Inverter Model | Battery | Version | User | Port(s) |
| -------------- | ----------------- | -------- | ------------- | ------------------------ |
| Sunsynk 3.6kW | Sunsynk SSLB1 | beta/all | @reedy | BMS485 (top left) |
| Sunsynk 5.5kW | Hubble AM-2 | beta/all | @kellerza | BMS485 (top left) |
| Sunsynk 8.8kW | BSL 8.2 kWH | 0.0.8 | @dirkackerman | RS485 (1 in image below) |
| Deye 8kW | Pylontech US3000C | 0.1.3dev | @Kladrie | RS485 (top left) |
| Turbo-E 5kW | DIY with JKBMS | 0.1.4 | @agtconf | BMS485 (top left) |
### Sunsynk 3.6kW Inverter
<img src="./images/inv-ss-3-6kw.png" width="80%">
......@@ -92,20 +92,20 @@ The RJ-45 plug on the inverter side is crimped according to [T568A](https://en.w
| :-------------------------: | :-------------------------: | :---------------------: |
| 1 | Green-White | B/D- |
| 2 | Green | A/D+ |
| 3* | Orange-White | GND |
| 3* | Orange-White | GND |
\* tested on Sunsynk 8.8kW only
<img src="./images/USB-RS485.jpg" width="45%">
<img src="./images/RS485-and-RJ45.jpg" width="45%">
<img src="./images/usb-rs485.png">
<img src="./images/usb-rs485-rj45.png">
## Fault finding
If you fail to get a reply from the inverter, please check the following
### (a) Only a single connection to the serial port
### (a) Only a single connection to the serial port
Ensure you only hve a single addon connected to the serial port. The following can all potentially access the USB port: mbusd, Node RED, the normal and dev addon verison.
Ensure you only have a single addon connected to the serial port. The following can all potentially access the USB port: mbusd, Node RED, the normal and dev addon version.
If you need to have multiple connections to the serial port: ONLY connect mbusd to the serial port. Connect all addons to mbusd (e.g. tcp://192.168.1.x:503 )
......
---
name: Sunsynk Inverter Add-on (dev)
<<<<<<< HEAD
version: 2022.05.29b-0.1.5
=======
version: 2022.07.11-0.1.5
>>>>>>> d486e54 (Energy etc)
slug: hass-addon-sunsynk-dev
description: Add-on for the Sunsynk Inverter
startup: services
......@@ -19,7 +23,8 @@ host_network: false
map:
- share:rw
options:
PORT: "serial:///dev/ttyUSB0"
PORT: ""
DEVICE: "/dev/ttyUSB0"
DRIVER: "umodbus"
SUNSYNK_ID: "007"
SENSOR_PREFIX: ""
......@@ -39,7 +44,8 @@ options:
MQTT_PASSWORD: ""
DEBUG: 0
schema:
PORT: str
PORT: str?
DEVICE: device(subsystem=tty)?
DRIVER: str?
SUNSYNK_ID: str
SENSOR_PREFIX: str
......
......@@ -193,11 +193,12 @@ def suggested_filter(sensor: Sensor) -> str:
if sensor.id.startswith("prog"):
return "round_robin"
f_id = {
"serial": "round_robin",
"overall_state": "step",
"battery_soc": "last",
"sd_status": "step",
"fault": "round_robin",
"grid_connected_status": "last",
"overall_state": "step",
"sd_status": "step",
"serial": "round_robin",
}
assert all(s in ALL_SENSORS for s in f_id)
......
......@@ -25,6 +25,7 @@ class Options:
timeout: int = 10
debug: int = 1
port: str = ""
device: str = ""
modbus_server_id: int = 1
driver: str = "umodbus"
......
......@@ -17,6 +17,7 @@ from options import OPT, SS_TOPIC
from profiles import profile_add_entities, profile_poll
from sunsynk.definitions import ALL_SENSORS, DEPRECATED
from sunsynk.sensor import slug
from sunsynk.sunsynk import Sensor, Sunsynk
_LOGGER = logging.getLogger(__name__)
......@@ -87,10 +88,16 @@ def setup_driver() -> None:
from sunsynk.pysunsynk import pySunsynk
SUNSYNK = pySunsynk()
if not OPT.port:
OPT.port = OPT.device
elif OPT.driver == "umodbus":
from sunsynk.usunsynk import uSunsynk
SUNSYNK = uSunsynk()
if not OPT.port:
OPT.port = "serial://" + OPT.device
else:
_LOGGER.critical("Invalid DRIVER: %s. Expected umodbus, pymodbus", OPT.driver)
sys.exit(-1)
......@@ -138,6 +145,7 @@ def startup() -> None:
for sensor_def in OPT.sensors:
name, _, fstr = sensor_def.partition(":")
name = slug(name)
if name in sens:
_LOGGER.warning("Sensor %s only allowed once", name)
continue
......
images/RS485-and-RJ45.jpg

721 KB

images/USB-RS485.jpg

772 KB

images/inv-deye-8kw.png

6.89 MB | W: 0px | H: 0px

images/inv-deye-8kw.png

562 KB | W: 0px | H: 0px

images/inv-deye-8kw.png
images/inv-deye-8kw.png
images/inv-deye-8kw.png
images/inv-deye-8kw.png
  • 2-up
  • Swipe
  • Onion skin
images/usb-rs485-rj45.png

447 KB

images/usb-rs485.png

228 KB

......@@ -89,36 +89,38 @@ _SENSORS += (
_SENSORS += (
Sensor(166, "AUX power", WATT, -1),
MathSensor((175, 167, 166), "Essential power", WATT, factors=(1, 1, -1)),
MathSensor((172, 167), "Non-Essential power", WATT, factors=(1, -1)),
MathSensor(
(172, 167), "Non-Essential power", WATT, factors=(1, -1), no_negative=True
),
)
###################
# Energy
###################
_SENSORS += (
Sensor(60, "Day Active Power", KWH, -0.1),
Sensor(60, "Day Active Energy", KWH, -0.1),
Sensor(70, "Day Battery Charge", KWH, 0.1),
Sensor(71, "Day Battery discharge", KWH, 0.1),
Sensor(77, "Day Grid Export", KWH, 0.1),
Sensor(76, "Day Grid Import", KWH, 0.1),
Sensor(200, "Day Load Power", KWH, 0.01),
Sensor(84, "Day Load Power", KWH, 0.1),
# Sensor(200, "Day Load Power", KWH, 0.01),
Sensor(84, "Day Load Energy", KWH, 0.1),
Sensor(108, "Day PV Energy", KWH, 0.1),
Sensor(61, "Day Reactive Power", "kVarh", -0.1),
Sensor((201, 202), "History Load Power", KWH, 0.1),
Sensor(67, "Month Grid Power", KWH),
Sensor(66, "Month Load Power", KWH),
Sensor(65, "Month PV Power", KWH),
Sensor((63, 64), "Total Active Power", KWH, 0.1), # signed?
Sensor(61, "Day Reactive Energy", "kVarh", -0.1),
# Sensor((201, 202), "History Load Power", KWH, 0.1),
Sensor(67, "Month Grid Energy", KWH),
Sensor(66, "Month Load Energy", KWH),
Sensor(65, "Month PV Energy", KWH),
Sensor((63, 64), "Total Active Energy", KWH, 0.1), # signed?
Sensor((72, 73), "Total Battery Charge", KWH, 0.1),
Sensor((74, 75), "Total Battery Discharge", KWH, 0.1),
Sensor((81, 82), "Total Grid Export", KWH, 0.1),
Sensor((78, 80), "Total Grid Import", KWH, 0.1),
Sensor((85, 86), "Total Load Power", KWH, 0.1),
Sensor((96, 97), "Total PV Power", KWH, 0.1),
Sensor((85, 86), "Total Load Energy", KWH, 0.1),
Sensor((96, 97), "Total PV Energy", KWH, 0.1),
Sensor((98, 99), "Year Grid Export", KWH, 0.1),
Sensor((87, 88), "Year Load Power", KWH, 0.1),
Sensor((68, 69), "Year PV Power", KWH, 0.1),
Sensor((87, 88), "Year Load Energy", KWH, 0.1),
Sensor((68, 69), "Year PV Energy", KWH, 0.1),
)
##########
......@@ -139,6 +141,9 @@ _SENSORS += (
# Settings
###########
_SENSORS += (
Sensor(200, "Control Mode"),
Sensor(201, "Equalization voltage", VOLT, 0.01),
Sensor(202, "Absorption voltage", VOLT, 0.01),
Sensor(230, "Grid Charge Battery current", AMPS, -1),
Sensor(232, "Grid Charge enabled", "", -1),
Sensor(312, "Battery charging voltage", VOLT, 0.01),
......@@ -210,6 +215,17 @@ def _deprecated() -> None:
"grid_power": Sensor(169, "Grid load", WATT, -1),
"inverter_power": Sensor(175, "Inverter Output", WATT, -1),
"radiator_temperature": TempSensor(91, "Temp Radiator", CELSIUS, 0.1),
"day_active_energy": Sensor(60, "Day Active Power", KWH, -0.1),
"day_reactive_energy": Sensor(61, "Day Reactive Power", "kVarh", -0.1),
"total_active_energy": Sensor((63, 64), "Total Active Power", KWH, 0.1),
"month_pv_energy": Sensor(65, "Month PV Power", KWH),
"month_load_energy": Sensor(66, "Month Load Power", KWH),
"month_grid_energy": Sensor(67, "Month Grid Power", KWH),
"year_pv_energy": Sensor((68, 69), "Year PV Power", KWH, 0.1),
"day_load_energy": Sensor(84, "Day Load Power", KWH, 0.1),
"total_load_energy": Sensor((85, 86), "Total Load Power", KWH, 0.1),
"year_load_energy": Sensor((87, 88), "Year Load Power", KWH, 0.1),
"total_pv_energy": Sensor((96, 97), "Total PV Power", KWH, 0.1),
}
for newname, sen in dep_map.items():
......
......@@ -88,12 +88,15 @@ class MathSensor(Sensor):
"""Math sensor, add multiple registers."""
factors: Tuple[float, ...] = attr.field(default=None, converter=ensure_tuple)
no_negative: bool = attr.field(default=False)
def update_value(self) -> None:
"""Update the value."""
self.value = _round(
sum(_signed(i) * s for i, s in zip(self.reg_value, self.factors))
)
if self.no_negative and not isinstance(self.value, str) and self.value < 0:
self.value = 0
def __attrs_post_init__(self) -> None:
"""Ensure correct parameters."""
......
......@@ -2,9 +2,11 @@
import asyncio
import logging
from typing import Sequence
from urllib import parse
import attr
from async_modbus import AsyncClient, modbus_for_url
from connio import SERIAL_SCHEMES, SOCKET_SCHEMES
from sunsynk.sunsynk import Sunsynk
......@@ -19,7 +21,16 @@ class uSunsynk(Sunsynk): # pylint: disable=invalid-name
async def connect(self) -> None:
"""Connect."""
_LOGGER.info("Connecting to %s", self.port)
url_result = parse.urlparse(self.port)
scheme = url_result.scheme
if scheme not in SOCKET_SCHEMES and scheme not in SERIAL_SCHEMES:
sks = [f"{s}://" for s in SOCKET_SCHEMES]
sks.extend(f"{s}://" for s in SERIAL_SCHEMES)
raise Exception(
"Bad port/connection URL. It should start with one of the following: "
+ ", ".join(sks)
)
self.client = modbus_for_url(self.port)
async def write_register(self, *, address: int, value: int) -> bool:
......
......@@ -49,7 +49,7 @@ def test_versions(run):
assert res, f"version not found in {filename}"
return res.group(1)
v_setup = "0.1.4" # last version
v_setup = "0.1.5" # last version
v_docker = _get_version(
filename="hass-addon-sunsynk/Dockerfile",
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment