Page 5 of 36

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

Posted: Thursday 01 September 2016 16:00
by Bigted
That sounds interesting, could see a use for these in areas that Alexa can't hear me.

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

Posted: Sunday 04 September 2016 19:20
by Madgeni
ok, so reasonably easy to use a Dash button with Domoticz. The main limitation is with the Domoticz API really. It would be really nice if we could toggle Groups (and that Scenes couldn't share IDX with other devices..).
So instead of easily being able to toggle a group, i've had to interact with the individual switch:

Code: Select all

var Domoticz = require('./node_modules/domoticz-api/api/domoticz');

var api = new Domoticz({
	protocol: "http",
	host: "127.0.0.1",
	port: 8080,
	username: "",
	password: ""
});

var dash_button = require('node-dash-button');
var dash = dash_button("ac:63:be:89:c9:b6");

var on = false;
//    on = false

dash.on("detected", function (dash_id) {
    console.log("Dash button " + dash_id + " was clicked!");

	api.changeSwitchState({
	     type: 'switch',
	     idx: 167,
	     state:'Toggle'
	      }, function (params, callback) {
	        console.log(callback)
	      });
	  });
	  
	  

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

Posted: Sunday 04 September 2016 19:24
by Madgeni
I used the node-dash-button library- https://github.com/hortinstein/node-dash-button - which has a function that allows you to identify the MAC address as well.
obviously you can then create an array of buttons, with different responses to each.

Cheapest IoT buttons on the market surely?

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

Posted: Sunday 04 September 2016 22:12
by four2six
Madgeni wrote:ok, so reasonably easy to use a Dash button with Domoticz. The main limitation is with the Domoticz API really. It would be really nice if we could toggle Groups (and that Scenes couldn't share IDX with other devices..).
exactly my experience. the dash button works with a raspberry easily. to be able to toggle groups would be a great help.

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

Posted: Monday 05 September 2016 11:07
by Madgeni
Also not being able to check a Group's status is a real pain.

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

Posted: Monday 19 September 2016 21:17
by juankar
HI, I've just discovered that Alexa can work with domoticz. But Amazon Echo is not sold in my country (Spain) I know it is sold in Europe (Germany, Austria, UK and Ireland). My question is if I buy Amazon Echo in UK for example, could I use it in Spain? could Alexa understand spanish? can Alexa speak spanish? Any body use this "toy" in Spain?
Thanks

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

Posted: Wednesday 21 September 2016 12:25
by Madgeni
I believe it's currently English language only

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

Posted: Wednesday 21 September 2016 15:05
by pietervanharen
Maybe you can look at ReSpeaker from Seeeduino on Kickstarter

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

Posted: Wednesday 21 September 2016 21:59
by l0gic
Hi Madgeni,
I've managed to follow your instructions and have Alexa working with my home Domoticz.
The screens etc. have changed a bit but not enough that I couldn't follow the instructions.
I'm based in the UK so I'm currently waiting for the delivery of my Echo at the end of the month.
However, using your test scripts I've managed to get a list of switches and can control the lights from the Lambda test area.

Regarding your cunning plan to put scenes at 200+, some of my Domoticz devices are sitting in the 200 range.
So a quick question, can I change the couple of instances of 200 in the domapi.js to say 2000 without issue?
Thought it would be easier to just stick a zero on the end...

I don't know that much about the whole Alexa environment and it's interaction with the outside world but I have both Domoticz thermosats (which I appreciate are not in your code) and a Tado thermostat system which is also Echo compliant (or will be soon, need a hub swap and code update).
So, if thermostats were enabled in Domoticz as a reference would it clash with the Tado I wonder?
If I asked what the temperature was how would it be able to differentiate between the two systems?
Would it need a Domoticz/Tado precursor in the voice request to enable selection of the correct subsystem pehaps.
It would be nice to control the Tado while still being able to ask what the hot water tank temperature is for example.
Just an idle question while I'm waiting for the Echo to arrive.

I notice you have a solid code base for other items sitting in the code, do you intend to open it up further at all?
Anyhow, great stuff on the integration front. A big thumbs up from me!

ATB

Kevin

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

Posted: Sunday 25 September 2016 10:56
by Madgeni
Hi Kevin -
Re: Scenes - yes, you can just change the code to + 2000 (and the subsequent -2000).

Re: Overlaps - I have this with Hue, and soon Nest (and TRVs maybe) - it should be ok if you've named them uniquely. So I can group things in Alexa for the 'Hue' lights, which I can interact with natively in Alexa, and also control the scenes in Domoticz through the code independently if I want to, still natively. (e.g Hue group - Kitchen "Alexa turn on the kitchen lights", or Domoticz Group Movies - "Alexa turn on Movies") <- something like that?

It can definitely flex, as long as it's accessible via the Smart Home Skill api, which has a limited voice capability at the moment. If I get a chance, I might convert it to a more 'total' solution using the wider Alexa custom skills.
Edit - just seen it's now added temperatures + appropriate voice control - so will add that in - keep an eye on github for a new commit (caveat it with i'll be testing reasonably blind - I don't have any temp devices - yet!)
And glad it's useful :)

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

Posted: Sunday 25 September 2016 20:45
by l0gic
Hi Madgeni,

great stuff, I'll move the scenes up out of the way in preparation for going live when my Echo arrives this week.
Sounds good regarding the overlapping, I think everything is unique so I should not have any clashing by the sounds of things then.
I'll be happy to feed back on the temperature front, I have a lot of temperature sensors on pipes and tanks as I run my own solar hot water system and like to monitor.
I also have a number of temp/humidity sensors as well if that assists. ....and lux and UV.

Since I've found MySensors I can't stop!

Standing by for a new commit :)

Feel free to use me a a test bed if you want, no problem.

ATB

Kevin

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

Posted: Sunday 25 September 2016 21:41
by Madgeni
Thanks Kevin -
i've been taking a look, reasonably easy to update temp sensors, time permitting I should have it done tomorrow.

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

Posted: Sunday 25 September 2016 23:58
by Spud211
Hi Madgeni, just wanted to say thank you for your work; i've got this setup and working perfectly through the test system :)

I'm planning to modify it to support my iKettle too so I can boil the kettle through Alexa..probably so it presents as an on/off switch initially, should be fairly simple to do from what I can see in your code. Just one question - is the oAuth "faker" your own or a 3rd party's? If your own, any chance of sharing that code too? Curious how it work :)

