HueTap Switch control non Hue Lights?

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 :frowning:

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?

Will that work?

Yep.

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.

String	HueDimmerButton 	"Dimmer Button [%s]"	{ http="<[http://192.168.2.146/api/<key>/sensors/9:1000:JS(getDimmerButton.js)]" }
String	HueDimmerUpdated	"Dimmer When [%s]"	{ http="<[http://192.168.2.146/api/<key>/sensors/9:1000:JS(getDimmerUpdated.js)]" }
DateTime HueDimmerEventDate "Hue datetime [%1$td.%1$tm.%1$tY %1$tR]" { http="<[http://192.168.2.146/api/<key>/sensors/9:5000:JS(getDimmerUpdated.js)]" }

Then use the following as the js files in the transform folder

(function(i) {
    var json = JSON.parse(i);
    return ((json['state']['buttonevent']));
})(input)

(function(i) {
    var json = JSON.parse(i);
    return ((json['state']['lastupdated']));
})(input)

@unparagoned

Thanks for the help and I’m back to trying to set this up and unsure exactly how to proceed and have a few questions.

  1. I think the in the items file should be what I see in my Hue bridge item in Habmin? ie, the one beneath the unecrypted username?

  2. Is the 9:1000 and 9:5000 the hue item number from hue? ie, is 9 your 9th accessory item? I’m not sure how to determine, find that info.

  3. The js files should go in your scripts folder? Does OH2 know to look their for the js files?

  4. I’m not sure how you would set up the rule(s) here to control and pass the dimmer values over to an Item.

  1. I don’t use Habmin, so I’m not going to be much use.
  2. 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.
  3. Openhab defaults to the transform folder. So if they are in that folder then the item will find the script in that folder.
  4. 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

EDIT: The js should go in the transform folder