SomethingWithComputers / pixoo

A library to help you make the most out of your Pixoo 64 (and hopefully soon other Wi-Fi enabled Pixoos)
Other
209 stars 26 forks source link

set_channel dont work as expected #8

Closed Pfleiderer-Adrian closed 1 year ago

Pfleiderer-Adrian commented 1 year ago

Hi,

first of all your repo is really nice. Works great.

I think your set_channel() function is not working as expected. This function calls the "Channel/SetIndex" command which specifiyes the selected channel: http://doc.divoom-gz.com/web/#/12?page_id=89 (channel id 0~3 0:Faces; 1:Cloud Channel; 2:Visualizer; 3:Custom; 4:black screen)

So if you want to display your custom channels you need to call the "set_channel(3)" function. Additionally, to set which of the 1-3 custom channels you want to display you must call the "Channel/SetCustomPageIndex"-command. http://doc.divoom-gz.com/web/#/12?page_id=90 There is no function for this call yet.

I recommend to add a "control_custom_channel"-function like:

def control_custom_channel(self, channel):
   response = requests.post(self.__url, json.dumps({
            'Command': 'Channel/SetCustomPageIndex',
            'CustomPageIndex': channel
        }))
   data = response.json()
   if data['error_code'] != 0:
      self.__error(data)

and add a function which combine both functions:

def set_custom_channel(self, channel):
   control_custom_channel(channel) 
   set_channel(3) 

Pull request: https://github.com/SomethingWithComputers/pixoo/pull/9

Greetings, Adrian

Pfleiderer-Adrian commented 1 year ago

Changes have been merged. done. :)