Page 13 of 36

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

Posted: Monday 31 October 2016 0:26
by nigels0
It would be a good feature, but I suspect they'll take some time to get around to this as they probably want to focus on proprietary devices.

I think the account linking could be a clue on how to do this - some web service that becomes a function that maps the echo user to the Domoticz account info. That way, this skill can be enabled on the echo and all it does is provide the information to your skill when starting up. Does that make some kind of sense? Security would be an issue though as the user login/password/IP address would need to be stored in the web service.

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

Posted: Monday 31 October 2016 8:12
by Madgeni
That last part is the reason they implemented it solely via Oauth, so no credentials are held, rather an authorised token issued by the HA system. Basically we need my.domoticz.com to implement oauth2

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

Posted: Saturday 05 November 2016 16:22
by thos
Hi,
I'm having similar problems here moving from English(US)/us-east-1 to English(UK)/eu-west-1

eu-west-1 lambda job works fine via Lambda console json testing - discover returns list of devices, and can turn on/off device manually, so I'm happy Lambda code is good.

I've deleted English(US) and have retained English(UK)

I've updated the oauth as per Madgeni's updates a few post ago, and re-enabling skill the account linking looks to work well, but it still wont discover devices.

Any ideas?

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

Posted: Saturday 05 November 2016 16:29
by thos
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?
Where you say:
Scope: profile:user_id

Is this literal, or should I be replacing "profile:user_id" with something else?

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

Posted: Sunday 06 November 2016 14:54
by simonfr
A quick update on where I've got to with this, and to say thanks to those that tried so valiantly to help me out. After the slight misdemeanour on my part thinking that I would kill my account and try from scratch, Amazon recreated it, but unfortunately all the old functions/skills/etc were still there. I removed them all, and tried again. Still no luck. When testing the Lambda function in isolation it would always connect to Domoticz, but I could never get the Skill to link to it (i.e. to have Alexa successfully discover my devices). I eventually created a new function in "EU (Ireland)" and set the skill to reference the new European ARN that had been created. Worked first time..... So, I'm now at a stage where I can at least test the thing, and see what the interaction with Domoticz is like. Happy days. Thanks again Nigel and Madgeni!

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

Posted: Sunday 06 November 2016 18:09
by thos
Simonfr - are you using English UK?
No matter what I try, I cannot get either US or UK language to call Lambda function in EU (Ireland).
I've created new skills, new Lambda function. Updating Skill IDs and ARN's, but I cannot get a skill to call a function in EU, regardless of US or UK language.

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

Posted: Sunday 06 November 2016 18:21
by simonfr
I'm using "English (U.S.)" as the language for the skill that I have created, and for the Lambda function I have the locale is set to "EU (Ireland)". I have taken the ARN for that Lambda function ("arn:aws:lambda:eu-west-1:xxxxxxxxxxxx:function:AlexaToDomiticzEUV4) and set it as the Service Endpoint Type for the Skill making sure that the region is set to Europe. I now have no Service Endpoint Type set for the North America region.

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

Posted: Sunday 06 November 2016 23:17
by simonfr
So this is working well. Initially had some problems with the names I'd given devices, which although intuitive on a display screen were not so intuitive when trying to remember what you'd have to refer to them when commanding Alexa. Speed is very impressive, and I only need to ask Alexa to "Turn On/Off device_name" to achieve what I want. I had hoped my temperature sensors would be picked up, but they're not included in the list of devices returned. As per an earlier post I added the following logging statements to the getRoomDevices function :

Code: Select all

log("name: ", device.name)
log("   type: ", device.type)
This gives the following in the Lamda logs :

Code: Select all