Also more than happy to feed back with temp support (and help if you need it) - although i've got to finish hacking my "Cosy" thermostat first to get that into Domoticz; they don't have a public API and are not willing to add any 3rd party support..but luckily their web app is all node.js and all their source is readable, so it shouldn't be a difficult task to get it going.

Really great work - looking forward to testing this for real on Wednesday when my Echo arrives. Echosim.io doesn't pick up any of my devices (but they do show on the app)

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

Posted: Monday 26 September 2016 9:39
by bbqkees
juankar wrote:HI, I've just discovered that Alexa can work with domoticz. But Amazon Echo is not sold in my country (Spain) I know it is sold in Europe (Germany, Austria, UK and Ireland). My question is if I buy Amazon Echo in UK for example, could I use it in Spain? could Alexa understand spanish? can Alexa speak spanish? Any body use this "toy" in Spain?
Thanks
You can use it everywhere but it only understands English.

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

Posted: Monday 26 September 2016 11:01
by Madgeni
Actually bbqkees - it understands German now - they're working on other languages also.

@ spud211 - the kettle should be ok 'Alexa turn the kettle on' would seem a reasonable command :) Also, I use Amazon's oAuth2 linked account now.

Open the Amazon Alexa developer console and go to the configuration tab of your skill (the page that has the information about Account Linking.
Set the Authorization URL to https://www.amazon.com/ap/oa
Set the Scope to profile:user_id
Set the Access Token URI to https://api.amazon.com/auth/o2/token
copy the Redirect URL that is in this page for the Login with Amazon configuration. (example Redirect URL: https://pitangui.amazon.com/api/skill/link/xxxxxxxxx )

Create a new security profile (developer.amazon.com -> Apps/Service -> Security Profiles -> )
This should give you a client id/client secret which you can then add in to the skill on the Configuration tab.
also you need to whitelist your site:

enter the Web Settings of your security profile -
set the Allowed Origins and Allowed Return URLs. The Allowed Origins should be https://amazon.com, and the Allowed Return URLs should be the Redirect URL copied from the Account Linking page from the Alexa Developer Console

that *should* be it!

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

Posted: Monday 26 September 2016 13:06
by Spud211
nice one thanks for that extra info, really appreciated :) I'll give it a try tonight.

edit: Set it up on my lunch break, works a treat, thanks!

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

Posted: Tuesday 27 September 2016 11:18
by Madgeni
quick update:
Discovery of temp sensors working. had to update the domoticz-api node library to allow updates to sensors (currently Temp only), which works offline - now debugging why my lambda doesn't update temp.

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

Posted: Tuesday 27 September 2016 12:29
by Madgeni
OK - after some github angst - temp should now be discoverable and you should be able to set temp (not increment/decrement yet)

Please try it out, i've tested it with dummy temp sensors and its working

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

Posted: Wednesday 28 September 2016 13:32
by Bigted
Just updated the Lambda for the new version of the code, when I test discovery I get

Code: Select all

"applianceId": 212,
        "manufacturerName": "Hue ",
        "modelName": "Hue ",
        "version": "12",
        "friendlyName": "Hue ",
        "isReachable": true,
        "actions": [
          "turnOn",
          "turnOff"
        ],
        "additionalApplianceDetails": {
          "WhatAmI": "scene"

      "applianceId": "614",
        "manufacturerName": "RFXtrx433",
        "modelName": "LightwaveRF",
        "version": "Dimmer",
        "friendlyName": "Bedside Lamp",
        "friendlyDescription": "Bedside Lamp",
        "isReachable": true,
        "actions": [
          "SetTargetTemperatureRequest",
          "SetTargetTemperatureConfirmation"
        ],
        "additionalApplianceDetails": {
          "WhatAmI": "temp"
        }


        "applianceId": "6",
        "manufacturerName": "RFXtrx433",
        "modelName": "LightwaveRF",
        "version": "On/Off",
        "friendlyName": "Up lighter",
        "isReachable": true,
        "actions": [
          "incrementPercentage",
          "decrementPercentage",
          "setPercentage",
          "turnOn",
          "turnOff"
        ],
        "additionalApplianceDetails": {
          "switchis": "On/Off",
          "WhatAmI": "light"
Does it matter if it reports a switch as a WhatAmI as temp instead of light for "applianceId": "614",

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

Posted: Wednesday 28 September 2016 14:43
by Madgeni
hmm, yes it will! Let me take a look