Skip to content

Commit 9de88e1

Browse files
committed
2024.04.2
1 parent 0ef8f02 commit 9de88e1

File tree

6 files changed

+36
-34
lines changed

6 files changed

+36
-34
lines changed

custom_components/solax_modbus/__init__.py

+4-1
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@
4444
# Endian_BIG = Endian.BIG
4545
# Endian_LITTLE = Endian.LITTLE
4646
from pymodbus.constants import Endian
47-
from pymodbus.exceptions import ConnectionException
47+
from pymodbus.exceptions import ConnectionException, ModbusIOException
4848
from pymodbus.payload import BinaryPayloadBuilder, BinaryPayloadDecoder, Endian
4949
from pymodbus.transaction import ModbusRtuFramer, ModbusAsciiFramer
5050

@@ -615,6 +615,9 @@ async def async_read_modbus_data(self):
615615
except ConnectionException as ex:
616616
_LOGGER.error("Reading data failed! Inverter is offline.")
617617
res = False
618+
except ModbusIOException as ex:
619+
_LOGGER.error(f"ModbusIOError: {ex}")
620+
res = False
618621
except Exception as ex:
619622
_LOGGER.exception("Something went wrong reading from modbus")
620623
res = False

custom_components/solax_modbus/manifest.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -9,5 +9,5 @@
99
"iot_class": "local_polling",
1010
"issue_tracker": "https://github.com/wills106/homsassistant-solax-modbus/issues",
1111
"requirements": ["pymodbus>=3.6.6"],
12-
"version": "2024.04.1"
12+
"version": "2024.04.2"
1313
}

custom_components/solax_modbus/plugin_growatt.py

+25-13
Original file line numberDiff line numberDiff line change
@@ -247,6 +247,18 @@ def value_function_combined_battery_power(initval, descr, datadict):
247247
# Normal select types
248248
#
249249
###
250+
GrowattModbusSelectEntityDescription(
251+
name = "Select baud rate",
252+
key = "select_baud_rate",
253+
register = 22,
254+
option_dict = {
255+
0: "9600bps",
256+
1: "38400bps", },
257+
allowedtypes = GEN | GEN2 | GEN3 | GEN4,
258+
entity_category = EntityCategory.CONFIG,
259+
entity_registry_enabled_default = False,
260+
icon = "mdi:dip-switch",
261+
),
250262
GrowattModbusSelectEntityDescription(
251263
name = "Limit Grid Export",
252264
key = "limit_grid_export",
@@ -260,7 +272,6 @@ def value_function_combined_battery_power(initval, descr, datadict):
260272
entity_category = EntityCategory.CONFIG,
261273
icon = "mdi:transmission-tower-export",
262274
),
263-
264275
###
265276
# Battery First (4-6)
266277
###
@@ -946,6 +957,16 @@ def value_function_combined_battery_power(initval, descr, datadict):
946957
entity_registry_enabled_default = False,
947958
icon = "mdi:translate-variant",
948959
),
960+
GrowattModbusSensorEntityDescription(
961+
name = "Select baud rate",
962+
key = "select_baud_rate",
963+
register = 22,
964+
scale = { 0: "9600bps",
965+
1: "38400bps", },
966+
allowedtypes = GEN | GEN2 | GEN3 | GEN4,
967+
entity_registry_enabled_default = False,
968+
icon = "mdi:dip-switch",
969+
),
949970
GrowattModbusSensorEntityDescription(
950971
name = "Serial Number",
951972
key = "serialnumber",
@@ -2635,7 +2656,8 @@ def value_function_combined_battery_power(initval, descr, datadict):
26352656
4: "Update Mode",
26362657
5: "PV Bat Online",
26372658
6: "Bat Online",
2638-
8: "Normal Mode", },
2659+
8: "Normal Mode",
2660+
9: "Bypass" },
26392661
register_type = REG_INPUT,
26402662
allowedtypes = GEN | GEN2,
26412663
icon = "mdi:run",
@@ -4866,15 +4888,6 @@ def value_function_combined_battery_power(initval, descr, datadict):
48664888
@dataclass
48674889
class growatt_plugin(plugin_base):
48684890

4869-
"""
4870-
def isAwake(self, datadict):
4871-
return (datadict.get('run_mode', None) == 'Normal Mode')
4872-
4873-
def wakeupButton(self):
4874-
return 'battery_awaken'
4875-
"""
4876-
4877-
48784891
async def async_determineInverterType(self, hub, configdict):
48794892
_LOGGER.info(f"{hub.name}: trying to determine inverter type")
48804893
seriesnumber = await async_read_serialnr(hub, 9)
@@ -4927,7 +4940,6 @@ def matchInverterWithMask (self, inverterspec, entitymask, serialnumber = 'not r
49274940
if serialnumber.startswith(start) : blacklisted = True
49284941
return (genmatch and xmatch and hybmatch and epsmatch and dcbmatch and mpptmatch) and not blacklisted
49294942

4930-
49314943
plugin_instance = growatt_plugin(
49324944
plugin_name = 'Growatt',
49334945
plugin_manufacturer = 'Growatt New Energy',
@@ -4938,4 +4950,4 @@ def matchInverterWithMask (self, inverterspec, entitymask, serialnumber = 'not r
49384950
block_size = 100,
49394951
order16 = Endian.BIG,
49404952
order32 = Endian.BIG,
4941-
)
4953+
)

custom_components/solax_modbus/plugin_solax.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -3094,7 +3094,7 @@ def value_function_remotecontrol_autorepeat_remaining(initval, descr, datadict):
30943094
SolaXModbusSensorEntityDescription(
30953095
name = "Battery to EV Charger",
30963096
key = "battery_to_ev_charger",
3097-
register = 0x111,
3097+
register = 0x10F,
30983098
scale = { 0: "Enabled",
30993099
1: "Disabled", },
31003100
entity_registry_enabled_default = False,

docs/growatt-faq.md

+4-17
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,7 @@
1-
# Growatt FAQ - WIP
1+
# Growatt FAQ
22

3-
## Example Formatting
3+
## Baud Rate
44

5-
**Bold text, ideal for a warning statement**
5+
Default Baud rate is 9600, optionally you can set 38400
66

7-
### Nested
8-
9-
#### Further Nested
10-
11-
Allows the Index on the left to be broken down
12-
13-
### List options
14-
15-
List:
16-
17-
- Item 1
18-
- Item 1a
19-
- Item 2
20-
- Item 3
7+
**Remember to reconfigure the Integration following a change!**

mkdocs.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ nav:
2626
- Compatible inverters: compatible-inverters.md
2727
- Home Assistant "Energy Dashboard": energy-dashboard.md
2828
- Growatt:
29-
- FAQ - WIP: growatt-faq.md
29+
- FAQ: growatt-faq.md
3030
- Growatt Modes of Operation - WIP: growatt-operation-modes.md
3131
- Sofar:
3232
- FAQ: sofar-faq.md

0 commit comments

Comments
 (0)