Alexicz - FREE Domoticz to Alexa Integration

Alexa, Google Home and Siri

Moderator: leecollings

Post Reply
abaratian
Posts: 22
Joined: Thursday 12 July 2018 20:19
Target OS: Windows
Domoticz version: 2021.1
Contact:

Re: Alexicz - FREE Domoticz to Alexa Integration

Post by abaratian »

I Followed the very well written documment to create the alexa skill. When i test the script in the website it is OK. I can discover devices and read temperature sensor but. when i add the skill on my phone it doesn't discover any devices. any help?
User avatar
philchillbill
Posts: 396
Joined: Monday 12 September 2016 13:47
Target OS: Linux
Domoticz version: beta
Location: Eindhoven. NL
Contact:

Re: Alexicz - FREE Domoticz to Alexa Integration

Post by philchillbill »

Sounds like a region vs locale issue. Alexa discovers devices for the ARN location linked to the Amazon store account of the echo in use. So e.g. if you are in Germany and your store is Amazon.de, the ARN for discovery is EU-west-1 (Ireland). If your skill was created with US-east-1 and is en-US, you will not discover any devices. Hope that's clear.
Alexa skills author: EvoControl, Statereport, MediaServer, LMS-lite
abaratian
Posts: 22
Joined: Thursday 12 July 2018 20:19
Target OS: Windows
Domoticz version: 2021.1
Contact:

Re: Alexicz - FREE Domoticz to Alexa Integration

Post by abaratian »

philchillbill wrote: Saturday 25 May 2019 9:19 Sounds like a region vs locale issue. Alexa discovers devices for the ARN location linked to the Amazon store account of the echo in use. So e.g. if you are in Germany and your store is Amazon.de, the ARN for discovery is EU-west-1 (Ireland). If your skill was created with US-east-1 and is en-US, you will not discover any devices. Hope that's clear.
Hi, my arn is eu-west-1 and my location is sweden. I also checked my amazon account country and it is set to sweden. I also tried with arn us-west-2 and account location set to us. still no luck
User avatar
philchillbill
Posts: 396
Joined: Monday 12 September 2016 13:47
Target OS: Linux
Domoticz version: beta
Location: Eindhoven. NL
Contact:

Re: Alexicz - FREE Domoticz to Alexa Integration

Post by philchillbill »

Hmm. Do you work with room plans? Only devices in room plans are discovered. If you don’t use them then a tiny change to the Python is necessary.


Sent from my iPhone using Tapatalk
Alexa skills author: EvoControl, Statereport, MediaServer, LMS-lite
abaratian
Posts: 22
Joined: Thursday 12 July 2018 20:19
Target OS: Windows
Domoticz version: 2021.1
Contact:

Re: Alexicz - FREE Domoticz to Alexa Integration

Post by abaratian »

philchillbill wrote: Saturday 25 May 2019 18:45 Hmm. Do you work with room plans? Only devices in room plans are discovered. If you don’t use them then a tiny change to the Python is necessary.


Sent from my iPhone using Tapatalk
yes, i use room plans. as i said in my first post when i run the test discovery script in the lambda management console it works fine and it discovers my devices. i also tried to read a temp sensor and the value was right. the problem is with the alexa not discovering the devices when i add the skill.
abaratian
Posts: 22
Joined: Thursday 12 July 2018 20:19
Target OS: Windows
Domoticz version: 2021.1
Contact:

Re: Alexicz - FREE Domoticz to Alexa Integration

Post by abaratian »

philchillbill wrote: Saturday 25 May 2019 9:19 Sounds like a region vs locale issue. Alexa discovers devices for the ARN location linked to the Amazon store account of the echo in use. So e.g. if you are in Germany and your store is Amazon.de, the ARN for discovery is EU-west-1 (Ireland). If your skill was created with US-east-1 and is en-US, you will not discover any devices. Hope that's clear.
Hi again,
It was a region issue indeed! Curiously enough, for me, it only works when region is set to N. Virginia!! I had to try possible combinations to make it work.

