Thursday, April 12, 2018

Control Sonos outside your home using HomeKit

Applying the same concept as the Aeotec Dimmer for Homekit control, we can also use the Domoticz virtual dimmer to control the Sonos using node-sonos-http-api.

Homekit > Domoticz Virtual Dimmer (LUA) > node-sonos-http-api > Sonos

I'm starting to derive a shorter version of the LUA script for easier maintenance and using the base On and Off action commands on Virtual Device configuration page. Replace the IP address with the raspberry pi running node-sonos-htttp-api.

Virtual Device Name SonosOne_Volume

Action On Command: http://192.168.1.XX:5005/Sonos%20One/play
Action Off Command: http://192.168.1.XX:5005/Sonos%20One/pause

LUA script


commandArray = {}


if otherdevices[DEV] == 'Off' then
        os.execute('curl "http://192.168.1.XX:5005/Sonos%20One/pause"')
        Level = otherdevices_svalues[DEV]
        os.execute('curl "http://192.168.1.XX:5005/Sonos%20One/volume/"'..Level)

return commandArray

No comments:

dead pi

Well, I guess it has to happen at some point. the home automation raspberry pi has died. Much to do with the stupid Strontium mini SD card. ...