Homekit and Harmony

Playing with different ways to make Homekit (and Siri) control my entertainment system, and I produced some positive results so thought I would share. May be intuitive to some and my solution is no doubt clunky, but I hadn’t seen it before. As in the thread title, I am aided by a Harmony Hub. The idea was to voice command TV channels (DirecTV) via Siri.

First, need to create Harmony Hub buttonPress item for Genie Mini.

String HarmonyHubDirecTV    "Harmony DTV"		(gHarmony)		                 { channel="harmonyhub:device:LRHub:5908****:buttonPress" }

Next is the “dummy” switch for Homekit to recognize. I don’t call them dummy switches in their names as some do, I just place in a different *.items file. Below is the switch for turning channel to CNN, obviously.

Switch CNN					"CNN"				(gHarmony) 	[ "Switchable" ]

Last, a rule to execute.

rule "Turn to CNN"
        		Item CNN changed from OFF to ON

If you have DirecTV, you’ll know that CNN is channel 202. The last line just turns off the CNN switch in Homekit.

Siri may have trouble with “turn on CNN” as a command. Siri may be trying to open an app (if installed) or a website, it has been inconsistent for me. The workaround is to just change the name in Homekit to something familiar. I tried “Ted Turner” and it worked fine.

1 Like

To be consistent with your syntax you should be doing:


The postUpdate command is advised rather that the postUpdate Action:
Reasons there:

I’ve seen both ways, but as a novice I wasn’t sure which was right. If it works, why is another way better?

If you had read the link I sent you you would have seen:

Using MyItem.postUpdate(new_state) or MyItem.sendCommand(new_state) will create the most stable code. It provides by far the best option for avoiding most problems. This syntax ensures that any conversion (typing) of the new_state is done in a way that is most suitable for myItem .

Ah yes. Trust me, I wouldn’t have gotten as far as I have without reading the rules page. For someone who doesn’t write code, or only played with VB 25 years ago, it can be a complex read. Anyway, I have read more rules examples to further understanding, and I most likely lifted that syntax from someone’s sample.