Does anyone know how can I query status of a device or switch? I can see a light is 'Off' or a door is 'Closed' by tapping on the device in the alexa app. But when i ask her what's the status of the DEVICENAME? Or is the DEVICENAME open? or is DEVICENAME on? It doesn't work and alexa replies DEVICENAME doesn't support that. How can i make it work?

Another thing is that when i ask alexa what is the temperature inside, the temperature she says is around 5 degrees less than the average temperature of my sensors. (i.e. all my sensors are in the 24.x range and she reports a temp in 19.x range.) My thermostat is set at 24.5 now. (Just to clarify that is not what she reports)
User avatar
philchillbill
Posts: 396
Joined: Monday 12 September 2016 13:47
Target OS: Linux
Domoticz version: beta
Location: Eindhoven. NL
Contact:

Re: Alexicz - FREE Domoticz to Alexa Integration

Post by philchillbill »

It's not mentioned in the Amazon docs and it took me a long time to find it, but querying state ("Alexa, is the front door open?") only works when the endpoint device in question has the Alexa.EndpointHealth interface included during discovery.

In AlexaSmartHome.py, you need to paste:

Code: Select all

@INTERFACES.register('Alexa.EndpointHealth')
class AlexaEndpointHealth(AlexaInterface):
    def name(self):
        return 'Alexa.EndpointHealth'

    def propertiesSupported(self):
        return [{'name': 'connectivity'}]
and in the code for the method serializeProperties, add the line

Code: Select all

  if prop_name == 'connectivity': prop_value = { 'value': 'OK' }
in DomoticzHandler.py, add this line to the __init__ for class Domoticz (it then gets added to all endpoints):

Code: Select all

  self.addCapability(AlexaEndpointHealth(self, 'Alexa.EndpointHealth',[{'name': 'connectivity'}]))
Now re-discover devices and state-querying should work. I've asked Amazon to update their docs with this.

Note that you cannot request the state of a switch as it's simply not (yet) supported by Alexa. Querying only works for devices of type Alexa.ContactSensor and Alexa.MotionSensor.

Regarding your thermostat temperature reporting, take a look in the Cloudwatch logs to see if you can debug. In DomoticzHandler.py the getProperty method has a test "elif prop == 'temperature'" and whatever that is returning must be incorrect.
Alexa skills author: EvoControl, Statereport, MediaServer, LMS-lite
abaratian
Posts: 22
Joined: Thursday 12 July 2018 20:19
Target OS: Windows
Domoticz version: 2021.1
Contact:

Re: Alexicz - FREE Domoticz to Alexa Integration

Post by abaratian »

philchillbill wrote: Thursday 13 June 2019 10:15 It's not mentioned in the Amazon docs and it took me a long time to find it, but querying state ("Alexa, is the front door open?") only works when the endpoint device in question has the Alexa.EndpointHealth interface included during discovery.

In AlexaSmartHome.py, you need to paste:

Code: Select all

@INTERFACES.register('Alexa.EndpointHealth')
class AlexaEndpointHealth(AlexaInterface):
    def name(self):
        return 'Alexa.EndpointHealth'

    def propertiesSupported(self):
        return [{'name': 'connectivity'}]
and in the code for the method serializeProperties, add the line

Code: Select all

  if prop_name == 'connectivity': prop_value = { 'value': 'OK' }
in DomoticzHandler.py, add this line to the __init__ for class Domoticz (it then gets added to all endpoints):

Code: Select all

  self.addCapability(AlexaEndpointHealth(self, 'Alexa.EndpointHealth',[{'name': 'connectivity'}]))
Now re-discover devices and state-querying should work. I've asked Amazon to update their docs with this.

Note that you cannot request the state of a switch as it's simply not (yet) supported by Alexa. Querying only works for devices of type Alexa.ContactSensor and Alexa.MotionSensor.

