Alexa with ngrok

Alexa, Google Home and Siri

Moderator: leecollings

Post Reply
harrykausl
Posts: 181
Joined: Sunday 13 November 2016 10:43
Target OS: Raspberry Pi / ODroid
Domoticz version: 2021.1
Location: Germany
Contact:

Alexa with ngrok

Post by harrykausl »

I read a lot about alexa and programming of skills. I think I could program a alexa skill, which would handle my domotcz devices via http / https calls. To make this possible, there would be 2 solutions.
1. Open my pi with domoticz to be reachable from the alexa skill via https
2. Use ngrok to handle the communication between the skill and my domoticz installation without using https.

Is this correct, what I wrote? Did anyone test solution 2 whith ngrok, or is there another solution.

I'd like to do this with my own skill instead of ha-bridge, because I have a lot of blinds which can't be handled normally via hue-simulation.

Thanks a lot for any answers.
User avatar
emme
Posts: 909
Joined: Monday 27 June 2016 11:02
Target OS: Raspberry Pi / ODroid
Domoticz version: latest
Location: Milano, Italy
Contact:

Re: Alexa with ngrok

Post by emme »

3rd option: use nodered with node-contrib-alexa-home-skill and create the flow you need within these device capability option:
- Lights: ON/OFF/DIM (adaptable for shades and rolling shutters)
[HA-Bridge does the same]
- Thermostat: Set Temp, reat Temp, increase/decrease Temp
- Smart lock (Lock/unlock)
- Temperature: Read Temperature device

I've already created 2 flows for reading rooms temps
The attachment dzAlexaTempFlow.jpg is no longer available
and set a setpoint
The attachment dzAlexaTempFlow.jpg is no longer available
;)
Attachments
nr_termostato.jpg
nr_termostato.jpg (23.08 KiB) Viewed 2932 times
dzAlexaTempFlow.jpg
dzAlexaTempFlow.jpg (42.16 KiB) Viewed 2932 times
The most dangerous phrase in any language is:
"We always done this way"
harrykausl
Posts: 181
Joined: Sunday 13 November 2016 10:43
Target OS: Raspberry Pi / ODroid
Domoticz version: 2021.1
Location: Germany
Contact:

Re: Alexa with ngrok

Post by harrykausl »

What about blinds, are they possible too?
oredin
Posts: 14
Joined: Saturday 27 October 2018 13:01
Target OS: -
Domoticz version:
Contact:

Re: Alexa with ngrok

Post by oredin »

harrykausl wrote: Friday 16 November 2018 12:09 I read a lot about alexa and programming of skills. I think I could program a alexa skill, which would handle my domotcz devices via http / https calls. To make this possible, there would be 2 solutions.
1. Open my pi with domoticz to be reachable from the alexa skill via https
2. Use ngrok to handle the communication between the skill and my domoticz installation without using https.

Is this correct, what I wrote? Did anyone test solution 2 whith ngrok, or is there another solution.

I'd like to do this with my own skill instead of ha-bridge, because I have a lot of blinds which can't be handled normally via hue-simulation.

Thanks a lot for any answers.
Hi,

I tested the solution with ngrok and it worked like a charm. If you want to use this as a long term solution, you'll need to use a paid plan with ngrok if you want to fix the URL used by the skill.

Good luck !
harrykausl
Posts: 181
Joined: Sunday 13 November 2016 10:43
Target OS: Raspberry Pi / ODroid
Domoticz version: 2021.1
Location: Germany
Contact:

Re: Alexa with ngrok

Post by harrykausl »

@oredin
ngrok is also my preferred solution, because it seems, that I can do everything in domoticz with my own voice commands. Do you have a short script example how you call the domoticz devices via ngrok from the alexa skill?
oredin
Posts: 14
Joined: Saturday 27 October 2018 13:01
Target OS: -
Domoticz version:
Contact:

Re: Alexa with ngrok

Post by oredin »

Check this link : https://github.com/rimram31/dz_smarthome.

There's a whole step by step tutorial about how to create a skill for alexa (with the source code of the skill) and connecting it to your DZ. That's what I've used to test with ngrok. I'm still using this skill but I switched from ngrok to my own vpn solution.

Enjoy :)
Damsee
Posts: 58
Joined: Thursday 20 April 2017 1:17
Target OS: Raspberry Pi / ODroid
Domoticz version: 4.10717
Location: France
Contact:

