From 853a3cce53f02b1f2580adbbd57edcb023d855d2 Mon Sep 17 00:00:00 2001 From: iou1name Date: Fri, 22 Nov 2019 07:36:10 -0500 Subject: [PATCH] bugfix remember state --- models.py | 11 +++++++---- templates/index.html | 14 +++++++------- 2 files changed, 14 insertions(+), 11 deletions(-) diff --git a/models.py b/models.py index eca220b..1726c4b 100644 --- a/models.py +++ b/models.py @@ -174,6 +174,7 @@ class LightStrip(Device): if topic[1] == 'state': if topic[2] == 'solid': + self.state = topic[2] data['type'] = topic[2] payload = payload.split(',') payload = [int(num) for num in payload] @@ -189,12 +190,14 @@ class LightStrip(Device): sub_device.color = payload data['color'] = tools.to_html_color(payload) elif topic[2] == 'rainbow': + self.state = topic[2] data['type'] = topic[2] payload = payload.split(',') self.rainbow_params = [float(p) for p in payload[:3]] self.rainbow_params += [int(p) for p in payload[3:]] data['rainbow_params'] = self.rainbow_params elif topic[2] == 'america': + self.state = topic[2] data['type'] = topic[2] payload = payload.split(',') self.america_params = [int(n) for n in payload] @@ -203,22 +206,22 @@ class LightStrip(Device): if topic[2] == 'mode': data['property_type'] = topic[2] if topic[3] == 'static': - data['type'] = topic[3] self.animation = topic[3] - elif topic[3] == 'rotate_left': data['type'] = topic[3] - data['rotate_count'] = payload + elif topic[3] == 'rotate_left': self.animation = topic[3] self.animation_rotate_count = int(payload) + data['type'] = topic[3] + data['rotate_count'] = payload elif topic[3] == 'rotate_right': data['type'] = topic[3] data['rotate_count'] = payload self.animation = topic[3] self.animation_rotate_count = int(payload) elif topic[2] == 'delay': + self.animation_delay = int(payload) data['property_type'] = topic[2] data['delay'] = payload - self.animation_delay = int(payload) elif topic[1] == 'strip': data['amount'] = topic[2] if topic[2] == 'full': diff --git a/templates/index.html b/templates/index.html index c29f99d..7d76d47 100644 --- a/templates/index.html +++ b/templates/index.html @@ -43,11 +43,11 @@
State
-
+

@@ -116,9 +116,9 @@
Animation