Amazon Echo to Domoticz Bridge: switches, sensors & more

Alexa, Google Home and Siri

Moderator: leecollings

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 »

bugger. I'll revert it for now whilst i test

Ok - reverted and tested. I think some of the issues are of my making (i use the aws-sdk package for local testing, which is pretty cool, but problematic for you guys :) )
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 »

I've tried this again, tweaked it, as well as fixed an issue where it was only discovering the first group - please test it and give me some feedback :)
Native Alexa skill and Google app - register at https://www.controlicz.com - https://twitter.com/Controlicz
User avatar
l0gic
Posts: 107
Joined: Tuesday 08 October 2013 9:35
Target OS: Linux
Domoticz version: Latest
Contact:

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

Post by l0gic »

Hi,
just updated to latest code and I'm getting the following in the lambda logs

Code: Select all

2016-11-29T10:48:53.222Z	691f17c3-b621-11e6-a006-c9681d09aea6	TypeError: Cannot read property 'length' of undefined
at /var/task/domapi.js:401:42
at Request._callback (/var/task/node_modules/domoticz-api/api/domoticz.js:88:13)
at Request.self.callback (/var/task/node_modules/domoticz-api/node_modules/request/request.js:200:22)
at emitTwo (events.js:87:13)
at Request.emit (events.js:172:7)
at Request.<anonymous> (/var/task/node_modules/domoticz-api/node_modules/request/request.js:1067:10)
at emitOne (events.js:82:20)
at Request.emit (events.js:169:7)
at IncomingMessage.<anonymous> (/var/task/node_modules/domoticz-api/node_modules/request/request.js:988:12)
at emitNone (events.js:72:20)
This seems to be while running a discovery.

If I understand it correctly, is should also discover temperature set point units, these do not appear in discovered devices but I guess that could well be down to the code not completing.

Control of the discovered units seems to be ok still.

All the best

Kevin
Non credus crepitus
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 - and you definitely have devices in your room plans?
Native Alexa skill and Google app - register at https://www.controlicz.com - https://twitter.com/Controlicz
cherowley
Posts: 65
Joined: Tuesday 24 February 2015 15:54
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

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

Post by cherowley »

Hi again,

Just had time to try with the latest code on github and it runs through but doesn't find the virtual set points still :)
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 »

argh! can you let me know the Type/SubType from Setup>Devices, and i'll double-check
Native Alexa skill and Google app - register at https://www.controlicz.com - https://twitter.com/Controlicz
User avatar
l0gic
Posts: 107
Joined: Tuesday 08 October 2013 9:35
Target OS: Linux
Domoticz version: Latest
Contact:

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

Post by l0gic »

Madgeni wrote:Hi - and you definitely have devices in your room plans?
Yup, every device is in its relevant room.
Cheers

Kevin
Non credus crepitus
nigels0
Posts: 221
Joined: Thursday 23 January 2014 12:43
Target OS: Raspberry Pi / ODroid
Domoticz version: 3.8153
Contact:

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

Post by nigels0 »

l0gic wrote:
Madgeni wrote:Hi - and you definitely have devices in your room plans?
Yup, every device is in its relevant room.
Cheers

Kevin
I get this error when I am running the command on an iPad and I have the standard hello world test script in the Lambda. Running on a Mac with the discovery test script, it works fine.
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 weird - something in the browser compatability?
Native Alexa skill and Google app - register at https://www.controlicz.com - https://twitter.com/Controlicz
nigels0
Posts: 221
Joined: Thursday 23 January 2014 12:43
Target OS: Raspberry Pi / ODroid
Domoticz version: 3.8153
Contact:

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

Post by nigels0 »

I'd say so.
fergalom
Posts: 74
Joined: Thursday 24 September 2015 11:44
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

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

Post by fergalom »

Followed this setup and the new authentication, getting the following when trying to test from LAmbda

Code: Select all

START RequestId: 7c80066f-bce0-11e6-a2d3-cb03f3127bfc Version: $LATEST
2016-12-08T00:51:43.346Z	7c80066f-bce0-11e6-a2d3-cb03f3127bfc	**** what am i? : "light"
2016-12-08T00:51:43.350Z	7c80066f-bce0-11e6-a2d3-cb03f3127bfc	http://user:[email protected]:8080/json.htm?type=command&idx=25&param=switchlight&switchcmd=Off
2016-12-08T00:51:43.620Z	7c80066f-bce0-11e6-a2d3-cb03f3127bfc	SyntaxError: Unexpected token <
    at Object.parse (native)
    at Request._callback (/var/task/node_modules/domoticz-api/api/domoticz.js:88:58)
    at Request.self.callback (/var/task/node_modules/domoticz-api/node_modules/request/request.js:200:22)
    at emitTwo (events.js:87:13)
    at Request.emit (events.js:172:7)
    at Request.<anonymous> (/var/task/node_modules/domoticz-api/node_modules/request/request.js:1067:10)
    at emitOne (events.js:82:20)
    at Request.emit (events.js:169:7)
    at IncomingMessage.<anonymous> (/var/task/node_modules/domoticz-api/node_modules/request/request.js:988:12)
    at emitNone (events.js:72:20)
