Skip to content

Commit

Permalink
Merge pull request #21 from Pho3niX90/bugfix/issue_20
Browse files Browse the repository at this point in the history
Bugfix/issue 20
  • Loading branch information
Pho3niX90 authored Dec 15, 2023
2 parents 57e57c1 + 335a678 commit 71bfcb6
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 11 deletions.
2 changes: 1 addition & 1 deletion custom_components/solis_modbus/const.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
DOMAIN = "solis_modbus"
CONTROLLER = "modbus_controller"
VERSION = "1.2.0"
VERSION = "1.2.1"
POLL_INTERVAL_SECONDS = 5
MANUFACTURER = "Solis"
MODEL = "S6"
2 changes: 1 addition & 1 deletion custom_components/solis_modbus/manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,5 +10,5 @@
"issue_tracker": "https://github.com/Pho3niX90/solis_modbus/issues",
"quality_scale": "silver",
"requirements": ["pymodbus==3.5.4"],
"version": "1.2.0"
"version": "1.2.1"
}
13 changes: 4 additions & 9 deletions custom_components/solis_modbus/sensor.py
Original file line number Diff line number Diff line change
Expand Up @@ -846,12 +846,7 @@ async def async_setup_entry(hass: HomeAssistant, config_entry: ConfigEntry, asyn
"decimal_places": 1,
"unit_of_measurement": UnitOfPower.WATT,
"state_class": SensorStateClass.MEASUREMENT,
"register": ['33051', '33052']},
# {
# "type": "SDS", "name": "Current Status String",
# "unique": "solis_modbus_inverter_current_status_string", "decimal_places": 0,
# "register": ['43110']
# }
"register": ['33051', '33052']}
]

for sensor_group in sensors:
Expand Down Expand Up @@ -1001,9 +996,9 @@ def update(self):
n_value = round(get_value(self))
n_value = STATUS_MAPPING.get(n_value, "Unknown")
if '33049' in self._register or '33051' in self._register:
r1_value = self._hass.data[DOMAIN]['values'][self._register[0]]
r2_value = self._hass.data[DOMAIN]['values'][self._register[1]]
n_value = round((r1_value * r2_value) / (10 ** self._decimal_places))
r1_value = self._hass.data[DOMAIN]['values'][self._register[0]] / (10 ** self._decimal_places)
r2_value = self._hass.data[DOMAIN]['values'][self._register[1]] / (10 ** self._decimal_places)
n_value = round(r1_value * r2_value)

self._attr_available = True
self._attr_native_value = n_value
Expand Down

0 comments on commit 71bfcb6

Please sign in to comment.