I may pick up a Hue Tap Switch today to ‘play’ with, but really want to use it with my basement non-hue zigbee Osram bulbs. As far as I know you still can’t use an Osram/Sylvania zigbee bulb with Hue in the USA even after Hue went to zigbee 3.0
But since I have both the Osram bulbs connected to OH2 and the zigbee binding. I think (hope) I can add a Hue tap Switch to my Hue Hub. And then add the Tap Switch as an item in OH2 and via a rule have that Tap Switch update the non Hue Bulbs connected to OH2?
Here is my setup with the dimmer buttons, so just adapt them to your set-up. You can make an item items as follows then use them in a rule as normal. These update once a second so there is some lag but you could increase the poll rate.
I don’t use Habmin, so I’m not going to be much use.
Yep the 9th item is the 9th item form your HUE. To find out what item it is, what else you can get, etc. just open up the main page and see what is there, they are all prefixed with their number. http://192.168.2.146/api/<key>/sensors/
To go all out you can see everything available at http://192.168.2.146/api/<key>/
The second figure is the refresh rate, too high and you’ll miss things and it will take too long to update. Too fast and you’ll DOS your hub or overload your pi.
Openhab defaults to the transform folder. So if they are in that folder then the item will find the script in that folder.
Here are some rules I wrote a while ago. I don’t actually use them atm so the code may be a bit weird but you should get the idea.
var DateTime timePress
var int intDiff
var DateTime previousDateTime
var int pressNumber = 0
rule "Hue Dimmer Button pressed"
when
Item HueDimmerUpdated changed
then
logInfo( "Hue dimmer", "pressed at [{}] after [{}]", HueDimmerUpdated.state, previousState)
timePress= DateTime.parse(HueDimmerUpdated.state.toString)
previousDateTime=DateTime.parse(previousState.toString)
intDiff=(timePress.millis - previousDateTime.millis).intValue
logInfo( "Hue dimmer", "time between presses [{}]", intDiff)
if(intDiff < 5000){
pressNumber = pressNumber + 1
} else{
pressNumber = 1
}
logInfo( "Hue dimmer", "Presses in a row {}", pressNumber )
if(HueDimmerButton.state == "1002"){
logInfo( "Hue dimmer", "On" )
}
if(HueDimmerButton.state == "2002"){
logInfo( "Hue dimmer", "Brighten")
if( pressNumber > 1){
sendCommand(SceneGeneral, 4)
}else{
sendCommand(SceneGeneral, 2)
}
}
if(HueDimmerButton.state == "3002"){
logInfo( "Hue dimmer", "Dimm" )
switch (pressNumber)
{
case 1: {
sendCommand(SceneGeneral, 2)
}
case 2: {
sendCommand(SceneGeneral, 5)
}
case 3: {
sendCommand(SceneGeneral, 6)
}
default: {
sendCommand(SceneGeneral, 6)
}
}
}
if(HueDimmerButton.state == "4002")
{
logInfo( "Hue dimmer", "Off" )
}
end