be37-a46d-11e6-856b-c969bfb19121	**** name: : "Lounge - Lights"
2016-11-06T22:09:29.959Z	afccbe37-a46d-11e6-856b-c969bfb19121	****    type: : 0
2016-11-06T22:09:29.959Z	afccbe37-a46d-11e6-856b-c969bfb19121	**** name: : "Lounge - Corner Light"
2016-11-06T22:09:29.959Z	afccbe37-a46d-11e6-856b-c969bfb19121	****    type: : 0
2016-11-06T22:09:29.959Z	afccbe37-a46d-11e6-856b-c969bfb19121	**** name: : "Lounge - TV Corner Light"
2016-11-06T22:09:29.959Z	afccbe37-a46d-11e6-856b-c969bfb19121	****    type: : 0
2016-11-06T22:09:29.959Z	afccbe37-a46d-11e6-856b-c969bfb19121	**** name: : "Lounge - Media Centre"
2016-11-06T22:09:29.959Z	afccbe37-a46d-11e6-856b-c969bfb19121	****    type: : 0
2016-11-06T22:09:29.959Z	afccbe37-a46d-11e6-856b-c969bfb19121	**** name: : "Lounge - TV Lights"
2016-11-06T22:09:29.959Z	afccbe37-a46d-11e6-856b-c969bfb19121	****    type: : 0
2016-11-06T22:09:29.979Z	afccbe37-a46d-11e6-856b-c969bfb19121	**** name: : "Vestibule - Mirror Lights"
2016-11-06T22:09:29.979Z	afccbe37-a46d-11e6-856b-c969bfb19121	****    type: : 0
2016-11-06T22:09:30.004Z	afccbe37-a46d-11e6-856b-c969bfb19121	**** name: : "Study - Main Light"
2016-11-06T22:09:30.004Z	afccbe37-a46d-11e6-856b-c969bfb19121	****    type: : 0
2016-11-06T22:09:30.034Z	afccbe37-a46d-11e6-856b-c969bfb19121	**** name: : "Family Room - Desk Lamp"
2016-11-06T22:09:30.034Z	afccbe37-a46d-11e6-856b-c969bfb19121	****    type: : 0
2016-11-06T22:09:30.034Z	afccbe37-a46d-11e6-856b-c969bfb19121	**** name: : "Family Room - Lights"
2016-11-06T22:09:30.034Z	afccbe37-a46d-11e6-856b-c969bfb19121	****    type: : 0
2016-11-06T22:09:30.034Z	afccbe37-a46d-11e6-856b-c969bfb19121	**** name: : "Family Room - Mirror Lights"
2016-11-06T22:09:30.034Z	afccbe37-a46d-11e6-856b-c969bfb19121	****    type: : 0
2016-11-06T22:09:30.034Z	afccbe37-a46d-11e6-856b-c969bfb19121	**** name: : "Temp - Family Room"
2016-11-06T22:09:30.034Z	afccbe37-a46d-11e6-856b-c969bfb19121	****    type: : 0
2016-11-06T22:09:30.063Z	afccbe37-a46d-11e6-856b-c969bfb19121	**** name: : "Patio - Deck Lights"
2016-11-06T22:09:30.063Z	afccbe37-a46d-11e6-856b-c969bfb19121	****    type: : 0
2016-11-06T22:09:30.063Z	afccbe37-a46d-11e6-856b-c969bfb19121	**** name: : "Patio - Right Socket"
2016-11-06T22:09:30.063Z	afccbe37-a46d-11e6-856b-c969bfb19121	****    type: : 0
2016-11-06T22:09:30.063Z	afccbe37-a46d-11e6-856b-c969bfb19121	**** name: : "Garage Door Lights"
2016-11-06T22:09:30.063Z	afccbe37-a46d-11e6-856b-c969bfb19121	****    type: : 0
2016-11-06T22:09:30.063Z	afccbe37-a46d-11e6-856b-c969bfb19121	**** name: : "Garage Door Socket"
2016-11-06T22:09:30.063Z	afccbe37-a46d-11e6-856b-c969bfb19121	****    type: : 0
2016-11-06T22:09:30.063Z	afccbe37-a46d-11e6-856b-c969bfb19121	**** name: : "Garage Double Door"
2016-11-06T22:09:30.063Z	afccbe37-a46d-11e6-856b-c969bfb19121	****    type: : 0
2016-11-06T22:09:30.087Z	afccbe37-a46d-11e6-856b-c969bfb19121	**** name: : "Stair Lights"
2016-11-06T22:09:30.087Z	afccbe37-a46d-11e6-856b-c969bfb19121	****    type: : 0
2016-11-06T22:09:30.113Z	afccbe37-a46d-11e6-856b-c969bfb19121	**** name: : "Dan's Room - Cupboard Lights"
2016-11-06T22:09:30.113Z	afccbe37-a46d-11e6-856b-c969bfb19121	****    type: : 0
2016-11-06T22:09:30.113Z	afccbe37-a46d-11e6-856b-c969bfb19121	**** name: : "Temp - Daniel's Room"
2016-11-06T22:09:30.113Z	afccbe37-a46d-11e6-856b-c969bfb19121	****    type: : 0
2016-11-06T22:09:30.141Z	afccbe37-a46d-11e6-856b-c969bfb19121	**** name: : "Master - Bookshelf Lights"
2016-11-06T22:09:30.141Z	afccbe37-a46d-11e6-856b-c969bfb19121	****    type: : 0
2016-11-06T22:09:30.141Z	afccbe37-a46d-11e6-856b-c969bfb19121	**** name: : "Master - Simon's Light"
2016-11-06T22:09:30.141Z	afccbe37-a46d-11e6-856b-c969bfb19121	****    type: : 0
2016-11-06T22:09:30.141Z	afccbe37-a46d-11e6-856b-c969bfb19121	**** name: : "Temp - Master Bedroom"
2016-11-06T22:09:30.141Z	afccbe37-a46d-11e6-856b-c969bfb19121	****    type: : 0
END RequestId: afccbe37-a46d-11e6-856b-c969bfb19121
REPORT RequestId: afccbe37-a46d-11e6-856b-c969bfb19121	Duration: 1833.09 ms	Billed Duration: 1900 ms 	Memory Size: 512 MB	Max Memory Used: 25 MB
So, the devices are picked up off the Room Plans I've created, but they're not then returned to Alexa. I see from earlier posts that temperature sensor support was removed ..... was there a particular reason for this?

