From 7440840e88a4283d04c4f20d3505ddfa648d6e02 Mon Sep 17 00:00:00 2001
From: Sean Rees <sean@erifax.org>
Date: Tue, 12 Jan 2021 09:43:00 +0000
Subject: [PATCH] Cleanup the logic simulating V2's oscillation_state attribute
 on V1

---
 metrics.py | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/metrics.py b/metrics.py
index 7b1e733..af319f9 100644
--- a/metrics.py
+++ b/metrics.py
@@ -213,7 +213,10 @@ class Metrics:
         update_enum(self.fan_power, name, serial, power)
 
         oscillation_state = message.oscillation
-        if message.fan_mode == const.FanMode.AUTO.value and message.fan_state == const.FanState.FAN_OFF:
+        oscillation_on = message.oscillation == const.Oscillation.OSCILLATION_ON.value
+        auto_on = message.fan_mode == const.FanMode.AUTO.value
+        fan_off = message.fan_state == const.FanState.FAN_OFF.value
+        if oscillation_on and auto_on and fan_off:
             # Compatibility with V2's behaviour for this value.
             oscillation_state = _OscillationState.IDLE.value
 
-- 
GitLab