Re: Alexa with ngrok

Post by Damsee »

I'm also using Alexicz (dz_smarthome) skill which works like a charm. I wrote the documentation and it's ok for blinds (mine are RFY).

You need to open https on the internet to enable the communication between your skill and your domoticz server...
RPI3 Raspbian Buster + Domoticz v2020.1 stable + RFXtrx433E + Z-Stick Gen5 + Amazon Echo (alexicz)
x5 THGN810 / x5 ZMNHJD1 / x2 Flood sensor FGFS101 / x1 Smoke sensor FGSD002
x1 ZMNHAD1 / x2 FGS213 / x3 Wallplug FGWPE/F / NodOn Soft remote CRC-3-6-0
freijn
Posts: 536
Joined: Friday 23 December 2016 16:40
Target OS: Raspberry Pi / ODroid
Domoticz version: Stable
Location: Netherlands Purmerend
Contact:

Re: Alexa with ngrok

Post by freijn »

Damsee wrote: Friday 16 November 2018 22:08 I'm also using Alexicz (dz_smarthome) skill which works like a charm. I wrote the documentation and it's ok for blinds (mine are RFY).
Can't find Alexicz do you have a link ?
Damsee
Posts: 58
Joined: Thursday 20 April 2017 1:17
Target OS: Raspberry Pi / ODroid
Domoticz version: 4.10717
Location: France
Contact:

Re: Alexa with ngrok

Post by Damsee »

We named the skill Alexicz but it's not official.
I mean it's not available on Amazon store for skills.

It's based on Madgeni (Controlicz) idea to have your own skill. Since some people disagree the pricing change for Controlicz, we decided to create that skill.
Difference with Madgeni first idea :
- Alexicz is written in Python instead of NodeJS
- Alexicz is compatible with Amazon smarthome v3 instead of v2

Feel free to read the documentation to get a better idea :
https://github.com/rimram31/dz_smarthome
(The howto PDF file).

- It requires maybe 45mn to 1h of your time to create the skill (aws account, lambda function, Amazon developer account, skill creation)
- it's free
- it's working
- you can add module easily as long as your hardware is known why Domoticz and manageable by Alexa
RPI3 Raspbian Buster + Domoticz v2020.1 stable + RFXtrx433E + Z-Stick Gen5 + Amazon Echo (alexicz)
x5 THGN810 / x5 ZMNHJD1 / x2 Flood sensor FGFS101 / x1 Smoke sensor FGSD002
x1 ZMNHAD1 / x2 FGS213 / x3 Wallplug FGWPE/F / NodOn Soft remote CRC-3-6-0
freijn
Posts: 536
Joined: Friday 23 December 2016 16:40
Target OS: Raspberry Pi / ODroid
Domoticz version: Stable
Location: Netherlands Purmerend
Contact:

Re: Alexa with ngrok

Post by freijn »

Many thanks Damsee !!

Will give it a try and let you know.

Frank
oredin
Posts: 14
Joined: Saturday 27 October 2018 13:01
Target OS: -
Domoticz version:
Contact:

Re: Alexa with ngrok

Post by oredin »

Damsee wrote: Friday 16 November 2018 22:08 I'm also using Alexicz (dz_smarthome) skill which works like a charm. I wrote the documentation and it's ok for blinds (mine are RFY).

You need to open https on the internet to enable the communication between your skill and your domoticz server...
Hi,

You're here too ! :D I'll let you get all further thanks for the skil :)

Just a note though, you don't need to be in https for the skill to work. I've been testing it with only an HTTP URL and it works just fine. But with the Let's Encrypt community, it's very easy to get a SSL certificate so everyone should go for the HTTPS solution :)
Damsee
Posts: 58
Joined: Thursday 20 April 2017 1:17
Target OS: Raspberry Pi / ODroid
Domoticz version: 4.10717
Location: France
Contact:

Re: Alexa with ngrok

Post by Damsee »

