OpenHAB 2, HomeKit and Sonos


(Matt Quinney) #1

Hi all,

I’m new to OpenHAB 2 and am trying to integrate my Sonos through HomeKit.

I have setup OpenHAB and Sonos and the integration is working. I can see the two speakers and control them etc.

HomeKit integration is working well too. On my iPhone I can see an OpenHAB switch which I have defined and this can control the Sonos through an OpenHAB rule to play/pause the speaker.

Ultimately what I would like to do is to use Siri to control Sonos and initiate a playlist/favourite etc. It seems that the best way to do this is to define an accessory such as a switch and then use an OpenHab rule:

rule “Kitchen_Sonos_Kids”
when
Item Kitchen_Sonos_F_Kids changed to ON # HomeKit Accessory name
then
{
sendCommand([Favorite:Kids], “RINCON_949F3E02681C01400”)

}
end

However, I do not seem to have the correct syntax for favourites (US or UK) and get an error message about ‘Item’ not found in the Karaf console.

Can anyone help?

Many thanks,

Matt


(Simon#56) #2

Hi Matt, I’m also new to OH and I’m trying to control play/pause my SONOS from my iPhone via HomeKIT.
OH is setup, I have my SONOS working from PaperUI and I got HomeKIT working with my iPhone. I can control my lights.
For the lights I had to add these manualy to the homekit.items file and link them to the Channels, this works.
However I cannot get my SONOS to work from HomeKIT on my iPhone.

did you manage to control your Sonos? can you share how you did this?


(Vincent Regaud) #3

This thread is 2 years, old

Please open a new one and try to follow this:


(Simon#56) #4

I managed to fix it.

Added the following lines to the existing homekit.items file:

Blockquote
Switch SonosWerkkamer5 “SonosConnectAmpWerkkamer_Radio” (gWerkkamer) [ “Switchable” ]
Switch SonosKeuken “SonosPlay3ConnectKeuken_Radio” (gWerkkamer) [ “Switchable” ]

created sonos.rules file with the following lines:

Blockquote
// Play or pause Bedroom5 or Kitchen speakers, with Apple HomeKIT
rule “play or pause bedroom5 speakers”
when
Item SonosWerkkamer5 received update
then
if (SonosWerkkamer5.state==ON) {
sendCommand(sonos_CONNECTAMP_RINCON_000E5836694401400_control, PLAY)
} else {
sendCommand(sonos_CONNECTAMP_RINCON_000E5836694401400_control, PAUSE)
}
end
rule “play or pause kitchen speakers”
when
Item SonosKeuken received update
then
if (SonosKeuken.state==ON) {
sendCommand(sonos_PLAY3_RINCON_B8E937D3655401400_control, PLAY)
} else {
sendCommand(sonos_PLAY3_RINCON_B8E937D3655401400_control, PAUSE)
}
end