Sonos - advanced automations

  • Updated

Intro

You can create automations through Thingsplex flows.

To access Thingsplex, please follow the Thingsplex guide.

If you make a flow that works well for you, and you want to share it with the rest of the Futurehome community, please do so in forum.futurehome.io.

Automation example

As an example we have created an automation to have your music start playing when there is motion, and stop playing when motion is no longer detected.

The source code is available at the bottom of this document. To make this flow work for you, follow these steps:

  1. Copy the source code at the bottom of this document.
  2. Click on «import» in flows and paste the source code provided.
  3. Change the address of the motion sensor.
    1. Click on the trigger node.
      image
    2. Under "Advanced service binding", change the address of your motion sensor. You can find the address of your device in the Futurehome app as shown below (go to settings, devices, and find your motion sensor).
      imageimage

  4. Change the address of the Sonos device.
    1. Click on the action node.
      image
    2. Under "Advanced service binding", change the address of your Sonos device. You can find the address of your device in the Futurehome app as shown below (go to settings, devices, and find your Sonos device).
      imageimage
  5. Save.

List of supported interfaces:https://github.com/thingsplex/sonos-ad

Source code

  • {
     "Id": "D7spKRB6EBGPilz",
     "ClassId": "D7spKRB6EBGPilz",
     "Author": "",
     "Version": 0,
     "CreatedAt": "2020-07-28T13:23:06.661122011+02:00",
     "UpdatedAt": "2020-08-11T10:46:43.682278005+02:00",
     "Name": "Sonos test flow",
     "Group": "sonos",
     "Description": "",
     "Nodes": [
     {
     "Id": "2",
     "Type": "action",
     "Label": "Play",
     "SuccessTransition": "",
     "TimeoutTransition": "",
     "ErrorTransition": "",
     "Address": "pt:j1/mt:cmd/rt:dev/rn:sonos/ad:1/sv:media_player/ad:7828CAD39E4201400",
     "Service": "media_player",
     "ServiceInterface": "cmd.playback.set",
     "Config": {
     "DefaultValue": {
     "Value": "play",
     "ValueType": "string"
     },
     "IsVariableGlobal": false,
     "Props": {},
     "RegisterAsVirtualService": false,
     "ResponseToTopic": "",
     "VariableName": "",
     "VirtualServiceGroup": "",
     "VirtualServiceProps": {}
     },
     "Ui": {
     "nodeType": "",
     "x": 102,
     "y": 449
     }
     },
     {
     "Id": "4",
     "Type": "action",
     "Label": "Pause",
     "SuccessTransition": "",
     "TimeoutTransition": "",
     "ErrorTransition": "",
     "Address": "pt:j1/mt:cmd/rt:dev/rn:sonos/ad:1/sv:media_player/ad:7828CAD39E4201400",
     "Service": "media_player",
     "ServiceInterface": "cmd.playback.set",
     "Config": {
     "DefaultValue": {
     "Value": "pause",
     "ValueType": "string"
     },
     "IsVariableGlobal": false,
     "Props": {},
     "RegisterAsVirtualService": false,
     "ResponseToTopic": "",
     "VariableName": "",
     "VirtualServiceGroup": "",
     "VirtualServiceProps": {}
     },
     "Ui": {
     "nodeType": "",
     "x": 365,
     "y": 450
     }
     },
     {
     "Id": "7",
     "Type": "trigger",
     "Label": "presence",
     "SuccessTransition": "2",
     "TimeoutTransition": "",
     "ErrorTransition": "",
     "Address": "pt:j1/mt:evt/rt:dev/rn:zw/ad:1/sv:sensor_presence/ad:7_0",
     "Service": "sensor_presence",
     "ServiceInterface": "evt.presence.report",
     "Config": {
     "IsValueFilterEnabled": true,
     "LookupServiceNameAndLocation": false,
     "RegisterAsVirtualService": false,
     "Timeout": 0,
     "ValueFilter": {
     "Value": true,
     "ValueType": "bool"
     },
     "VirtualServiceGroup": "ch_0",
     "VirtualServiceProps": {}
     },
     "Ui": {
     "nodeType": "",
     "x": 68,
     "y": 237
     }
     },
     {
     "Id": "8",
     "Type": "trigger",
     "Label": "presence",
     "SuccessTransition": "4",
     "TimeoutTransition": "",
     "ErrorTransition": "",
     "Address": "pt:j1/mt:evt/rt:dev/rn:zw/ad:1/sv:sensor_presence/ad:7_0",
     "Service": "sensor_presence",
     "ServiceInterface": "evt.presence.report",
     "Config": {
     "IsValueFilterEnabled": true,
     "LookupServiceNameAndLocation": false,
     "RegisterAsVirtualService": false,
     "Timeout": 0,
     "ValueFilter": {
     "Value": false,
     "ValueType": "bool"
     },
     "VirtualServiceGroup": "ch_0",
     "VirtualServiceProps": {}
     },
     "Ui": {
     "nodeType": "",
     "x": 324,
     "y": 237
     }
     }
     ],
     "Settings": null,
     "IsDisabled": false,
     "IsDefault": false,
     "ParallelExecution": "parallel"
    }
    

Was this article helpful?

0 out of 1 found this helpful

Have more questions? Submit a request

Comments

0 comments

Please sign in to leave a comment.