You're here too ! :D I'll let you get all further thanks for the skil :)
Thanks To Rimram who wrote the code, I just wrote the documentation 😀
Just a note though, you don't need to be in https for the skill to work. I've been testing it with only an HTTP URL and it works just fine. But with the Let's Encrypt community, it's very easy to get a SSL certificate so everyone should go for the HTTPS solution :)
Yes it's working with http but it's much better to secure your access with https as this is Internet...
You can also restrict remote access to your domoticz url to AWS subnets and not whole internet (using ip filtering of your router / internet box / pi running dz)
RPI3 Raspbian Buster + Domoticz v2020.1 stable + RFXtrx433E + Z-Stick Gen5 + Amazon Echo (alexicz)
x5 THGN810 / x5 ZMNHJD1 / x2 Flood sensor FGFS101 / x1 Smoke sensor FGSD002
x1 ZMNHAD1 / x2 FGS213 / x3 Wallplug FGWPE/F / NodOn Soft remote CRC-3-6-0
harrykausl
Posts: 181
Joined: Sunday 13 November 2016 10:43
Target OS: Raspberry Pi / ODroid
Domoticz version: 2021.1
Location: Germany
Contact:

Re: Alexa with ngrok

Post by harrykausl »

Another idea. I have a synology nas and a strato hidrive cloud. I can sync a directory of my nas with a directory on hidrive autoamatically. So would it be possible to use this direcotory as a spooler directory for domoticuz. The skill writes task-files to the hidrive-direcory, they are mirrored to my nas in my lan and I can read the task-files via domoticz and handle the tasks. So I would not to have open ports.
Damsee
Posts: 58
Joined: Thursday 20 April 2017 1:17
Target OS: Raspberry Pi / ODroid
Domoticz version: 4.10717
Location: France
Contact:

Re: Alexa with ngrok

Post by Damsee »

harrykausl wrote: Saturday 17 November 2018 13:18 Another idea. I have a synology nas and a strato hidrive cloud. I can sync a directory of my nas with a directory on hidrive autoamatically. So would it be possible to use this direcotory as a spooler directory for domoticuz. The skill writes task-files to the hidrive-direcory, they are mirrored to my nas in my lan and I can read the task-files via domoticz and handle the tasks. So I would not to have open ports.
That should work too if you're able to find the api to write to your hidrive from the aws lambda function.
However I doubt about timeout and spoiler time check.
I mean you don't want to wait even 1 minute to turn on/off a light when you ask Alexa for it 😉
RPI3 Raspbian Buster + Domoticz v2020.1 stable + RFXtrx433E + Z-Stick Gen5 + Amazon Echo (alexicz)
x5 THGN810 / x5 ZMNHJD1 / x2 Flood sensor FGFS101 / x1 Smoke sensor FGSD002
x1 ZMNHAD1 / x2 FGS213 / x3 Wallplug FGWPE/F / NodOn Soft remote CRC-3-6-0
freijn
Posts: 536
Joined: Friday 23 December 2016 16:40
Target OS: Raspberry Pi / ODroid
Domoticz version: Stable
Location: Netherlands Purmerend
Contact:

Re: Alexa with ngrok

Post by freijn »

@Damsee

Just to let you know ,
I have successfully implemented the first bit of the Alexa integration with your document as a guidance.
To be honest.... I had to start over 2 times and then (finally) didn't miss any little detail from your document.
Some steps look easy and you continue quite fast but then realize in the next step , missed something ( messed it up :-) )
But...... this is my very first successful attempt to have my own skill !!!! Jooohooooooo

Hopefully this evening have some time to do the first test and will let you know the result.

Just wanted to share my little success as I know making a document like that takes time.

Thanks !!!
Frank
Damsee
Posts: 58
Joined: Thursday 20 April 2017 1:17
Target OS: Raspberry Pi / ODroid
Domoticz version: 4.10717
Location: France
Contact:

Re: Alexa with ngrok

Post by Damsee »

Congrats Frank :D :D :D

Let us know the results of your tests and don't forget the prerequisites :
- your devices should be included in a DZ plan
- your DZ user (configured in the skill config file) should be able to control your devices

If you feel i should write in red some steps in the documentation, let me know ;)
RPI3 Raspbian Buster + Domoticz v2020.1 stable + RFXtrx433E + Z-Stick Gen5 + Amazon Echo (alexicz)
x5 THGN810 / x5 ZMNHJD1 / x2 Flood sensor FGFS101 / x1 Smoke sensor FGSD002
x1 ZMNHAD1 / x2 FGS213 / x3 Wallplug FGWPE/F / NodOn Soft remote CRC-3-6-0
Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest