Amazon Echo to Domoticz Bridge: switches, sensors & more

Alexa, Google Home and Siri

Moderator: leecollings

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 »

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.
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 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
Native Alexa skill and Google app - register at https://www.controlicz.com - https://twitter.com/Controlicz
thos
Posts: 10
Joined: Saturday 10 January 2015 19:43
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

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

Post 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?
thos
Posts: 10
Joined: Saturday 10 January 2015 19:43
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

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

Post 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?
simonfr
Posts: 16
Joined: Sunday 13 March 2016 14:48
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

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

Post 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!
thos
Posts: 10
Joined: Saturday 10 January 2015 19:43
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

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

Post 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.
simonfr
Posts: 16
Joined: Sunday 13 March 2016 14:48
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

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

Post 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.
simonfr
Posts: 16
Joined: Sunday 13 March 2016 14:48
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

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

Post 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!
bellissimo
Posts: 15
Joined: Saturday 18 October 2014 18:15
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

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

Post 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...
bellissimo
Posts: 15
Joined: Saturday 18 October 2014 18:15
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

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

Post by bellissimo »

Out of interest, does this work with SSL (so using HTTPS rather than HTTP)?
bellissimo
Posts: 15
Joined: Saturday 18 October 2014 18:15
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

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

Post by bellissimo »

Scrap that last question, looks like a workaround was added to handle (ignore) the self-signed certificate a way back.
renerene
Posts: 316
Joined: Wednesday 03 August 2016 11:36
Target OS: -
Domoticz version:
Contact:

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

Post 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?
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 »

You do need the app. Have you tried a vpn or proxy?
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 »

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).
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 »

In a non-domoticz, but alexa vein - if anyone uses Kodi, i'm working on a voice control for that also
Native Alexa skill and Google app - register at https://www.controlicz.com - https://twitter.com/Controlicz
bellissimo
Posts: 15
Joined: Saturday 18 October 2014 18:15
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

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

Post by bellissimo »

Sounds interesting... Will that be using an Alexa 'Custom' skill?
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 »

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
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 »

Madgeni,

As a feature update, how about supporting 'dim' - at least on the JSON to Domoticz part it would be easy :)
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 mean for lights? That should work -
"incrementPercentage",
"decrementPercentage",
"setPercentage"

Are all set for lights
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 »

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%'
Post Reply

Who is online

Users browsing this forum: No registered users and 0 guests