Regarding your thermostat temperature reporting, take a look in the Cloudwatch logs to see if you can debug. In DomoticzHandler.py the getProperty method has a test "elif prop == 'temperature'" and whatever that is returning must be incorrect.
THANKS A MILLION!
just adding addCapability to Domoticz class raises error. I added it to ContactSensor part and worked fine.

checking cloudwatch logs shows that when asked for "temperature inside" alexa polls every temp sensor and thermostat in home and calculates average temp. any ideas how can i prevent thermostats from being included in average temp calculation?
User avatar
philchillbill
Posts: 396
Joined: Monday 12 September 2016 13:47
Target OS: Linux
Domoticz version: beta
Location: Eindhoven. NL
Contact:

Re: Alexicz - FREE Domoticz to Alexa Integration

Post by philchillbill »

Glad that worked. Yes, when you ask for the 'inside' temperature all your temp sensors are averaged, You can of course just ask for one specific location such as Livingroom and then you will just get that.

If you want to actually omit a thermostat during the discovery process (or any device in fact) you can put the following code in the discovery loop just under the for device in devices statement in DomoticzHandler.py

Code: Select all

            matchObj = re.match( r'.*no_alexa', device['Description'], re.M|re.I|re.DOTALL)
            if matchObj:  continue
Now, if you have the text no_alexa in the Domoticz device description field, that device will be skipped during discovery. I personally use this approach instead of limiting to discovering devices in roomplans as I don't use roomplans myself.

Similarly, you can skip certain categories of Domoticz devices you'd never want Alexa to interface with (such as your P1 meter) with an array of types as follows:

