Skip to content

Commit

Permalink
Added the gif page_type
Browse files Browse the repository at this point in the history
  • Loading branch information
SB2DD committed Apr 9, 2024
1 parent ae54432 commit 9c41b3a
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):
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 9c41b3a

Please sign in to comment.