Recently got some Phillips Hue lights so thought it’d be fun to try and use a Pi with the DisplayOTron to control them.
I’m using the phue library (https://github.com/studioimaginaire/phue) to interact with the lights and that all seems okay but I’m struggling to get a menu setup calling the relevant code from the Hue API.
Eventually I’d like to have nested menus so I could drill down from a top menu to control a single light but so far I’m struggling to get even the basics working.
So far I have something like this…
process_light function is -
print("You selected light " + light)
This builds up the menu correctly and displays it to the LED but I was hoping I could just get it to just print something to screen to confirm I’m passing the name of the light from the menu correctly but when I select the menu option nothing happens. Any ideas why?
I also tried the MenuOption class but I’m confused how I can pass into it the value which was selected as it doesnt look like MenuOption takes a parameter. This is the code I tried -
menu.add_item("Switch off " + l.name,poweroff())
self.start = self.millis()
def redraw(self, menu):
menu.write_row(0, ‘Switching off light’)
Not sure I explained that very well but any assistance on how to use the menus for the DisplayOTron would be much appreciated (I’ve looked at previous posts but no one seems to be building a dynamic menu on the fly like I’m trying to).