From 9c41b3a849f201d5b83a15f485ba0524553222b9 Mon Sep 17 00:00:00 2001 From: PolishKrowa <45701824+Mrredstone5230@users.noreply.github.com> Date: Tue, 9 Apr 2024 16:14:51 -0400 Subject: [PATCH] Added the gif page_type --- custom_components/divoom_pixoo/pixoo64/_pixoo.py | 10 ++++++++++ custom_components/divoom_pixoo/sensor.py | 2 ++ 2 files changed, 12 insertions(+) diff --git a/custom_components/divoom_pixoo/pixoo64/_pixoo.py b/custom_components/divoom_pixoo/pixoo64/_pixoo.py index 5cfcd78..269f6f3 100644 --- a/custom_components/divoom_pixoo/pixoo64/_pixoo.py +++ b/custom_components/divoom_pixoo/pixoo64/_pixoo.py @@ -347,6 +347,16 @@ def set_custom_page(self, index): if data['error_code'] != 0: self.__error(data) + def play_gif(self, gif_url): + response = requests.post(self.__url, json.dumps({ + 'Command': 'Device/PlayTFGif', + 'FileType': 2, + 'FileName': gif_url + }), timeout=self.timeout) + data = response.json() + if data['error_code'] != 0: + self.__error(data) + def set_face(self, face_id): self.set_clock(face_id) diff --git a/custom_components/divoom_pixoo/sensor.py b/custom_components/divoom_pixoo/sensor.py index dd1ad58..1e1ded7 100644 --- a/custom_components/divoom_pixoo/sensor.py +++ b/custom_components/divoom_pixoo/sensor.py @@ -144,6 +144,8 @@ def _render_page(self, page): pixoo.set_visualizer(page['id']) elif page_type == "clock": pixoo.set_clock(page['id']) + elif page_type == "gif": + pixoo.play_gif(page['gif_url']) elif page_type in ["custom", "components"]: variables = page.get('variables', {}) rendered_variables = {}