Skip to content
/ menhue Public

Status bar interface for Phillips Hue lights

Notifications You must be signed in to change notification settings

madsmtm/menhue

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

11 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Menhue - Status bar interface for Phillips Hue lights

Mostly an open-source clone of https://huemenu.app/, but without the (IMO) excessive polling it does to always be up to date. Starting a request on click is enough to feel interactive.

Very feature-incomplete and work-in-progress, don't actually use this for anything other than inspiration for how to use objc2.

Design decisions

Uses only Cocoa APIs, to get a feel for what that's like.

In a real-world application, I'd strongly recommend serde and serde_json for interacting with JSON data, and reqwest for doing the URL requests.

Future ideas

Notes

Detecting mouseEntered:/mouseExited: for status bar buttons is not possible, even with replacing the class.

Old API docs: https://developers.meethue.com/develop/hue-api/, https://www.burgestrand.se/hue-api/ Developer: https://$HOST/debug/clip.html

State machine WIP

flowchart TD;
  Init-->DataFromCache;

  DataFromCache[Getting data from cache...]
  DataFromCache-- Failure -->LoginDialog;
  DataFromCache-- Success -->MenuReady;

  LoginDialog[[Show login dialog]]
  LoginDialog-- Log in with details -->FetchUser;

  FetchUser[Logging in...]
  FetchUser-- Failure -->LoginDialog;
  FetchUser-- Success -->MenuReady;

  MenuReady[[Menu ready]]
  MenuReady-- On open -->FetchLampStatus;

  FetchLampStatus[Fetching lamp status...]
  FetchLampStatus-- Permission error -->LoginDialog2;
  LoginDialog2[[Show login dialog]]
  FetchLampStatus-- Failure -->MenuOpenWithError;
  FetchLampStatus-- Success -->MenuOpen;

  MenuOpenWithError[[Show error in menu]]
  MenuOpenWithError-- Retry -->FetchLampStatus;
  MenuOpenWithError-- Close -->MenuReady;

  MenuOpen[[Show lamps]]
  MenuOpen-- Edit Lamp -->EditLamp;
  MenuOpen-- Close -->MenuReady;

  EditLamp[Editing lamp...]
  EditLamp-- Permission error -->LoginDialog3;
  LoginDialog3[[Show login dialog]]
  EditLamp-- Failure -->MenuOpenWithError;
  EditLamp-- Success -->MenuOpen;
Loading

Nix

# darwin-configuration.nix
{
  imports = [ menhue/service.nix ];

  services.menhue = {
    enable = true;
    host = "...";
    username = "...";
  };
}

About

Status bar interface for Phillips Hue lights

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published