Page 1 of 1
Alexa with ngrok
Posted: Friday 16 November 2018 12:09
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.
Re: Alexa with ngrok
Posted: Friday 16 November 2018 12:47
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

Re: Alexa with ngrok
Posted: Friday 16 November 2018 12:55
by harrykausl
What about blinds, are they possible too?
Re: Alexa with ngrok
Posted: Friday 16 November 2018 13:04
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 !
Re: Alexa with ngrok
Posted: Friday 16 November 2018 13:17
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?
Re: Alexa with ngrok
Posted: Friday 16 November 2018 15:37
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

Re: Alexa with ngrok
Posted: Friday 16 November 2018 22:08
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...
Re: Alexa with ngrok
Posted: Friday 16 November 2018 22:44
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 ?
Re: Alexa with ngrok
Posted: Friday 16 November 2018 23:14
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
Re: Alexa with ngrok
Posted: Friday 16 November 2018 23:26
by freijn
Many thanks Damsee !!
Will give it a try and let you know.
Frank
Re: Alexa with ngrok
Posted: Saturday 17 November 2018 2:52
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 !

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

Re: Alexa with ngrok
Posted: Saturday 17 November 2018 9:33
by Damsee
You're here too !

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)
Re: Alexa with ngrok
Posted: Saturday 17 November 2018 13:18
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.
Re: Alexa with ngrok
Posted: Sunday 18 November 2018 0:24
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

Re: Alexa with ngrok
Posted: Tuesday 20 November 2018 10:30
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
Re: Alexa with ngrok
Posted: Tuesday 20 November 2018 11:17
by Damsee
Congrats Frank
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
