frudawski

huenew

The huenew function creates a new connection to a Philips HUE bridge. The new connection will be appended to already existing connections, which allows controlling several bridges independently.

The function will try to establish a secure https connection by retrieving the bridge certificate. If that does not work, a dialogue will open, giving you some options:

1.) Try the standard certificate.

2.) Some bridges still use self-signed certificates, which means the certificate must be retrieved first. On systems that have openssl installed, that should happen automatically, otherwise you have to download the certificate yourself.

3.) If the above do not work, you have the option to establish an insecure http connection, which is not recommended.

For the connection to be established, you have to press the HUE bridge button within 30 seconds, otherwise the connection will be refused.

Note 1: All hue function use curl commands to communicate with the HUE bridge. Please make sure it is installed. Curl is available for all major operating systems.

Note 2: Since Q2 2023 the HUE bridge IP discovery over the web service is no longer supported. Scratch that, it is back online. For Windows systems, the procedure is a bit cumbersome if the online discovery web service is not available. You can install Apple Bonjour for automated bridge discovery. If you choose to install Bonjour, some command windows will open during the HUE discovery process. Under Linux it should work if avahi is installed. MacOS is currently not supported, since I don’t own a MAC. Alternately, you can find your HUE bridge IP address from the HUE app under: Settings \rightarrow My Hue System \rightarrow more information under “i”.

Note 3: Currently, two different types of bride certificates are used. The default HUE certificate, which should work without problems and the self-signed certificate which requires, that the certificate is downloaded from the bridge first. If you have openssl installed, this should happen automatically. If not, you have to download the certificate yourself and store it somewhere, where MATLAB and Octave can find it.

See also: huecon, huelampshuesearch, hueaddhueset, huename

Usage:

c = huenew(ip)

Where:

ParameterDescription
cReturns the new connection cell array.
ip
(optional)
Specifies the new bridge’s IP address. If not specified, the function will search for new bridges in the local network.

Examples

Search and add new HUE bridge:

c = huenew

Note: Some windows might open.

Exemplary result:

{
  [1,1] =

    scalar structure containing the fields:

      ip = 192.168.XXX.XXX
      user = ABCDEFGHIJKLMN-abcdefghijklmn-1234567890
      id = 0123456789abcdef
      cer = hue_cacert_0123456789abcdef.pem

}

Search and add new HUE bridge with specific IP address:

c = huenew('192.168.XXX.XXX')

Reference

Signify Netherlands B.V.: Philips HUE API version 1. High Tech Campus 48, Eindhoven; Netherlands, 2014.

Leave a comment

* I accept the use of cookies as well as the terms in the privacy policy. I accept that data provided by me is processed and saved. I know that comments are saved and published after review.