Skip to content

Commit

Permalink
Minor adjustments
Browse files Browse the repository at this point in the history
  • Loading branch information
dontinelli committed Aug 14, 2024
1 parent f8bba7b commit 97cae92
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions src/fyta_cli/fyta_models.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
from typing import Any

from mashumaro import DataClassDictMixin, field_options
from mashumaro.config import BaseConfig


@dataclass
Expand Down Expand Up @@ -69,7 +68,7 @@ def __pre_deserialize__(cls, d: dict[Any, Any]) -> dict[Any, Any]:
d |= {"online": True}

if d.get("measurements") is not None:
d |= {"battery_level": d["measurements"]["battery"]}
d |= {"battery_level": d["measurements"]["battery"]}
d |= {"light": d["measurements"]["light"]["values"]["current"]}
d |= {"light_status": d["measurements"]["light"].get("status")}
d |= {"moisture": d["measurements"]["moisture"]["values"]["current"]}
Expand All @@ -79,7 +78,7 @@ def __pre_deserialize__(cls, d: dict[Any, Any]) -> dict[Any, Any]:
d |= {"salinity_status": d["measurements"]["salinity"].get("status")}
d |= {"temperature": d["measurements"]["temperature"]["values"]["current"]}
d |= {"temperature_status": d["measurements"]["temperature"].get("status")}

if d.get("sensor") is not None:
d |= {"battery_status": d["sensor"]["is_battery_low"]}
d |= {"last_updated": d["sensor"]["received_data_at"]}
Expand Down

0 comments on commit 97cae92

Please sign in to comment.