Page 15 of 36

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

Posted: Thursday 24 November 2016 21:03
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 :) )

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

Posted: Friday 25 November 2016 17:24
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 :)

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

Posted: Tuesday 29 November 2016 11:56
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

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

Posted: Tuesday 29 November 2016 13:45
by Madgeni
Hi - and you definitely have devices in your room plans?

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

Posted: Tuesday 29 November 2016 17:25
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 :)

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

Posted: Tuesday 29 November 2016 17:39
by Madgeni
argh! can you let me know the Type/SubType from Setup>Devices, and i'll double-check

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

Posted: Tuesday 29 November 2016 22:38
by l0gic
Madgeni wrote:Hi - and you definitely have devices in your room plans?
Yup, every device is in its relevant room.
Cheers

Kevin

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

Posted: Wednesday 30 November 2016 0:42
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.

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

Posted: Wednesday 30 November 2016 10:08
by Madgeni
that's weird - something in the browser compatability?

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

Posted: Wednesday 30 November 2016 10:26
by nigels0
I'd say so.

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

Posted: Thursday 08 December 2016 1:45
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?

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

Posted: Thursday 08 December 2016 8:44
by Madgeni
Hi fergalom -

what's the new authentication method?

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

Posted: Thursday 08 December 2016 9:24
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?

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

Posted: Thursday 08 December 2016 9:38
by Madgeni
ah ok - and it was working when you used the workaround oauth?

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

Posted: Thursday 08 December 2016 9:43
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

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

Posted: Thursday 08 December 2016 9:45
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?

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

Posted: Thursday 08 December 2016 11:02
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.

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

Posted: Thursday 08 December 2016 11:07
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 :)

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

Posted: Thursday 08 December 2016 11:19
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

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

Posted: Thursday 08 December 2016 11:25
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.