Skip to content

Commit

Permalink
Fix last_reset_path for total energy sensors
Browse files Browse the repository at this point in the history
  • Loading branch information
emontnemery committed Aug 18, 2023
1 parent ec232a6 commit dc58b91
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions hatasmota/sensor.py
Original file line number Diff line number Diff line change
Expand Up @@ -226,7 +226,7 @@
class TasmotaSensorConfig(TasmotaBaseSensorConfig):
"""Tasmota Status Sensor configuration."""

last_reset_path: str | None
last_reset_path: list[str|int] | None
poll_topic: str
quantity: str
unit: str
Expand Down Expand Up @@ -254,7 +254,8 @@ def from_discovery_message(
_LOGGER.warning("Unknown unit %s for %s", unit, quantity)

if last_reset_key := LAST_RESET_SENSOR_MAP.get(quantity):
last_reset_path = list(parent_path).append(last_reset_key)
last_reset_path = list(parent_path)
last_reset_path.append(last_reset_key)
else:
last_reset_path = None

Expand Down Expand Up @@ -451,7 +452,7 @@ def get_sensor_entities(
sensor_discovery_message,
device_discovery_msg,
subsubsensorpath,
subsubsensorpath,
subsubsensorpath[:-1],
quantity,
)
)
Expand All @@ -465,7 +466,7 @@ def get_sensor_entities(
sensor_discovery_message,
device_discovery_msg,
subsubsensorpath,
subsensorpath,
subsensorpath[:-1],
quantity,
)
)
Expand All @@ -476,7 +477,7 @@ def get_sensor_entities(
sensor_discovery_message,
device_discovery_msg,
subsensorpath,
subsensorpath,
subsensorpath[:-1],
quantity,
)
)
Expand Down

0 comments on commit dc58b91

Please sign in to comment.