Skip to content

Commit

Permalink
- will now publish a non-retained message to topic/status/authrequired
Browse files Browse the repository at this point in the history
if authentication is required.
  • Loading branch information
owagner committed Jun 11, 2016
1 parent 0db93d2 commit a18097b
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 2 deletions.
9 changes: 7 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,10 @@ Like all applications connecting to a Hue bridge, hue2mqtt needs to be authentic
at least once. The bridge will then assign a whitelist username (in fact a token) which is automatically
used on subsequent connections. The token is stored using Java Preferences.

When authentication is required, a one-shot not retained message is published to topic

hue/status/authrequired


### Available options:

Expand All @@ -101,7 +105,7 @@ used on subsequent connections. The token is stored using Java Preferences.

- mqtt.clientid

ClientID to use in the MQTT connection. Defaults to "knx2mqtt".
ClientID to use in the MQTT connection. Defaults to "hue".

- mqtt.topic

Expand All @@ -121,8 +125,9 @@ Dependencies
History
-------
* 0.12 - 2016/06/11 - owagner
- will now always go through bridge recovery. Bridges can be specified using either their ID (preferred) or IP.
- will now always go through bridge discovery. Bridges can be specified using either their ID (preferred) or IP.
Username is stored per ID.
- will now publish a non-retained message to topic/status/authrequired if authentication is required.

* 0.11 - 2016/05/28 - owagner/hobbyquaker
- adapted to new 1.8.1+ API scheme of whitelist usernames being assigned by the bridge.
Expand Down
1 change: 1 addition & 0 deletions src/main/java/com/tellerulam/hue2mqtt/HueHandler.java
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,7 @@ public void onAuthenticationRequired(PHAccessPoint pap)
{
L.severe("IMPORTANT! AUTHENTICATION REQUIRED -- press the button on your Hue Bridge "+pap.getIpAddress()+" within 30s to authenticate hue2mqtt!");
phHueSDK.startPushlinkAuthentication(pap);
MQTTHandler.notifyAuthRequired();
}

private void reportGroups(PHBridgeResourcesCache cache)
Expand Down
12 changes: 12 additions & 0 deletions src/main/java/com/tellerulam/hue2mqtt/MQTTHandler.java
Original file line number Diff line number Diff line change
Expand Up @@ -389,4 +389,16 @@ public static void setHueConnectionState(boolean connected)
}
}

public static void notifyAuthRequired()
{
try
{
instance.mqttc.publish(instance.topicPrefix+"status/authrequired","1".getBytes(),1,false);
}
catch(MqttException e)
{
/* Ignore */
}
}

}

0 comments on commit a18097b

Please sign in to comment.