Amazon Echo to Domoticz Bridge: switches, sensors & more

Alexa, Google Home and Siri

Moderator: leecollings

skybehind
Posts: 30
Joined: Monday 04 April 2016 22:00
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: RE: Re: Amazon Echo to Domoticz Bridge: switches, sensors & more

Post by skybehind »

Madgeni wrote:That's a very neat solution :)
Are you going to be able to post your updated code? I just set up the ha-bridge but would like to try yours

Sent from my Nexus 6 using Tapatalk
Madgeni
Posts: 1571
Joined: Friday 25 March 2016 17:43
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: Amazon Echo to Domoticz Bridge: switches, sensors & more

Post by Madgeni »

Last edited by Madgeni on Friday 19 August 2016 14:48, edited 1 time in total.
Native Alexa skill and Google app - register at https://www.controlicz.com - https://twitter.com/Controlicz
Bigted
Posts: 68
Joined: Friday 12 December 2014 14:42
Target OS: Raspberry Pi / ODroid
Domoticz version: 2020.1
Contact:

Re: Amazon Echo to Domoticz Bridge: switches, sensors & more

Post by Bigted »

I'm having a little issue with Alexa discovering my devices

I run through the three test scripts you provided and they all either switch on/off a light or scene, and I get results back from running the discover script

Code: Select all

2016-07-21T18:30:35.819Z	33355246-4f71-11e6-ad02-ad61240945fa	{ applianceId: '62', 
manufacturerName: 'RFXtrx433', 
modelName: 'LightwaveRF', 
version: 'On/Off', 
friendlyName: 'Hall Lamp', 
isReachable: true, 
actions:  
[ 'incrementPercentage', 
'decrementPercentage', 
'setPercentage', 
'turnOn', 
'turnOff' ], 
additionalApplianceDetails: { switchis: 'On/Off', WhatAmI: 'light' } }
I see the app at http://www.alexa.amazon.com, but how do I get Alexa to discovery my devices, If I click on Discover devices under Smart Home, Alxa finds my Hue lights and Yonomi devices, but she doesn't pick up anything from Domoticz

Do I need to say something specific for Alexa to discover the Domoticz devices?
Madgeni
Posts: 1571
Joined: Friday 25 March 2016 17:43
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: Amazon Echo to Domoticz Bridge: switches, sensors & more

Post by Madgeni »

ok, just seen you've used the discovery script in test, and it works?

That should be sufficient - but could you run the test and post (some) of the output here?
Native Alexa skill and Google app - register at https://www.controlicz.com - https://twitter.com/Controlicz
Bigted
Posts: 68
Joined: Friday 12 December 2014 14:42
Target OS: Raspberry Pi / ODroid
Domoticz version: 2020.1
Contact:

Re: Amazon Echo to Domoticz Bridge: switches, sensors & more

Post by Bigted »

The discovery script works in test mode


The Log:

Code: Select all

