Skip to content

Commit

Permalink
Fixed native_value
Browse files Browse the repository at this point in the history
  • Loading branch information
alexdelprete committed Feb 27, 2024
1 parent 6bf2f89 commit b7f6311
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
2 changes: 1 addition & 1 deletion custom_components/sinapsi_alfa/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -228,7 +228,7 @@ def read_modbus_alfa(self):
reg_addr = sensor["modbus_addr"]
reg_count = 1 if reg_type == "uint16" else 2
_LOGGER.debug(
f"(read_modbus_alfa) Key: {reg_key} Addr: {reg_addr} Type: {reg_type} DevClass: {reg_dev_class}"
f"(read_modbus_alfa) Key: {reg_key} Addr: {str(reg_addr)} Type: {reg_type} DevClass: {reg_dev_class}"
)
if reg_type == "calculated":
self.data["potenza_consumata"] = (
Expand Down
2 changes: 2 additions & 0 deletions custom_components/sinapsi_alfa/sensor.py
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,8 @@ def native_value(self):
"""Return the state of the sensor."""
if self._key in self.coordinator.api.data:
return self.coordinator.api.data[self._key]
else:
return None

@property
def state_attributes(self) -> dict[str, Any] | None:
Expand Down

0 comments on commit b7f6311

Please sign in to comment.