Regardless, thanks for this - it's one hundred times better than using Homebridge with Siri!

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

Posted: Monday 07 November 2016 13:31
by bellissimo
It is not possible to get Alexa to query the temperatures of the sensors with a 'Smart Home Skill', so I guess there is no point in retrieving them...

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

Posted: Monday 07 November 2016 17:26
by bellissimo
Out of interest, does this work with SSL (so using HTTPS rather than HTTP)?

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

Posted: Monday 07 November 2016 18:36
by bellissimo
Scrap that last question, looks like a workaround was added to handle (ignore) the self-signed certificate a way back.

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

Posted: Tuesday 08 November 2016 22:16
by renerene
Beginners question: the Amazon Alexis app is not available in the Play store because it is not supported in my country (NL). Is there another way to setup the Echo?

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

Posted: Tuesday 08 November 2016 23:27
by nigels0
You do need the app. Have you tried a vpn or proxy?

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

Posted: Thursday 10 November 2016 14:19
by Madgeni
Sorry all - thought I had notifications on this thread on!
Firstly, great that most of you are finding some use for it.
Re: Temps - it should work, let me look again. It's probably down to how the Rooms are handled in Domoticz. I thought i'd worked around it, but then again, maybe not! Temp setting was working, but bellisimo is right, you can't 'get' temperatures from Alexa (yet).

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

Posted: Thursday 10 November 2016 14:20
by Madgeni
In a non-domoticz, but alexa vein - if anyone uses Kodi, i'm working on a voice control for that also

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

Posted: Thursday 10 November 2016 15:24
by bellissimo
Sounds interesting... Will that be using an Alexa 'Custom' skill?

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

Posted: Thursday 10 November 2016 16:35
by Madgeni
yes, however slightly different approach. I'm using the skill to lambda, but the lambda will use aws-iot mqtt, which the local client will read from

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

Posted: Friday 11 November 2016 1:57
by nigels0
Madgeni,

As a feature update, how about supporting 'dim' - at least on the JSON to Domoticz part it would be easy :)

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

Posted: Friday 11 November 2016 8:20
by Madgeni
you mean for lights? That should work -
"incrementPercentage",
"decrementPercentage",
"setPercentage"

Are all set for lights

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

Posted: Friday 11 November 2016 11:27
by nigels0
Doesn't seem to work for me though - saying 'dim the light to 50%' drops the light to 96% in Domoticz - asking for 5% drops to 12%, so is a bit funky still.

Experimenting a bit more, I'm getting different readings, so it all seems a bit random. I'm using both keywords 'dim' and 'set' x 'to 40%'