2016-07-22T19:57:24.253Z	7e931595-5046-11e6-9ce5-3bc5378b435d	{ applianceId: '504', 
manufacturerName: 'Zwave', 
modelName: 'Switch', 
version: 'On/Off', friendlyName: 'Socket 2', 
isReachable: true, 
actions:  
[ 'incrementPercentage', 
'decrementPercentage', 
'setPercentage', 
'turnOn', 
'turnOff' ], 
additionalApplianceDetails: { switchis: 'On/Off', WhatAmI: 'light' } }
2016-07-22T19:57:24.312Z	7e931595-5046-11e6-9ce5-3bc5378b435d	{ applianceId: '582', 
manufacturerName: 'Dummy', 
modelName: 'X10', 
version: 'On/Off', friendlyName: 'Mute', 
isReachable: true, 
actions:  [ 'incrementPercentage', 'decrementPercentage', 
'setPercentage', 
'turnOn', 
'turnOff' ], 
additionalApplianceDetails: { switchis: 'On/Off', WhatAmI: 'light' } } 
2016-07-22T19:57:24.312Z	7e931595-5046-11e6-9ce5-3bc5378b435d	{ applianceId: '600', 
manufacturerName: 'Huuie', 
modelName: 'RGBW', 
version: 'Dimmer', friendlyName: 'Iris', 
isReachable: true, actions:  [ 'incrementPercentage', 
'decrementPercentage', 'setPercentage', 
'turnOn', 
'turnOff' ], 
additionalApplianceDetails: { switchis: 'Dimmer', WhatAmI: 'light' } } 
2016-07-22T19:57:24.312Z	7e931595-5046-11e6-9ce5-3bc5378b435d	Discovery { header:  
{ namespace: 'Alexa.ConnectedHome.Discovery', 
name: 'DiscoverAppliancesResponse', 
payloadVersion: '2' }, 
payload:  
{ discoveredAppliances:  
[ [Object], 
[Object], 
[Object], 
[Object], 
[Object], 
[Object],
The Results

Code: Select all

{
  "header": {
    "namespace": "Alexa.ConnectedHome.Discovery",
    "name": "DiscoverAppliancesResponse",
    "payloadVersion": "2"
  },
  "payload": {
    "discoveredAppliances": [
      {
        "applianceId": 201,
        "manufacturerName": "Bedtime",
        "modelName": "Bedtime",
        "version": "1",
        "friendlyName": "Bedtime",
        "isReachable": true,
        "actions": [
          "turnOn",
          "turnOff"
        ],
        "additionalApplianceDetails": {
          "WhatAmI": "scene"
        }
      },
      {
        "applianceId": 203,
        "manufacturerName": "Bedroom Telly",
        "modelName": "Bedroom Telly",
        "version": "3",
        "friendlyName": "Bedroom Telly",
        "isReachable": true,
        "actions": [
          "turnOn",
          "turnOff"
        ],
        "additionalApplianceDetails": {
          "WhatAmI": "scene"
        }
      },
      {
        "applianceId": 204,
        "manufacturerName": "Computer",
        "modelName": "Computer",
        "version": "4",
        "friendlyName": "Computer",
        "isReachable": true,
        "actions": [
          "turnOn",
          "turnOff"
        ],
        "additionalApplianceDetails": {
          "WhatAmI": "scene"
        }
      },
      {
        "applianceId": "600",
        "manufacturerName": "Huuie",
        "modelName": "RGBW",
        "version": "Dimmer",
        "friendlyName": "Iris",
        "isReachable": true,
        "actions": [
          "incrementPercentage",
          "decrementPercentage",
          "setPercentage",
          "turnOn",
          "turnOff"
        ],
        "additionalApplianceDetails": {
          "switchis": "Dimmer",
          "WhatAmI": "light"
        }
      }
    ]
  }
}
Madgeni
Posts: 1571
Joined: Friday 25 March 2016 17:43
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: Amazon Echo to Domoticz Bridge: switches, sensors & more

Post by Madgeni »

you don't say anything to discover - just the regular discovery from the app. It looks ok to me. You should be able to see the logs in Cloudwatch (accessed from lambda) after you've done a discovery, which might shed some light on the disparity between the skill, and the code being executed.
Native Alexa skill and Google app - register at https://www.controlicz.com - https://twitter.com/Controlicz
Bigted
Posts: 68
Joined: Friday 12 December 2014 14:42
Target OS: Raspberry Pi / ODroid
Domoticz version: 2020.1
Contact:

Re: Amazon Echo to Domoticz Bridge: switches, sensors & more

Post by Bigted »

Thanks for your help
I didn't think about checking the logs while getting Alexa to discover devices. The log wasn't created. On Lambda I hadn't added Alexa Smart Home as a Trigger :oops: Once that was configured and I reran Discover and refreshed the Alexa page, most of my devices were discovered (went from 9 which were Philips Hue and Yonomi to 67)
Madgeni
Posts: 1571
Joined: Friday 25 March 2016 17:43
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: Amazon Echo to Domoticz Bridge: switches, sensors & more

Post by Madgeni »

Good catch :)
Native Alexa skill and Google app - register at https://www.controlicz.com - https://twitter.com/Controlicz
Bigted
Posts: 68
Joined: Friday 12 December 2014 14:42
Target OS: Raspberry Pi / ODroid
Domoticz version: 2020.1
Contact:

Re: Amazon Echo to Domoticz Bridge: switches, sensors & more

Post by Bigted »

I'm not sure why some of my light switches are not being discovered either by Alexa or the test script. I can't see any difference in the device in Domoticz. device 25 I can understand as its hidden

Image

Only device 15 is being detected, 13,14 & 26 are not discovered.

Code: Select all

      {
        "applianceId": "15",
        "manufacturerName": "RFXtrx433",
        "modelName": "LightwaveRF",
        "version": "On/Off",
        "friendlyName": "Christmas Tree",
        "isReachable": true,
        "actions": [
          "incrementPercentage",
          "decrementPercentage",
          "setPercentage",
          "turnOn",
          "turnOff"
        ],
        "additionalApplianceDetails": {
          "switchis": "On/Off",
          "WhatAmI": "light"
        }
      },
Madgeni
Posts: 1571
Joined: Friday 25 March 2016 17:43
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: Amazon Echo to Domoticz Bridge: switches, sensors & more

Post by Madgeni »

That's strange - can you turn one of them off/on using the test, or does that fail too?

Can you curl it from cmd line?

curl 'http://127.0.0.1:8080/json.htm?type=dev ... order=Name' - see if they all come back?
Native Alexa skill and Google app - register at https://www.controlicz.com - https://twitter.com/Controlicz
Bigted
Posts: 68
Joined: Friday 12 December 2014 14:42
Target OS: Raspberry Pi / ODroid
Domoticz version: 2020.1
Contact:

Re: Amazon Echo to Domoticz Bridge: switches, sensors & more

Post by Bigted »

Madgeni wrote:That's strange - can you turn one of them off/on using the test, or does that fail too?
I can turn them all on and off from the test
Madgeni wrote:Can you curl it from cmd line?

curl 'http://127.0.0.1:8080/json.htm?type=dev ... order=Name' - see if they all come back?
All of them are listed

Code: Select all

{
         "AddjMulti" : 1.0,
         "AddjMulti2" : 1.0,
         "AddjValue" : 0.0,
         "AddjValue2" : 0.0,
         "BatteryLevel" : 255,
         "CustomImage" : 0,
         "Data" : "Off",
         "Description" : "",
         "Favorite" : 1,
         "HardwareID" : 2,
         "HardwareName" : "RFXtrx433",
         "HardwareType" : "RFXCOM - RFXtrx433 USB 433.92MHz Transceiver",
         "HardwareTypeVal" : 1,
         "HaveDimmer" : true,
         "HaveGroupCmd" : true,
         "HaveTimeout" : false,
         "ID" : "319932",
         "Image" : "Light",
         "IsSubDevice" : false,
         "LastUpdate" : "2016-07-26 14:59:53",
         "Level" : 61,
         "LevelInt" : 20,
         "MaxDimLevel" : 32,
         "Name" : "Bedroom Overhead",
         "Notifications" : "false",
         "PlanID" : "4",
         "PlanIDs" : [ 4, 8, 9 ],
         "Protected" : false,
         "ShowNotifications" : true,
         "SignalLevel" : "-",
         "Status" : "Off",
         "StrParam1" : "",
         "StrParam2" : "",
         "SubType" : "LightwaveRF",
         "SwitchType" : "Dimmer",
         "SwitchTypeVal" : 7,
         "Timers" : "false",
         "Type" : "Lighting 5",
         "TypeImg" : "dimmer",
         "Unit" : 3,
         "Used" : 1,
         "UsedByCamera" : false,
         "XOffset" : "624",
         "YOffset" : "376",
         "idx" : "14"
      },
Madgeni
Posts: 1571
Joined: Friday 25 March 2016 17:43
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: Amazon Echo to Domoticz Bridge: switches, sensors & more

Post by Madgeni »

Just trying to do some debugging, but it's strange, as long as it's a light (As filtered by Domoticz) i should return it.

If you check the Cloudwatch logs from a test discovery, are they in there?

Apart from your example being a SwitchType 'Dimmer' as per Domoticz, the output is the same as all of mine (i don't have any LightwaveRF dimmer switches, so it's perfectly conceivable i've overlooked something :) )
Native Alexa skill and Google app - register at https://www.controlicz.com - https://twitter.com/Controlicz
Bigted
Posts: 68
Joined: Friday 12 December 2014 14:42
Target OS: Raspberry Pi / ODroid
Domoticz version: 2020.1
Contact:

Re: Amazon Echo to Domoticz Bridge: switches, sensors & more

Post by Bigted »

The test discovery doesn't see them either

I have two other LightwaveRF devices which are not dimmers only one of which is discovered

7 - Reading Lamp LightwaveRF On/Off - not found
6 - Uplighter LightwaveRF On/Off - found
Bigted
Posts: 68
Joined: Friday 12 December 2014 14:42
Target OS: Raspberry Pi / ODroid
Domoticz version: 2020.1
Contact:

Re: Amazon Echo to Domoticz Bridge: switches, sensors & more

Post by Bigted »

I've had a little play with my devices. I deleted IDX 7 which wasn't discovered and re-added to the system, this was assigned a new IDX of 609. This device was discovered this time around

Repeated for another device and it was also discovered old IDX 67, new IDX 610

So this may be a work around for me
Madgeni
Posts: 1571
Joined: Friday 25 March 2016 17:43
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: Amazon Echo to Domoticz Bridge: switches, sensors & more

Post by Madgeni »

ok, it could well be my code :) i'll keep digging, but if you have a work around, then that's..good?
Native Alexa skill and Google app - register at https://www.controlicz.com - https://twitter.com/Controlicz
stang
Posts: 1
Joined: Monday 08 August 2016 3:45
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: Amazon Echo to Domoticz Bridge: switches, sensors & more

Post by stang »

Thank you very much Madgeni! Using your code and instructions, I was able to make Alexa turn on and turn off a z-wave light bulb. It worked 50% of the time. When it does not work I get a message saying the device does not support "turn off/turn on" command. In the logs I see the same exception many times (pasted at the bottom), but I'm not sure it is related. I will debug it when I have time.
I have a question regarding the Authorization URL and the Access Token URI ( https://ve0kyj5tp5.execute-api.us-east- ... horization and https://ve0kyj5tp5.execute-api.us-east- ... ccessToken). Are these actually used? If these services go down, my home automation will not work? I would prefer to host these myself if possible. It would be great to share the fake OAUTH server code and how to use it.
Another observation: the code does not handle thermostat. I like how Domoticz is hosted locally, but I don't have much free time. I'm tempted to buy SmartThingsi instead of extending myself Domoticz.

Error taken out of Amazon CloudWatch log:

START RequestId: 84933feb-5cfe-11e6-86cb-ff24bcce851d Version: $LATEST
2016-08-08T00:24:49.724Z 84933feb-5cfe-11e6-86cb-ff24bcce851d Input { header:
{ namespace: 'Alexa.ConnectedHome.Control',
name: 'TurnOnRequest',
payloadVersion: '2',
messageId: 'ab994c71-1210-4caf-89d5-00b5269f5388' },
payload:
{ accessToken: 'AnythingCanBeAToken',
appliance: { applianceId: '1', additionalApplianceDetails: [Object] } } }
2016-08-08T00:24:49.724Z 84933feb-5cfe-11e6-86cb-ff24bcce851d I'm in the Light case
2016-08-08T00:24:49.882Z 84933feb-5cfe-11e6-86cb-ff24bcce851d SyntaxError: Unexpected token u
at Object.parse (native)
at Request._callback (/var/task/node_modules/domoticz-api/api/domoticz.js:69:49)
at self.callback (/var/task/node_modules/domoticz-api/node_modules/request/request.js:200:22)
at emitOne (events.js:77:13)
at Request.emit (events.js:169:7)
at Request.onRequestError (/var/task/node_modules/domoticz-api/node_modules/request/request.js:831:8)
at emitOne (events.js:77:13)
at ClientRequest.emit (events.js:169:7)
at Socket.socketErrorListener (_http_client.js:256:9)
at emitOne (events.js:77:13)
END RequestId: 84933feb-5cfe-11e6-86cb-ff24bcce851d
REPORT RequestId: 84933feb-5cfe-11e6-86cb-ff24bcce851d Duration: 209.76 ms Billed Duration: 300 ms Memory Size: 128 MB Max Memory Used: 32 MB
Process exited before completing request
Madgeni
Posts: 1571
Joined: Friday 25 March 2016 17:43
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: Amazon Echo to Domoticz Bridge: switches, sensors & more

Post by Madgeni »

Hi there -
clearly it's passing something that the underlying node api wrapper I use doesn't like. Hmm.
Re: Thermostat - agreed, my code is currently only discovering lights/scenes, but can be extended to thermostats also. I don't have one, so its not been on my list to date :)

Re: the Oauth piece - domoticz doesn't handle Oauth2, and this configuration is a dummy one that allows initial setup. It's an interesting Q whether it being down knocks alexa - i'm assuming yes.
Native Alexa skill and Google app - register at https://www.controlicz.com - https://twitter.com/Controlicz
Madgeni
Posts: 1571
Joined: Friday 25 March 2016 17:43
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: Amazon Echo to Domoticz Bridge: switches, sensors & more

Post by Madgeni »

Update - it seems that Amazon changed something - so the friendlyDescription parameter is now mandatory. It wasn't working for me, but after adding that, it now is
Native Alexa skill and Google app - register at https://www.controlicz.com - https://twitter.com/Controlicz
Madgeni
Posts: 1571
Joined: Friday 25 March 2016 17:43
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: Amazon Echo to Domoticz Bridge: switches, sensors & more

Post by Madgeni »

re: setting up Oauth2 - i'd originally wanted to use Amazon account linking - but it wasn't working when i created this. HOWEVER, i've just retested it, and it does - so proper authentication for us now :)

Here someone has kindly put a crib sheet together for what to do: http://stackoverflow.com/questions/3751 ... home-skill
Native Alexa skill and Google app - register at https://www.controlicz.com - https://twitter.com/Controlicz
Madgeni
Posts: 1571
Joined: Friday 25 March 2016 17:43
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: Amazon Echo to Domoticz Bridge: switches, sensors & more

Post by Madgeni »

Just ordered a couple of Amazon Dash buttons - i'm going to see if I can use them to control specific scenes for me using my Echo code. If so, somewhat cheaper and neater than the other options coming up - Fibaro's Button rrp is £40!
Native Alexa skill and Google app - register at https://www.controlicz.com - https://twitter.com/Controlicz
Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest