Skip to content

Commit

Permalink
Merge pull request #68 from Mrredstone5230/feat/gif-page
Browse files Browse the repository at this point in the history
[Feature] Added the gif page_type
  • Loading branch information
gickowtf authored Apr 15, 2024
2 parents 05129b8 + 9c41b3a commit 7311f7a
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 0 deletions.
10 changes: 10 additions & 0 deletions custom_components/divoom_pixoo/pixoo64/_pixoo.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand Down
2 changes: 2 additions & 0 deletions custom_components/divoom_pixoo/sensor.py
Original file line number Diff line number Diff line change
Expand Up @@ -144,6 +144,8 @@ def _render_page(self, page: dict):
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 = {}
Expand Down

0 comments on commit 7311f7a

Please sign in to comment.