Code: Select all

            devType = device['Type'] 
            if devType in (''General', 'Lux', 'P1 Smart Meter', 'RFXMeter', 'Temp + Humidity', 'Usage'): continue 
Alexa skills author: EvoControl, Statereport, MediaServer, LMS-lite
abaratian
Posts: 22
Joined: Thursday 12 July 2018 20:19
Target OS: Windows
Domoticz version: 2021.1
Contact:

Re: Alexicz - FREE Domoticz to Alexa Integration

Post by abaratian »

philchillbill wrote: Saturday 15 June 2019 20:45 Glad that worked. Yes, when you ask for the 'inside' temperature all your temp sensors are averaged, You can of course just ask for one specific location such as Livingroom and then you will just get that.

If you want to actually omit a thermostat during the discovery process (or any device in fact) you can put the following code in the discovery loop just under the for device in devices statement in DomoticzHandler.py

Code: Select all

            matchObj = re.match( r'.*no_alexa', device['Description'], re.M|re.I|re.DOTALL)
            if matchObj:  continue
Now, if you have the text no_alexa in the Domoticz device description field, that device will be skipped during discovery. I personally use this approach instead of limiting to discovering devices in roomplans as I don't use roomplans myself.

Similarly, you can skip certain categories of Domoticz devices you'd never want Alexa to interface with (such as your P1 meter) with an array of types as follows:

Code: Select all

            devType = device['Type'] 
            if devType in (''General', 'Lux', 'P1 Smart Meter', 'RFXMeter', 'Temp + Humidity', 'Usage'): continue 
I use room plans and i have an "alexa" room plan that i have all my alexa devices in it. The problem is I want to use these thermostats with alexa (i have 3, 2 are dummy ones i use to control my IR controlled ACs so that when i set the thermostat to 23 an event is triggered and the IR code for 23 degrees is sent to AC and they are usually set to 0. I'm using thermostats instead of selector switches because they are not usable with alexa ). Is there a way to exclude thermostats from average temp calculations? Is there an actualTemp property for thermostats in domoticz? And will alexa read it? So i can update it with my average temp.
User avatar
philchillbill
Posts: 396
Joined: Monday 12 September 2016 13:47
Target OS: Linux
Domoticz version: beta
Location: Eindhoven. NL
Contact:

Re: Alexicz - FREE Domoticz to Alexa Integration

Post by philchillbill »

Nope, there's no way to influence the average calculation - it's just something she does 'herself'. You could 'fool' her as to what temp to use for a specific device. If device name == whatever then return fake value instead of actual value read from Domoticz. Play around with the code for the getProperty method in DomoticzHandler.py.
Alexa skills author: EvoControl, Statereport, MediaServer, LMS-lite
chrispazz
Posts: 81
Joined: Friday 08 July 2016 10:38
Target OS: -
Domoticz version:
Contact:

Re: Alexicz - FREE Domoticz to Alexa Integration

Post by chrispazz »

Hi, after first setup I added more switches in Domoticz but they are not visible in domoticz.
How to update Alexa devices to get new switches?

ty
User avatar
philchillbill
Posts: 396
Joined: Monday 12 September 2016 13:47
Target OS: Linux
Domoticz version: beta
Location: Eindhoven. NL
Contact:

Re: Alexicz - FREE Domoticz to Alexa Integration

Post by philchillbill »

Say “Alexa, discover devices”. If you didn’t put them in the correct room plan, they will not appear either.


Sent from my iPhone using Tapatalk
Alexa skills author: EvoControl, Statereport, MediaServer, LMS-lite
chrispazz
Posts: 81
Joined: Friday 08 July 2016 10:38
Target OS: -
Domoticz version:
Contact:

Re: Alexicz - FREE Domoticz to Alexa Integration

Post by chrispazz »

I did not have a specific room id, (-1).
In first setup it discovered all my devices.....
User avatar
philchillbill
Posts: 396
Joined: Monday 12 September 2016 13:47
Target OS: Linux
Domoticz version: beta
Location: Eindhoven. NL
Contact:

Re: Alexicz - FREE Domoticz to Alexa Integration

Post by philchillbill »

No idea what it might be. Did you try to disable the skill, then re-enable and rediscover devices? Might help.


Sent from my iPhone using Tapatalk
Alexa skills author: EvoControl, Statereport, MediaServer, LMS-lite
chrispazz
Posts: 81
Joined: Friday 08 July 2016 10:38
Target OS: -
Domoticz version:
Contact:

Re: Alexicz - FREE Domoticz to Alexa Integration

Post by chrispazz »

Yes I did but no luck....
chrispazz
Posts: 81
Joined: Friday 08 July 2016 10:38
Target OS: -
Domoticz version:
Contact:

Re: Alexicz - FREE Domoticz to Alexa Integration

Post by chrispazz »

Ok, for Alexics no roomplan is different from any roomplan.
I added it to a roomplan and now the device has been discovered!

:)
User avatar
philchillbill
Posts: 396
Joined: Monday 12 September 2016 13:47
Target OS: Linux
Domoticz version: beta
Location: Eindhoven. NL
Contact:

Re: Alexicz - FREE Domoticz to Alexa Integration

Post by philchillbill »

You can easily change that in the code if it’s not what you want...


Sent from my iPhone using Tapatalk
Alexa skills author: EvoControl, Statereport, MediaServer, LMS-lite
grasuoare
Posts: 5
Joined: Monday 15 July 2019 21:16
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: Alexicz - FREE Domoticz to Alexa Integration

Post by grasuoare »

Hi there!

Thank you for this integration. It works like a charm!

Could you please tell me if it is possible to use it with pivpn? If yes, how?

Thank you!
poudenes
Posts: 667
Joined: Wednesday 08 March 2017 9:42
Target OS: Linux
Domoticz version: 3.8993
Location: Amsterdam
Contact:

Re: Alexicz - FREE Domoticz to Alexa Integration

Post by poudenes »

Hi All,

At the beginning I get problems. When I want create a Security Profile I always get a message:

Invalid security profile

What can that be?
RPi3 B+, Debain Stretch, Domoticz, Homebridge, Dashticz, RFLink, Milight, Z-Wave, Fibaro, Nanoleaf, Nest, Harmony Hub, Now try to understand pass2php
Post Reply

Who is online

Users browsing this forum: No registered users and 0 guests