From b9c0b81baa294d55c6d064061b4cb7428901fe10 Mon Sep 17 00:00:00 2001 From: Sebastian Muszynski Date: Mon, 8 Oct 2018 08:00:49 +0200 Subject: [PATCH 1/3] Fix Xiaomi Rice Cooker Normal5: get_prop only works if "all" properties are requested (Closes: #380) --- miio/cooker.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/miio/cooker.py b/miio/cooker.py index d4db721da..b1a24fe2f 100644 --- a/miio/cooker.py +++ b/miio/cooker.py @@ -726,7 +726,10 @@ def status(self) -> CookerStatus: """Retrieve properties.""" properties = ['func', 'menu', 'stage', 'temp', 't_func', 't_precook', 't_cook', 'setting', 'delay', 'version', 'favorite', 'custom'] - values = self.send("get_prop", properties) + + # Some cookers doesn't support a list of properties here. Therefore "all" properties are requested. + # If the property count or order changes the property list above must be updated. + values = self.send("get_prop", ['all']) properties_count = len(properties) values_count = len(values) From 40877d1793db70ea1d8550b4a3336c6a2f82ae9f Mon Sep 17 00:00:00 2001 From: Sebastian Muszynski Date: Mon, 8 Oct 2018 10:11:28 +0200 Subject: [PATCH 2/3] Make hound happy --- miio/cooker.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/miio/cooker.py b/miio/cooker.py index b1a24fe2f..74efd11e6 100644 --- a/miio/cooker.py +++ b/miio/cooker.py @@ -727,8 +727,11 @@ def status(self) -> CookerStatus: properties = ['func', 'menu', 'stage', 'temp', 't_func', 't_precook', 't_cook', 'setting', 'delay', 'version', 'favorite', 'custom'] - # Some cookers doesn't support a list of properties here. Therefore "all" properties are requested. - # If the property count or order changes the property list above must be updated. + """ + Some cookers doesn't support a list of properties here. Therefore "all" properties + are requested. If the property count or order changes the property list above must + be updated. + """ values = self.send("get_prop", ['all']) properties_count = len(properties) From 443f888ee2dbe66c0f04a8ebd0b6812d741b4c46 Mon Sep 17 00:00:00 2001 From: Sebastian Muszynski Date: Mon, 8 Oct 2018 10:47:36 +0200 Subject: [PATCH 3/3] Make hound happy --- miio/cooker.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/miio/cooker.py b/miio/cooker.py index 74efd11e6..a1d2552b6 100644 --- a/miio/cooker.py +++ b/miio/cooker.py @@ -728,8 +728,8 @@ def status(self) -> CookerStatus: 't_cook', 'setting', 'delay', 'version', 'favorite', 'custom'] """ - Some cookers doesn't support a list of properties here. Therefore "all" properties - are requested. If the property count or order changes the property list above must + Some cookers doesn't support a list of properties here. Therefore "all" properties + are requested. If the property count or order changes the property list above must be updated. """ values = self.send("get_prop", ['all'])