Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix handling of missing temperature values #100

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 4 additions & 8 deletions msmart/device/AC/appliance.py
Original file line number Diff line number Diff line change
Expand Up @@ -94,8 +94,8 @@ def __init__(self, *args, **kwargs):
self._off_timer = None
self._online = True
self._active = True
self._indoor_temperature = 0.0
self._outdoor_temperature = 0.0
self._indoor_temperature = None
self._outdoor_temperature = None

def __str__(self):
return str(self.__dict__)
Expand Down Expand Up @@ -183,12 +183,8 @@ def update(self, res: state_response):
self._eco_mode = res.eco_mode
self._turbo_mode = res.turbo_mode
self._fahrenheit_unit = res.fahrenheit

if res.indoor_temperature != 0xff:
self._indoor_temperature = res.indoor_temperature

if res.outdoor_temperature != 0xff:
self._outdoor_temperature = res.outdoor_temperature
self._indoor_temperature = res.indoor_temperature
self._outdoor_temperature = res.outdoor_temperature

# self._on_timer = res.on_timer
# self._off_timer = res.off_timer
Expand Down
4 changes: 2 additions & 2 deletions msmart/device/AC/command.py
Original file line number Diff line number Diff line change
Expand Up @@ -467,9 +467,9 @@ def read_state(self, payload: memoryview):
# self.peak_elec = (payload[10] & 0x20) > 0
# self.natural_fan = (payload[10] & 0x40) > 0

self.indoor_temperature = (payload[11] - 50) / 2.0
self.indoor_temperature = (payload[11] - 50) / 2.0 if payload[11] != 0xff else None

self.outdoor_temperature = (payload[12] - 50) / 2.0
self.outdoor_temperature = (payload[12] - 50) / 2.0 if payload[12] != 0xff else None

# self.humidity = (payload[13] & 0x7F)

Expand Down