Skip to content

Commit

Permalink
possible fix for #57
Browse files Browse the repository at this point in the history
  • Loading branch information
Pho3niX90 committed May 6, 2024
1 parent 9f1c02b commit 1d9a8a6
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 4 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.4.9"
VERSION = "1.5.0"
POLL_INTERVAL_SECONDS = 15
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.6.8"],
"version": "1.4.9"
"version": "1.5.0"
}
5 changes: 3 additions & 2 deletions custom_components/solis_modbus/sensor.py
Original file line number Diff line number Diff line change
Expand Up @@ -908,8 +908,6 @@ def update(self):
if not self.is_added_to_hass:
return

n_value = None

if '33027' in self._register:
hours = self._hass.data[DOMAIN]['values'][str(int(self._register[0]) - 2)]
minutes = self._hass.data[DOMAIN]['values'][str(int(self._register[0]) - 1)]
Expand All @@ -921,6 +919,9 @@ def update(self):
else:
n_value = get_value(self)

if n_value == 0:
n_value = self.async_get_last_sensor_data()

if n_value is not None:
self._attr_available = True
self._attr_native_value = n_value * self._display_multiplier
Expand Down

0 comments on commit 1d9a8a6

Please sign in to comment.