Is your config working without the tags ?
Yes. The switches/items control their specified devices without any issues.
According to the docs, the following Item config should work in your case :
Switch Hallway "Hallway Lights" [ "Switchable" ] { tcp="<[10.5.1.6:3040:'MAP(m90.map)'], >[ON:10.5.1.6:3040:'MAP(90.map)'],>[OFF:10.5.1.6:3040:'MAP(90.map)'] ", autoupdate="false" }
Thank You!!! That switch workedâŠ
I wonder why the âLightingâ tag did notâŠ
Switch Hallway "Hallway" [ "Lighting" ]
Is it device specificâŠ
From the docsâŠ
Device Taggingî
To expose an item on the service, apply a supported tag (which are âLightingâ, âSwitchableâ, âTargetTemperatureâ) to it. The item label will be used as the Hue device name.
Switch TestSwitch1 âKitchen Switchâ [ âSwitchableâ ]
Switch TestSwitch2 âBathroomâ [ âLightingâ ]
Dimmer TestDimmer3 âHallwayâ [ âLightingâ ]
Number TestNumber4 âTemperature Set Pointâ [ âTargetTemperatureâ ]
The [âLightingâ] tag definitely works for me. Here is an insteon item that works:
Dimmer dining_room "Dining Room" <dimmablelight> ["Lighting"] {insteonplm="xx.xx.xx:F00.00.01#dimmer"}
I donât see any reason why the TCP binding item should not also work, at least in theory. I am also using the TCP binding in my setup, but only for âSwitchableâ items.
Note though, if youâre just using the Hue Emulation for Alexa, and not HomeKit, it doesnât seem to matter if you specify Lighting or Switchable, they both identify as âDimmable Lightâ to Alexa. HomeKit does differentiate.
As regards this problem with OH2:
I was finally able to solve this issue. I installed openhab on a second Raspberry Pi system because I thought I was going to have to just run multiple instances to cover all my devices. However, on the new installation, I could not reproduce this bug. I was able to get Alexa to see 90+ devices with no problem.
I tried a bunch of other things to repair the first installation, but in the end it was the nuclear approach that worked. From the osgi console, I typed:
smarthome:items clear
smarthome:links clear
I also deleted the contents of the following directories:
/var/lib/openhab2/cache
/var/lib/openhab2/hueemulation
/var/lib/openhab2/mapdb
Note: be careful with these commands! This will delete all of your extensions, your hue emulator pairing data, and your mapdb database! Of course, you can just reinstall your extensions through Paper UI or they will be automatically reinstalled if you have them defined in addons.cfg, but your item state DB will be lost.
I canât even really recommend this approach since Iâm not sure exactly which part solved my problem, but if anyone else has a similar issue at some point, these are just some things you can try.
Oh, one other thing I should mention, I also updated to an OH2 nightly build from beta4. Iâm running build 576. I tried updating first though, and that did not solve the problem - only the steps above did, but itâs worth mentioning since perhaps updating does factor in to this process somehow.
(I posted this in the other thread as well, just in case it helps someone)
I wonder if the issue boils down to the item type?
Maybe âLightingâ only works on DIMMERS and not SWITCHES ?
I also have items defined like this:
Switch foyer "Foyer" <light> ["Lighting"] {insteonplm="xx.xx.xx:F00.00.02#switch"}
Just to chime in here, I have just got this up and running in the last few days. I also was having a terrible time getting the tags to work in my Items files. Specifically in my insteon.items file (which has most of my light in it), the insteon binding would not start correctly, if I had just one tag in it.
I finally gave up on adding tags to existing items files, and created a new items file specifically for Alexa/Homekit. This has the advantage that I can customize the label to make a better sounding voice command. This does have the drawback that I need to also create a rules file, to contain one rule for each Alexa/Homekit item. Iâm only using it for Alexa at the moment, as Siri is a bit more complicated.
An advantage of this is that I can customize exactly what each voice command does - so I can trigger sequences etc. For example, when I say âAlexa, TV Lights ONâ, the TV lights are actually only set to 10%, as that is my normal âONâ setting. I can say âAlexa, TV Lights to 50%â and they do switch to 50%, Iâm just intercepting 100% and changing it to 10% in the rule.
It does make for a maintenance nightmare, and a lot of duplicated rules. nearly all of them look like this (2 rules one to send to the item, one to receive updates from the item):
rule "Homekit diningLight_HK"
when
Item diningLight_HK received command
then
logDebug("HomeKit", "diningLight_HK received command " + receivedCommand)
sendCommand(diningLight, receivedCommand)
end
rule "Homekit diningLight"
when
Item diningLight changed
then
postUpdate(diningLight_HK, diningLight.state)
end
I have played about with groups, to try to reduce this to one rule for all homekit items (with exceptions), but openhab1/2 has no way to get an item from a string - so that stumps me every time. Currently this works well with both lighting and switches, plus custom items (I have a switch that turns the TV and cable box on/off - which is more complicated than it sounds as the TV can only be turned on via IR, and the cable box is only ir and doesnât have an on/off command - just toggle).
I have 44 items working this way currently (so yes I have 88 rules, that nearly all do the same thing). I know Alexa has no way to get feedback from an item (ie Alexa, is the TV on?) via the smarthome interface, but in the future Iâm hoping to implement a custom Skill that will allow this, just⊠one step at a time.
Iâm also having trouble with finding the right phrases to use. ON/OFF works, set X to Y works, but this link http://lovemyecho.com/2016/04/27/new-amazon-echo-alexa-smart-home-commands/ claims that there are a lot more commands that should work. The only one I can get to work is ârunâ. So to lock the front door I have to say âAlexa, turn the front door ONâ, as âAlexa, lock the front doorâ does not. Any suggestions? maybe itâs my voice?
If anyone has any suggestions on how to simplify this, I am open to improvements. Iâm currently running OH2 build 570 (not upgrading at the moment as the debian nightly builds were broken for while).
Hi,
Iâm getting a very strange problem with thisâŠ
Iâm using OH2 with an Echo and KNX binding, and Iâve just started trying Eclipse Smarthome designer to validate config files.
Hereâs an example of some lighting items in my .items file:
Switch Light_GF_Kitchen_LED "LED" (Kitchen, Lights) [ "Lighting" ] {knx="1/1/18+<1/2/18"}
Switch Light_GF_Kitchen_Island "Island" (Kitchen, Lights) [ "Lighting" ] {knx="1/1/19+<1/2/19"}
Switch Light_GF_Lounge_Side "Lounge" (Living,Lights) [ "Lighting" ] {knx="1/1/13+<1/2/13"}
Iâve only just got this working by moving where the [âLightingâ] tag is placed! ie, putting it after the group names and before the knx settings.
Previously I had the tag just before the group names as below:
Switch Light_GF_Kitchen_LED "LED" [ "Lighting" ] (Kitchen, Lights) {knx="1/1/18+<1/2/18"}
Switch Light_GF_Kitchen_Island "Island" [ "Lighting" ] (Kitchen, Lights) {knx="1/1/19+<1/2/19"}
Switch Light_GF_Lounge_Side "Lounge" [ "Lighting" ] (Living,Lights) {knx="1/1/13+<1/2/13"}
But this was not working. Itâ seemed to implement the first item âLEDâ, then ignore all the other switches - not just in the Echo, but on the basic UI too.
Opening the .items file in Eclipse Smarthome designer showed an error on the first ( just before âKitchenâ in the first line when i have the tag before the group names.
Really odd. Is this a known issue, do you need to be very specific where you put the tag, or is there something Iâm getting wrong in my items file?
Pete
I think that you do need to be specific about where you put the tag, just before the binding seems to be the best place. Having said that, I have some items files where the tags just stop things working. There is definitely something wrong with the way the tags work. Thatâs why I put them in their own items file, with no bindings.
Ah, so you add the tag in a separate file - thatâs a neat idea.
Yes, you need to be very specific in the order that you define the parameters of your items. It HAS to be:
ItemType item_id "itemName" <icon> (group) ["tag"] {binding}
Real example:
Switch bedroom_fan "Bedroom Fan" <light> (gBedroom) ["Switchable"] {insteonplm="xx.xx.xx:F00.00.02#switch"}
If you put the item parameters in ANY other order, openhab will silently fail, and moreover, any items defined after that item in that same items file will be ignored. At the very least, the error is not reported with the default log settings.
This is touched on in the wiki, but that needs an update. It does not cover square bracket [âtagsâ] for HK/HE - in fact it uses square brackets to denote âoptionalâ items which is just confusing. Also it does not mention the fact that this syntax is strictly enforced.
@Nicholas_Waterton, I am running OH2 build 576 and I have no trouble controlling insteon devices through Alexa using this binding. I use the syntax order defined in my previous post. Does alexa still not see your items if you use that exact syntax? If youâd like to try to get it working and ditch the rules, you could post an example for us to look at. You might also try some of the commands I posted earlier. Running smarthome:items clear
and smarthome:links clear
from the OSGI console (then restarting OH) is pretty safe and seems to clear up some problems in my experience.
Regarding this:
I didnât write the binding, but from what I can tell by inspecting the output and looking at the source, the binding seems to identify everything as a simple dimmable light to Alexa. I donât see a way for the binding to support anything other than ON/OFF/Level commands right now. I use a similar workaround for my XBMC binding (âAlexa, turn on Playâ, âAlexa, turn on Stopâ).
-Anthony
Thanks,
Iâts not that Alexa doesnât see the items, the Insteon binding doesnât start up properly if I have even one tag defined, and according to the syntax you mention. It may be something to do with my insteon items file, as I have a lot of insteon items.
Also, having all the Alexa/homekit items in one file does make it easier to manage. Iâm working on simplifying the rules using a (homekit) group. It does work well with the myriad of rules though.
The thing with ON/OFF or LOCK/UNLOCK is more to do with Alexa than the binding. Alexa is supposed to recognize certain things as synonyms for ON/OFF (like LOCk/UNLOCK, OPEN/CLOSE), but she doesnât. The only one I have had work is âRunâ which is the same as âTurn ONâ. So for instance I can say âAlexa, Run Bedtimeâ, and my bedtime switch is toggled ON - which starts my âshutdown at bedtimeâ rule.
I was wondering if anyone know if this is a real thing, future thing, rumor or what. As I said, this claims that they work: http://lovemyecho.com/2016/04/27/new-amazon-echo-alexa-smart-home-commands/
Just to update everyone, I have successfully reduced my large number of rules down to two (well three, I have an initialization rule also)âŠ
So I now have one items file with all Homekit tags in it, and crafted labeling to work with speech, and one rules file with three rules in it for managing the translation from Alexa to items. Iâm not sure if this works with Siri also, as thatâs a bit more complicated (but it should, my initial Siri tests were successful) - and I have been focusing on Alexa. Still not totally sure about Thermostat control, but I have a Nest thermostat, and using the built in Nest smarthome controls for Alexa works just fine. I can set the temperature just by saying âAlexa, set the temperature to xâ, but itâs not very accurate, always off by a degree or two. Using The Thermostat control Skill is a lot more accurate, and all I have to say is âAlexa, tell the Thermostat to set the temperature to xâ, which works as well, and you get feedback as to whether the temperature was set correctly or not (and you can ask for the settings, humidity etc.).
The only caveat with this set up, is that all controlled items have to be part of a group which ultimately is a subgroup (of a subgroup ⊠etc) of a group called âAllâ (you can call it what you like, but I use All). ie you canât control an item which is not in a group at all, or is in an isolated group which isnât linked into the hierarchy (unless thatâs the name you use in the initialization rule). I had to add a group to a couple of dummy switches which didnât have them, but my system is set up this way anyway, so not an issue for me.
This is my Items file:
/* Kludge for homekit/Alexa for OH V1 items Items, as can't add tags to items directly
Only include items for homekit/Alexa to control here
Duplicated from various.items - give meaningful names for Alexa though!
Note: two items defined in Hue.items
*/
Group homekit "Homekit Items [%s]" <house> (All)
Group Nest_Thermostat "Nest Thermostat Status" <climate> (All) ["Thermostat"]
/* Insteon items */
/* oddities */
Dimmer christmasTree_HK "Christmas Tree [%d%%]" <christmas_tree> (homekit) ["Lighting"]
/* Porch */
Switch frontgardenPower_HK "Front Power [%s]" <poweroutlet> (homekit) ["Switchable"]
Dimmer porchLightKuna_HK "Porch [%d%%]" (homekit) ["Lighting"]
Dimmer drivewayLightKuna_HK "Driveway [%d%%]" (homekit) ["Lighting"]
/* Basement */
Switch basementFluorescents_HK "Basement Main[%s]" (homekit) ["Lighting"]
Dimmer workshopBulb_HK "Workshop[%d%%]" (homekit) ["Lighting"]
Switch workbenchLight_HK "Workbench [%s]" (homekit) ["Lighting"]
Dimmer frontBulb_HK "Basement Front [%d%%]" (homekit) ["Lighting"]
Dimmer backBulb_HK "Basement Back [%d%%]" (homekit) ["Lighting"]
Dimmer laundryBulb_HK "Laundry [%d%%]" (homekit) ["Lighting"]
Dimmer basementEntry_HK "Basement Stairs [%d%%]" (homekit) ["Lighting"]
Switch basementOutlet_HK "LED Controller Power [%s]" <poweroutlet> (homekit) ["Switchable"]
/* Ground Floor */
/* Hallway */
//Dimmer porchLight_HK "Porch[%d%%]" (homekit) ["Lighting"]
Dimmer hallwayLight_HK "Hallway [%d%%]" (homekit) ["Lighting"]
/* Washroom */
Dimmer washroomLight_HK "Washroom [%d%%]" (homekit) ["Lighting"]
/* Kitchen */
Dimmer kitchenPendants_HK "Pendants [%d%%]" (homekit) ["Lighting"]
Dimmer kitchenUCLED_HK "Kitchen Cabinet [%d%%]" (homekit) ["Lighting"]
Dimmer kitchenPots_HK "Kitchen Pots [%d%%]" (homekit) ["Lighting"]
/* Kitchen Dining Room */
Dimmer diningPots_HK "Dining Pots [%d%%]" (homekit) ["Lighting"]
/* Family Room */
Dimmer familyMain_HK "Main[%d%%]" (homekit) ["Lighting"]
Dimmer familyLamp_HK "Lamp [%d%%]" (homekit) ["Lighting"]
Switch fireplace_HK "Fireplace" <fireplace> (homekit) ["Switchable"]
/* Living Room */
Dimmer livingLight_HK "Living Room [%d%%]" (homekit) ["Lighting"]
/* Dining room */
Dimmer diningLight_HK "Dining Room [%d%%]" (homekit) ["Lighting"]
/* First Floor */
/* landing */
Dimmer landingMain_HK "Landing [%d%%]" (homekit) ["Lighting"]
/* Main Bathroom */
Dimmer bathroomLight_HK "Bathroom [%d%%]" (homekit) ["Lighting"]
/* Master Bedroom */
//Dimmer masterBRDimmer_HK "Bedroom Light [%d%%]" (homekit) ["Lighting"]
/* en-suite */
Dimmer ensuiteLight_HK "EnSuite [%d%%]" (homekit) ["Lighting"]
/* Back garden */
//Dimmer gardenLight_HK "Garden [%d%%]" (homekit) ["Lighting"]
Dimmer gardenLightKuna_HK "Garden [%d%%]" (homekit) ["Lighting"]
Switch gardenPower_HK "Fountain [%s]" <poweroutlet> (homekit) ["Switchable"]
/* Zwave items */
Switch basementHeater_HK "Basement Heater [%s]" <poweroutlet> (homekit) ["Switchable"]
Dimmer RGBWControllerW_HK "TV Lights [%d%%]" (homekit) ["Lighting"]
Switch exhaustFanLightSwitch_HK "Range Hood[%s]" <range_hood> (homekit) ["Switchable"]
/* Http Items */
Switch bedtime_setting_HK "Bedtime [%s]" <bedroom> ["Switchable"]
Switch activate_movie_mode_HK "Movie Time [%s]" <television> ["Switchable"]
/* Nest Items */
String dining_room_hvac_mode_HK "Mode [MAP(homekit):%s]" <climate> ["homekit:HeatingCoolingMode"]
Number dining_room_ambient_temperature_c_HK "Temperature [%.1f °C]" <temperature> ["CurrentTemperature"]
Number dining_room_humidity_HK "Humidity [%d %%]" <humidity> ["CurrentHumidity"]
Number dining_room_target_temperature_c_HK "Temperature [%.1f °C]" <temperature> ["TargetTemperature"]
/* mios items */
Switch frontDoorLock_HK "Front Door [%s]" <lock> (homekit) ["Switchable"]
/* GCIR100 items */
Switch TVPVR_Power_HK "TV" <television> (homekit) ["Switchable"]
/* mqtt items */
Switch DIRECTsequence_HK "Fence" <terrace> (homekit) ["Switchable"]
/* Samsung TV Items */
Switch Skype_Answer_HK "Skype [%s]" <television> (homekit) ["Switchable"]
Dimmer TV_Volume_HK "Television Sound [%s]" <soundvolume> (homekit) ["Lighting"]
And this is my rules file:
/* Homekit/Alexa Rules to work around insteon/items problem */
import java.util.HashMap
import java.util.Map
import java.util.concurrent.locks.Lock
import java.util.concurrent.locks.ReentrantLock
var ReentrantLock HomekitLock = new ReentrantLock(false)
var Map <String, Object> HomekitStates = newHashMap
var Map <GenericItem, Object> ItemStates = newHashMap
var Map <String, GenericItem> ItemObjects = newHashMap
rule "Initialize Homekit Items"
when
System started
then
logDebug("HomeKit","Initializing Homekit Items")
homekit?.members.forEach[i |
HomekitStates.put(i.name, i.state)
var realitem_name = i.name.split("_HK").get(0)
//NOTE: for this to work, all (real) items controlled via homekit must be part of a group that is a subgroup (ultimately) of All
var realitem = All?.allMembers.filter[ i | i.name == realitem_name].head as GenericItem
if(realitem != null) {
ItemStates.put(realitem, realitem.state)
ItemObjects.put(realitem.name, realitem)
}
]
logDebug("HomeKit","Initializing Homekit Items Complete")
end
rule "Homekit Item Changed"
when
Item homekit received update
then
logDebug("HomeKit","Homekit Item received update")
//logDebug("HomeKit", "HomekitStates contains: " + HomekitStates)
homekit?.members.forEach[ i |
var prevstate = HomekitStates.get(i.name) //get previous state
//logDebug("HomeKit", "Checking Item: " + i.name + " prev state: " + prevstate + " curr state: " + i.state)
if(prevstate != i.state) { //if previous state != current state
logDebug("HomeKit", "FOUND!!!! Item: " + i.name + " changed from " + prevstate + " to " + i.state)
HomekitStates.put(i.name, i.state) //update state MAP
var realitem = i.name.split("_HK").get(0) //get realitem name
var realItemObject = ItemObjects.get(realitem) //get realitem object
if(realItemObject == null) logDebug("HomeKit", "real item: " + realitem + " Not found in a Group!")
if(realItemObject.state != i.state) {
var command = i.state.toString //command to send
var commanditem = realitem //item to send it to
switch(realitem) {
case "DIRECTsequence" : if(i.state == ON)
command = "8"
else
command = "2"
case "Skype_Answer" : if(i.state == ON)
command = "KEY_ENTER" //send enter to answer SKYPE
else
command = "KEY_EXIT" //send exit to hang up
case "RGBWControllerW" : if(i.state == 100)
command = "10" //set to 10% with ON command
case "TV_Volume" : if(i.state == 0) {
commanditem = "TV_Mute"
command = "ON"
}
else if (i.state = 100) {
commanditem = "TV_Mute"
command = "OFF"
}
}
sendCommand(commanditem, command)
logDebug("HomeKit", "Sent Command to realitem: " + commanditem + " to " + command)
}
else logDebug("HomeKit", "current state of: " + realitem + " is " + realItemObject.state + " so not sending command")
}
]
//logDebug("HomeKit","End of Homekit Item Received Update rule")
end
rule "Real Item Changed"
when
Item christmasTree changed or
Item frontgardenPower changed or
Item porchLightKuna changed or
Item drivewayLightKuna changed or
Item basementFluorescents changed or
Item workshopBulb changed or
Item workbenchLight changed or
Item frontBulb changed or
Item backBulb changed or
Item laundryBulb changed or
Item basementEntry changed or
Item basementOutlet changed or
Item hallwayLight changed or
Item washroomLight changed or
Item kitchenPendants changed or
Item kitchenUCLED changed or
Item kitchenPots changed or
Item diningPots changed or
Item familyMain changed or
Item familyLamp changed or
Item fireplace changed or
Item livingLight changed or
Item diningLight changed or
Item landingMain changed or
Item bathroomLight changed or
Item ensuiteLight changed or
Item gardenLightKuna changed or
Item gardenPower changed or
Item basementHeater changed or
Item RGBWControllerW changed or
Item exhaustFanLightSwitch changed or
Item bedtime_setting changed or
Item activate_movie_mode changed or
Item dining_room_ambient_temperature_c changed or
Item dining_room_humidity changed or
Item dining_room_target_temperature_c changed or
Item frontDoorLock changed or
Item TVPVR_Power changed or
Item DIRECTsequence changed or
Item TV_Volume changed or
Item TV_Mute changed or
then
logDebug("HomeKit", "Real Item changed Rule")
//logDebug("HomeKit", "ItemStates contains: " + ItemStates)
ItemStates.forEach[ i, s |
//logDebug("HomeKit", "Checking Item: " + i + " prev state: " + s + " curr state: " + i.state)
if(s != i.state) { //if previous state != current state
var realitem = i.toString.split(" ").get(0) //get real item name
logDebug("HomeKit", "FOUND!!!! Updated Item: " + realitem + " changed from " + s + " to " + i.state)
ItemStates.put(i, i.state) //update state MAP
var homekititem = realitem + "_HK" //make homekite item name
var homekitstate = HomekitStates.get(homekititem) //get homekit item state from MAP (NULL on startup)
if(homekitstate!=i.state) { //if previous state != current state
var update = i.state.toString
switch(homekititem) {
case "DIRECTsequence_HK" : if(i.state > 2)
update = "ON"
else
update = "OFF"
}
postUpdate(homekititem, update)
logDebug("HomeKit", "Post Updated homekititem: " + homekititem + " to " + update)
}
else logDebug("HomeKit", "current state of: " + homekititem + " is: " + homekitstate + " so not updating")
}
]
//logDebug("HomeKit","End of Real Item Changed rule")
end
@digitaldan I have read through this thread carefully I think, and it says that you should install the hue emulation with the paper UI, however I can not find it, so should i use this link instead?
Found it, its not under binding, but misc! However alexa does not find any devices, my item is defined like this:
Switch Light_Module1 "Module 1" (Group_LivingRoom,Lights,Group_LightLogging) ["he:Module 1"] {gpio="pin:12"}
So I think it might be due to the fact the rpi is connected by cables while all the alexas are connected by wifi, hence on not on same network. Is this the case?
It doesnât matter how you connect devices, wireless and cabled clients end up in the same broadcast domain.
Did your rpi connected to the same wifi router as your echo?
Did you restarted hue emulation service or OH2 after youâve added the item mark?
Did you ask Alexa to search for the new devices?
@sasha_jpr I got it working! I had to type in the IP of the router which rpi were connected to, I also rewrote the item to this: Switch Light_Module1 "Module 1" (Group_LivingRoom,Lights,Group_LightLogging) [ "Lighting" ] {gpio="pin:12"} //Relay 16
Now that works fine, except that alexe has problem with labels XXXX 1 and so on, is there a way I can have synonym labels, like Switch Light_Module1 ["Module 1", "Module east"]
?
A tip for everyone who uses scenes are to create a new switch for each scene:
Number Scene_General "Scene" <sofa>
Switch Scene_General_Reading "Reading" [ "Lighting" ]
Switch Scene_General_Dinner "Dinner" [ "Lighting" ]
Switch Scene_General_Tv "Tv" [ "Lighting" ]
Switch Scene_General_Off "Lights Off" [ "Lighting" ]
Then a new rule which triggers the old rule:
rule "Activate Scene Reading HUE"
when
Item Scene_General_Reading received command ON
then
sendCommand(Scene_General ,3)
end
rule "Activate Scene Reading"
when
Item Scene_General received command 3
then
sendCommand(Light_Module1, OFF)
sendCommand(Light_Module2, OFF)
sendCommand(Light_Module3, ON)
sendCommand(Light_Module4, ON)
sendCommand(Light_Hallway, OFF)
sendCommand(Light_Kitchen,OFF)
end