END RequestId: 7c80066f-bce0-11e6-a2d3-cb03f3127bfc
REPORT RequestId: 7c80066f-bce0-11e6-a2d3-cb03f3127bfc	Duration: 298.79 ms	Billed Duration: 300 ms 	Memory Size: 512 MB	Max Memory Used: 27 MB	
Process exited before completing request
Using latest from github

Any ideas what the problem is?
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 fergalom -

what's the new authentication method?
Native Alexa skill and Google app - register at https://www.controlicz.com - https://twitter.com/Controlicz
fergalom
Posts: 74
Joined: Thursday 24 September 2015 11:44
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

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

Post by fergalom »

@Madgeni - this

Madgeni wrote:right. All looks fine, so can you try this? Open a new browser tab from your Smart Home Skill (you'll need this open also)
go here:
https://developer.amazon.com/lwa/sp/overview.html
Create a new security profile, give it a name and description. for the consent privacy url i use: http://www.example.com/privacy and save it.
Then click on the gear and edit Web Settings:
Allowed origins: https://amazon.com
Allowed return URLS: **copy these from your Smart Home Skill - e.g https://pitangui.amazon.com/api/skill/l ... xxxxxxxxxx

Save it.
Then back in your Smart Home Skill Configuration tab:
Authorization URL: https://www.amazon.com/ap/oa
Client ID: This is from the General Tab in your Security Profile
Scope: profile:user_id
Access Token URI: https://api.amazon.com/auth/o2/token
Client Secret: Copy from the General Tab in your Security Profile
Client Authentication Scheme: HTTP Basic

Save it.

Then in http://alexa.amazon.com - disable your skill, then reenable it - this should take you to the Amazon linking site, login via amazon credentials - and see what happens?
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 »

ah ok - and it was working when you used the workaround oauth?
Native Alexa skill and Google app - register at https://www.controlicz.com - https://twitter.com/Controlicz
fergalom
Posts: 74
Joined: Thursday 24 September 2015 11:44
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

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

Post by fergalom »

Madgeni wrote:ah ok - and it was working when you used the workaround oauth?
Haven't tried that, went straight to the new method.
Will try it and report back
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 »

i'm guessing it's the code, not the auth method so I wouldn't worry too much.

Can you double check your conf.json is formatted ok?
Native Alexa skill and Google app - register at https://www.controlicz.com - https://twitter.com/Controlicz
fergalom
Posts: 74
Joined: Thursday 24 September 2015 11:44
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

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

Post by fergalom »

made a new conf - eventhough exactly the same as before
ok bit further along, test event in Lambda to turn on/off a light switch confirmed working - great!
Test event to discover devices throws the following:

Code: Select all

START RequestId: 9f3aa4c3-bd2c-11e6-b687-0dca2c95e318 Version: $LATEST
2016-12-08T09:56:43.068Z	9f3aa4c3-bd2c-11e6-b687-0dca2c95e318	TypeError: Cannot read property 'length' of undefined
    at /var/task/domapi.js:401:42
    at Request._callback (/var/task/node_modules/domoticz-api/api/domoticz.js:88:13)
    at Request.self.callback (/var/task/node_modules/domoticz-api/node_modules/request/request.js:200:22)
    at emitTwo (events.js:87:13)
    at Request.emit (events.js:172:7)
    at Request.<anonymous> (/var/task/node_modules/domoticz-api/node_modules/request/request.js:1067:10)
    at emitOne (events.js:82:20)
    at Request.emit (events.js:169:7)
    at IncomingMessage.<anonymous> (/var/task/node_modules/domoticz-api/node_modules/request/request.js:988:12)
    at emitNone (events.js:72:20)
END RequestId: 9f3aa4c3-bd2c-11e6-b687-0dca2c95e318
REPORT RequestId: 9f3aa4c3-bd2c-11e6-b687-0dca2c95e318	Duration: 171.20 ms	Billed Duration: 200 ms 	Memory Size: 512 MB	Max Memory Used: 21 MB	
Process exited before completing request
Also alexa.amazon.com will not discover devices.

Getting closer.
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 »

ah ok, do you have any Room Plans in Domoticz? You need those, then to put devices in them.

I really should do some error handling in there :)
Native Alexa skill and Google app - register at https://www.controlicz.com - https://twitter.com/Controlicz
fergalom
Posts: 74
Joined: Thursday 24 September 2015 11:44
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

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

Post by fergalom »

ha :-)

Ok I had some room plans which were empty (work in progress) and once I put a device in each, discovery worked ok.
Alexa.amazon.com still not discovering them though, have tried disabling and relinking the skill.
so close
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 »

hmm is the skill firing the lamdba - can you check the logs?

I think there's some general problems with skills linking to lambda functions. My skill is using English U.S, and my lambda is in N.Virginia if that helps.
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 0 guests