AlexaBridge and MH

classic Classic list List threaded Threaded
7 messages Options
Reply | Threaded
Open this post in threaded view
|

AlexaBridge and MH

Timothy Spaulding

Hello All,

 

I am trying to use the new code from Wayne and Brian to integrate my Echo to MH.  I am trying to use Wayne’s method that just does the work inside the house.

 

I have the following INI params set:

alexa_enable = 1

alexaEnableChunked = 1

 

As I think I understand it, these are the only 2 params I need to set.

 

MH is not listening directly on port 80, but I do have Apache2 proxying port 80 to my normal MH port.

 

Sample user code:

 

$Alexa = new AlexaBridge();  # parent object

$AlexaItems = new AlexaBridge_Item($Alexa);  # child object

 

$AlexaItems->add('$Foyer_Lamp');

$AlexaItems->add('$Dining_Room_Lights');

$AlexaItems->add('$Pantry_Lights');

$AlexaItems->add('$Master_bedroom_TV');

 

And entries from the log file with debug=alexa:5

 

- creating alexaSsdpNotification on udp 50000

03/06/17 04:41:11 PM Alexa open_port: p=50000 pn=alexaSsdpNotification s=Socket_Item=HASH(0x4425c28)

- creating alexaSsdpListen on udp  1900

03/06/17 04:41:11 PM Alexa open_port: p= pn=alexaSsdpListen s=Socket_Item=HASH(0x448e830)

 

 

03/06/17 04:41:11 PM [Alexa] Debug: Configured for port 9191

03/06/17 04:41:11 PM [Alexa] Debug: UUID:( 1 ) Count: ( 0 )

03/06/17 04:41:11 PM [Alexa] Debug: UUID:( 2 ) Count: ( 0 )

03/06/17 04:41:11 PM [Alexa] Debug: UUID:( 3 ) Count: ( 0 )

03/06/17 04:41:11 PM [Alexa] Debug: UUID:( 4 ) Count: ( 0 )

 

I don’t get any other entries when I ask Alexa to discover devices.


------------------------------------------------------------------------------
Announcing the Oxford Dictionaries API! The API offers world-renowned
dictionary content that is easy and intuitive to access. Sign up for an
account today to start using our lexical data to power your apps and
projects. Get started today and enter our developer competition.
http://sdm.link/oxford
________________________________________________________
To unsubscribe from this list, go to: https://lists.sourceforge.net/lists/listinfo/misterhouse-users

Reply | Threaded
Open this post in threaded view
|

Re: AlexaBridge and MH

Wayne Gatlin
Port 80 is not required for the Echo, only Google Home so your set up is fine. The Echo uses multicast (Upnp/SSDP) to discover MH (emulated Hue) which responds with the MH port (9191) , the MH IP, and the description.xml config file URL. The Echo then does a GET for the description.xml, then discovers all the objects you have configured.

The configuration you sent out looks right, but it seems that the initial multicast discovery is not happening (no SSDP messages logged "[Alexa] Debug: SSDP"). 

For the multicast discovery to work the Echo needs to be in the same subnet as MH or you have to configure multicast routing on your router.
 
With debug 5 on, you would should be seeing lots of SSDP messages in the logs as long as you have the Echo or any other devices that use something like upnp in the same subnet.

When the discovery works, you will see logs like this (not including the SSDP messages):

03/05/17 12:47:17 AM [Alexa] Debug: Port: ( 8080 ) URI: ( /description.xml ) Body: ( ) Type: ( GET )

03/05/17 12:47:17 AM [Alexa] Debug: Port: ( 8080 ) URI: ( /api/odtQdwTaiTjPgURo4ZyEtGfIq1fl2AMG2/lights ) Body: () Type: ( GET )

03/05/17 12:47:17 AM [Alexa] Debug: get_set_state (44 get ) : name: Kitchen_Sink_Light  realname: $Kitchen_sink_light sub: set state:

03/05/17 12:47:17 AM [Alexa] Debug: get_state (actual object state: off) - (object type: Insteon::SwitchLinc) -  returning - "on":false,"bri":254

03/05/17 12:47:17 AM [Alexa] Debug: get_set_state (22 get ) : name: Guest_Hall_Light  realname: $hall_main_light sub: set state:


To verify that the module has properly joined the multicast group run a "netstat -g" and look for "239.255.255.250". I recently changed the multicast code so the IO::Socket::Multicast module is not required, so its possible that the new code is not working for you.

root@mh# netstat -g
IPv6/IPv4 Group Memberships
Interface       RefCnt Group
--------------- ------ ---------------------
lo              1      all-systems.mcast.net
eth0            1      239.255.255.250
eth0            1      vrrp.mcast.net
eth0            1      all-systems.mcast.net
lo              1      ip6-allnodes
lo              1      ff01::1
eth0            1      ff02::202
eth0            1      ff02::1:ffe9:5c68
eth0            1      ip6-allnodes
eth0            1      ff01::1
 

What OS are you running?



_Wayne


On Mon, Mar 6, 2017 at 4:08 PM, Timothy Spaulding <[hidden email]> wrote:

Hello All,

 

I am trying to use the new code from Wayne and Brian to integrate my Echo to MH.  I am trying to use Wayne’s method that just does the work inside the house.

 

I have the following INI params set:

alexa_enable = 1

alexaEnableChunked = 1

 

As I think I understand it, these are the only 2 params I need to set.

 

MH is not listening directly on port 80, but I do have Apache2 proxying port 80 to my normal MH port.

 

Sample user code:

 

$Alexa = new AlexaBridge();  # parent object

$AlexaItems = new AlexaBridge_Item($Alexa);  # child object

 

$AlexaItems->add('$Foyer_Lamp');

$AlexaItems->add('$Dining_Room_Lights');

$AlexaItems->add('$Pantry_Lights');

$AlexaItems->add('$Master_bedroom_TV');

 

And entries from the log file with debug=alexa:5

 

- creating alexaSsdpNotification on udp 50000

03/06/17 04:41:11 PM Alexa open_port: p=50000 pn=alexaSsdpNotification s=Socket_Item=HASH(0x4425c28)

- creating alexaSsdpListen on udp  1900

03/06/17 04:41:11 PM Alexa open_port: p= pn=alexaSsdpListen s=Socket_Item=HASH(0x448e830)

 

 

03/06/17 04:41:11 PM [Alexa] Debug: Configured for port 9191

03/06/17 04:41:11 PM [Alexa] Debug: UUID:( 1 ) Count: ( 0 )

03/06/17 04:41:11 PM [Alexa] Debug: UUID:( 2 ) Count: ( 0 )

03/06/17 04:41:11 PM [Alexa] Debug: UUID:( 3 ) Count: ( 0 )

03/06/17 04:41:11 PM [Alexa] Debug: UUID:( 4 ) Count: ( 0 )

 

I don’t get any other entries when I ask Alexa to discover devices.


------------------------------------------------------------------------------
Announcing the Oxford Dictionaries API! The API offers world-renowned
dictionary content that is easy and intuitive to access. Sign up for an
account today to start using our lexical data to power your apps and
projects. Get started today and enter our developer competition.
http://sdm.link/oxford
________________________________________________________
To unsubscribe from this list, go to: https://lists.sourceforge.net/lists/listinfo/misterhouse-users




------------------------------------------------------------------------------
Announcing the Oxford Dictionaries API! The API offers world-renowned
dictionary content that is easy and intuitive to access. Sign up for an
account today to start using our lexical data to power your apps and
projects. Get started today and enter our developer competition.
http://sdm.link/oxford
________________________________________________________
To unsubscribe from this list, go to: https://lists.sourceforge.net/lists/listinfo/misterhouse-users

Reply | Threaded
Open this post in threaded view
|

Re: AlexaBridge and MH

Timothy Spaulding

The OS is Linux/Debian Jesse

 

The netstat -g does return that eth0 is part of the 239.255.255.250 multicast group; however, I need it to be eth1 because eth0 is the external network.

 

From: Wayne Gatlin [mailto:[hidden email]]
Sent: Monday, March 6, 2017 8:22 PM
To: Timothy Spaulding <[hidden email]>
Cc: [hidden email]
Subject: Re: [mh] AlexaBridge and MH

 

Port 80 is not required for the Echo, only Google Home so your set up is fine. The Echo uses multicast (Upnp/SSDP) to discover MH (emulated Hue) which responds with the MH port (9191) , the MH IP, and the description.xml config file URL. The Echo then does a GET for the description.xml, then discovers all the objects you have configured.

The configuration you sent out looks right, but it seems that the initial multicast discovery is not happening (no SSDP messages logged "[Alexa] Debug: SSDP"). 

 

For the multicast discovery to work the Echo needs to be in the same subnet as MH or you have to configure multicast routing on your router.
 

With debug 5 on, you would should be seeing lots of SSDP messages in the logs as long as you have the Echo or any other devices that use something like upnp in the same subnet.

When the discovery works, you will see logs like this (not including the SSDP messages):

03/05/17 12:47:17 AM [Alexa] Debug: Port: ( 8080 ) URI: ( /description.xml ) Body: ( ) Type: ( GET )

03/05/17 12:47:17 AM [Alexa] Debug: Port: ( 8080 ) URI: ( /api/odtQdwTaiTjPgURo4ZyEtGfIq1fl2AMG2/lights ) Body: () Type: ( GET )

03/05/17 12:47:17 AM [Alexa] Debug: get_set_state (44 get ) : name: Kitchen_Sink_Light  realname: $Kitchen_sink_light sub: set state:

03/05/17 12:47:17 AM [Alexa] Debug: get_state (actual object state: off) - (object type: Insteon::SwitchLinc) -  returning - "on":false,"bri":254

03/05/17 12:47:17 AM [Alexa] Debug: get_set_state (22 get ) : name: Guest_Hall_Light  realname: $hall_main_light sub: set state:

To verify that the module has properly joined the multicast group run a "netstat -g" and look for "239.255.255.250". I recently changed the multicast code so the IO::Socket::Multicast module is not required, so its possible that the new code is not working for you.


root@mh# netstat -g
IPv6/IPv4 Group Memberships
Interface       RefCnt Group
--------------- ------ ---------------------
lo              1      all-systems.mcast.net
eth0            1      239.255.255.250
eth0            1      vrrp.mcast.net
eth0            1      all-systems.mcast.net
lo              1      ip6-allnodes
lo              1      ff01::1
eth0            1      ff02::202
eth0            1      ff02::1:ffe9:5c68
eth0            1      ip6-allnodes
eth0            1      ff01::1
 

 

What OS are you running?


_Wayne

 

 

On Mon, Mar 6, 2017 at 4:08 PM, Timothy Spaulding <[hidden email]> wrote:

Hello All,

 

I am trying to use the new code from Wayne and Brian to integrate my Echo to MH.  I am trying to use Wayne’s method that just does the work inside the house.

 

I have the following INI params set:

alexa_enable = 1

alexaEnableChunked = 1

 

As I think I understand it, these are the only 2 params I need to set.

 

MH is not listening directly on port 80, but I do have Apache2 proxying port 80 to my normal MH port.

 

Sample user code:

 

$Alexa = new AlexaBridge();  # parent object

$AlexaItems = new AlexaBridge_Item($Alexa);  # child object

 

$AlexaItems->add('$Foyer_Lamp');

$AlexaItems->add('$Dining_Room_Lights');

$AlexaItems->add('$Pantry_Lights');

$AlexaItems->add('$Master_bedroom_TV');

 

And entries from the log file with debug=alexa:5

 

- creating alexaSsdpNotification on udp 50000

03/06/17 04:41:11 PM Alexa open_port: p=50000 pn=alexaSsdpNotification s=Socket_Item=HASH(0x4425c28)

- creating alexaSsdpListen on udp  1900

03/06/17 04:41:11 PM Alexa open_port: p= pn=alexaSsdpListen s=Socket_Item=HASH(0x448e830)

 

 

03/06/17 04:41:11 PM [Alexa] Debug: Configured for port 9191

03/06/17 04:41:11 PM [Alexa] Debug: UUID:( 1 ) Count: ( 0 )

03/06/17 04:41:11 PM [Alexa] Debug: UUID:( 2 ) Count: ( 0 )

03/06/17 04:41:11 PM [Alexa] Debug: UUID:( 3 ) Count: ( 0 )

03/06/17 04:41:11 PM [Alexa] Debug: UUID:( 4 ) Count: ( 0 )

 

I don’t get any other entries when I ask Alexa to discover devices.


------------------------------------------------------------------------------
Announcing the Oxford Dictionaries API! The API offers world-renowned
dictionary content that is easy and intuitive to access. Sign up for an
account today to start using our lexical data to power your apps and
projects. Get started today and enter our developer competition.
http://sdm.link/oxford
________________________________________________________
To unsubscribe from this list, go to: https://lists.sourceforge.net/lists/listinfo/misterhouse-users

 


------------------------------------------------------------------------------
Announcing the Oxford Dictionaries API! The API offers world-renowned
dictionary content that is easy and intuitive to access. Sign up for an
account today to start using our lexical data to power your apps and
projects. Get started today and enter our developer competition.
http://sdm.link/oxford
________________________________________________________
To unsubscribe from this list, go to: https://lists.sourceforge.net/lists/listinfo/misterhouse-users

Reply | Threaded
Open this post in threaded view
|

Re: AlexaBridge and MH

Wayne Gatlin
I thought it was supposed to add to all interfaces if one is not defined, I guess not.

Try adding the line below (315) to "mh/lib/AlexaBridge.pm" with the IP of eth1 where 192.168.1.1 is and restart MH. If it works, I'll make it where alexaHttpIp is used here when it is defined. I may also make it where you can specify the interface that is discovered and use the discovered IP here.

 314         my $ssdpListenSocket = new IO::Socket::INET->new(
 315                                                LocalAddr=> '192.168.1.1',
 316                                                LocalPort => $SSDP_PORT,
 317                                                Proto     => 'udp',
 318                                                Reuse     => 1)
 

You will also probably have to specify the IP and mac of the eth1 in the mh.private.ini as well because eth0 is probably being discovered. 

alexaHttpIp=192.168.1.1
alexaMac=8086F287C674


_Wayne

On Mon, Mar 6, 2017 at 8:38 PM, Timothy Spaulding <[hidden email]> wrote:

The OS is Linux/Debian Jesse

 

The netstat -g does return that eth0 is part of the 239.255.255.250 multicast group; however, I need it to be eth1 because eth0 is the external network.

 

From: Wayne Gatlin [mailto:[hidden email]]
Sent: Monday, March 6, 2017 8:22 PM
To: Timothy Spaulding <[hidden email]>
Cc: [hidden email]
Subject: Re: [mh] AlexaBridge and MH

 

Port 80 is not required for the Echo, only Google Home so your set up is fine. The Echo uses multicast (Upnp/SSDP) to discover MH (emulated Hue) which responds with the MH port (9191) , the MH IP, and the description.xml config file URL. The Echo then does a GET for the description.xml, then discovers all the objects you have configured.

The configuration you sent out looks right, but it seems that the initial multicast discovery is not happening (no SSDP messages logged "[Alexa] Debug: SSDP"). 

 

For the multicast discovery to work the Echo needs to be in the same subnet as MH or you have to configure multicast routing on your router.
 

With debug 5 on, you would should be seeing lots of SSDP messages in the logs as long as you have the Echo or any other devices that use something like upnp in the same subnet.

When the discovery works, you will see logs like this (not including the SSDP messages):

03/05/17 12:47:17 AM [Alexa] Debug: Port: ( 8080 ) URI: ( /description.xml ) Body: ( ) Type: ( GET )

03/05/17 12:47:17 AM [Alexa] Debug: Port: ( 8080 ) URI: ( /api/odtQdwTaiTjPgURo4ZyEtGfIq1fl2AMG2/lights ) Body: () Type: ( GET )

03/05/17 12:47:17 AM [Alexa] Debug: get_set_state (44 get ) : name: Kitchen_Sink_Light  realname: $Kitchen_sink_light sub: set state:

03/05/17 12:47:17 AM [Alexa] Debug: get_state (actual object state: off) - (object type: Insteon::SwitchLinc) -  returning - "on":false,"bri":254

03/05/17 12:47:17 AM [Alexa] Debug: get_set_state (22 get ) : name: Guest_Hall_Light  realname: $hall_main_light sub: set state:

To verify that the module has properly joined the multicast group run a "netstat -g" and look for "239.255.255.250". I recently changed the multicast code so the IO::Socket::Multicast module is not required, so its possible that the new code is not working for you.


root@mh# netstat -g
IPv6/IPv4 Group Memberships
Interface       RefCnt Group
--------------- ------ ---------------------
lo              1      all-systems.mcast.net
eth0            1      239.255.255.250
eth0            1      vrrp.mcast.net
eth0            1      all-systems.mcast.net
lo              1      ip6-allnodes
lo              1      ff01::1
eth0            1      ff02::202
eth0            1      ff02::1:ffe9:5c68
eth0            1      ip6-allnodes
eth0            1      ff01::1
 

 

What OS are you running?


_Wayne

 

 

On Mon, Mar 6, 2017 at 4:08 PM, Timothy Spaulding <[hidden email]> wrote:

Hello All,

 

I am trying to use the new code from Wayne and Brian to integrate my Echo to MH.  I am trying to use Wayne’s method that just does the work inside the house.

 

I have the following INI params set:

alexa_enable = 1

alexaEnableChunked = 1

 

As I think I understand it, these are the only 2 params I need to set.

 

MH is not listening directly on port 80, but I do have Apache2 proxying port 80 to my normal MH port.

 

Sample user code:

 

$Alexa = new AlexaBridge();  # parent object

$AlexaItems = new AlexaBridge_Item($Alexa);  # child object

 

$AlexaItems->add('$Foyer_Lamp');

$AlexaItems->add('$Dining_Room_Lights');

$AlexaItems->add('$Pantry_Lights');

$AlexaItems->add('$Master_bedroom_TV');

 

And entries from the log file with debug=alexa:5

 

- creating alexaSsdpNotification on udp 50000

03/06/17 04:41:11 PM Alexa open_port: p=50000 pn=alexaSsdpNotification s=Socket_Item=HASH(0x4425c28)

- creating alexaSsdpListen on udp  1900

03/06/17 04:41:11 PM Alexa open_port: p= pn=alexaSsdpListen s=Socket_Item=HASH(0x448e830)

 

 

03/06/17 04:41:11 PM [Alexa] Debug: Configured for port 9191

03/06/17 04:41:11 PM [Alexa] Debug: UUID:( 1 ) Count: ( 0 )

03/06/17 04:41:11 PM [Alexa] Debug: UUID:( 2 ) Count: ( 0 )

03/06/17 04:41:11 PM [Alexa] Debug: UUID:( 3 ) Count: ( 0 )

03/06/17 04:41:11 PM [Alexa] Debug: UUID:( 4 ) Count: ( 0 )

 

I don’t get any other entries when I ask Alexa to discover devices.


------------------------------------------------------------------------------
Announcing the Oxford Dictionaries API! The API offers world-renowned
dictionary content that is easy and intuitive to access. Sign up for an
account today to start using our lexical data to power your apps and
projects. Get started today and enter our developer competition.
http://sdm.link/oxford
________________________________________________________
To unsubscribe from this list, go to: https://lists.sourceforge.net/lists/listinfo/misterhouse-users

 



------------------------------------------------------------------------------
Announcing the Oxford Dictionaries API! The API offers world-renowned
dictionary content that is easy and intuitive to access. Sign up for an
account today to start using our lexical data to power your apps and
projects. Get started today and enter our developer competition.
http://sdm.link/oxford
________________________________________________________
To unsubscribe from this list, go to: https://lists.sourceforge.net/lists/listinfo/misterhouse-users

Reply | Threaded
Open this post in threaded view
|

Re: AlexaBridge and MH

Timothy Spaulding

It seems that neither option of adding the new line in AlexaBridge.pm or adding the 2 INI config lines worked.  The multicast still only shows on eth0.

 

 

From: Wayne Gatlin [mailto:[hidden email]]
Sent: Monday, March 6, 2017 10:19 PM
To: Timothy Spaulding <[hidden email]>
Cc: [hidden email]
Subject: Re: [mh] AlexaBridge and MH

 

I thought it was supposed to add to all interfaces if one is not defined, I guess not.

 

Try adding the line below (315) to "mh/lib/AlexaBridge.pm" with the IP of eth1 where 192.168.1.1 is and restart MH. If it works, I'll make it where alexaHttpIp is used here when it is defined. I may also make it where you can specify the interface that is discovered and use the discovered IP here.

 314         my $ssdpListenSocket = new IO::Socket::INET->new(
 315                                                LocalAddr=> '192.168.1.1',
 316                                                LocalPort => $SSDP_PORT,
 317                                                Proto     => 'udp',
 318                                                Reuse     => 1)
 

You will also probably have to specify the IP and mac of the eth1 in the mh.private.ini as well because eth0 is probably being discovered. 

alexaHttpIp=192.168.1.1
alexaMac=8086F287C674

 

_Wayne

 

On Mon, Mar 6, 2017 at 8:38 PM, Timothy Spaulding <[hidden email]> wrote:

The OS is Linux/Debian Jesse

 

The netstat -g does return that eth0 is part of the 239.255.255.250 multicast group; however, I need it to be eth1 because eth0 is the external network.

 

From: Wayne Gatlin [mailto:[hidden email]]
Sent: Monday, March 6, 2017 8:22 PM
To: Timothy Spaulding <[hidden email]>
Cc: [hidden email]
Subject: Re: [mh] AlexaBridge and MH

 

Port 80 is not required for the Echo, only Google Home so your set up is fine. The Echo uses multicast (Upnp/SSDP) to discover MH (emulated Hue) which responds with the MH port (9191) , the MH IP, and the description.xml config file URL. The Echo then does a GET for the description.xml, then discovers all the objects you have configured.

The configuration you sent out looks right, but it seems that the initial multicast discovery is not happening (no SSDP messages logged "[Alexa] Debug: SSDP"). 

 

For the multicast discovery to work the Echo needs to be in the same subnet as MH or you have to configure multicast routing on your router.
 

With debug 5 on, you would should be seeing lots of SSDP messages in the logs as long as you have the Echo or any other devices that use something like upnp in the same subnet.

When the discovery works, you will see logs like this (not including the SSDP messages):

03/05/17 12:47:17 AM [Alexa] Debug: Port: ( 8080 ) URI: ( /description.xml ) Body: ( ) Type: ( GET )

03/05/17 12:47:17 AM [Alexa] Debug: Port: ( 8080 ) URI: ( /api/odtQdwTaiTjPgURo4ZyEtGfIq1fl2AMG2/lights ) Body: () Type: ( GET )

03/05/17 12:47:17 AM [Alexa] Debug: get_set_state (44 get ) : name: Kitchen_Sink_Light  realname: $Kitchen_sink_light sub: set state:

03/05/17 12:47:17 AM [Alexa] Debug: get_state (actual object state: off) - (object type: Insteon::SwitchLinc) -  returning - "on":false,"bri":254

03/05/17 12:47:17 AM [Alexa] Debug: get_set_state (22 get ) : name: Guest_Hall_Light  realname: $hall_main_light sub: set state:

To verify that the module has properly joined the multicast group run a "netstat -g" and look for "239.255.255.250". I recently changed the multicast code so the IO::Socket::Multicast module is not required, so its possible that the new code is not working for you.


root@mh# netstat -g
IPv6/IPv4 Group Memberships
Interface       RefCnt Group
--------------- ------ ---------------------
lo              1      all-systems.mcast.net
eth0            1      239.255.255.250
eth0            1      vrrp.mcast.net
eth0            1      all-systems.mcast.net
lo              1      ip6-allnodes
lo              1      ff01::1
eth0            1      ff02::202
eth0            1      ff02::1:ffe9:5c68
eth0            1      ip6-allnodes
eth0            1      ff01::1
 

 

What OS are you running?

_Wayne

 

 

On Mon, Mar 6, 2017 at 4:08 PM, Timothy Spaulding <[hidden email]> wrote:

Hello All,

 

I am trying to use the new code from Wayne and Brian to integrate my Echo to MH.  I am trying to use Wayne’s method that just does the work inside the house.

 

I have the following INI params set:

alexa_enable = 1

alexaEnableChunked = 1

 

As I think I understand it, these are the only 2 params I need to set.

 

MH is not listening directly on port 80, but I do have Apache2 proxying port 80 to my normal MH port.

 

Sample user code:

 

$Alexa = new AlexaBridge();  # parent object

$AlexaItems = new AlexaBridge_Item($Alexa);  # child object

 

$AlexaItems->add('$Foyer_Lamp');

$AlexaItems->add('$Dining_Room_Lights');

$AlexaItems->add('$Pantry_Lights');

$AlexaItems->add('$Master_bedroom_TV');

 

And entries from the log file with debug=alexa:5

 

- creating alexaSsdpNotification on udp 50000

03/06/17 04:41:11 PM Alexa open_port: p=50000 pn=alexaSsdpNotification s=Socket_Item=HASH(0x4425c28)

- creating alexaSsdpListen on udp  1900

03/06/17 04:41:11 PM Alexa open_port: p= pn=alexaSsdpListen s=Socket_Item=HASH(0x448e830)

 

 

03/06/17 04:41:11 PM [Alexa] Debug: Configured for port 9191

03/06/17 04:41:11 PM [Alexa] Debug: UUID:( 1 ) Count: ( 0 )

03/06/17 04:41:11 PM [Alexa] Debug: UUID:( 2 ) Count: ( 0 )

03/06/17 04:41:11 PM [Alexa] Debug: UUID:( 3 ) Count: ( 0 )

03/06/17 04:41:11 PM [Alexa] Debug: UUID:( 4 ) Count: ( 0 )

 

I don’t get any other entries when I ask Alexa to discover devices.


------------------------------------------------------------------------------
Announcing the Oxford Dictionaries API! The API offers world-renowned
dictionary content that is easy and intuitive to access. Sign up for an
account today to start using our lexical data to power your apps and
projects. Get started today and enter our developer competition.
http://sdm.link/oxford
________________________________________________________
To unsubscribe from this list, go to: https://lists.sourceforge.net/lists/listinfo/misterhouse-users

 

 


------------------------------------------------------------------------------
Announcing the Oxford Dictionaries API! The API offers world-renowned
dictionary content that is easy and intuitive to access. Sign up for an
account today to start using our lexical data to power your apps and
projects. Get started today and enter our developer competition.
http://sdm.link/oxford
________________________________________________________
To unsubscribe from this list, go to: https://lists.sourceforge.net/lists/listinfo/misterhouse-users

Reply | Threaded
Open this post in threaded view
|

Re: AlexaBridge and MH

Wayne Gatlin
I have a fix, I added an interface on my dev box and tested.

Remove line the 315 you added last time:

315                                                LocalAddr=> '192.168.1.1',"


Replace line 381 "my $ip_mreq = inet_aton( $addr ) . INADDR_ANY;"

With lines 382 - 388 below:

 379 sub _mcast_add {
 380     my ( $sock, $addr ) = @_;
 381     #my $ip_mreq = inet_aton( $addr ) . INADDR_ANY;
 382     my $ip_mreq;
 383      if (defined $::config_parms{'alexaHttpIp'}) {
 384        $ip_mreq = inet_aton($::config_parms{'alexaHttpIp'});
 385       } else {
 386         $ip_mreq = inet_aton('0.0.0.0');
 387       }
 388      $ip_mreq = inet_aton( $addr ) . $ip_mreq;
 389
 390     setsockopt(


Leave the IP and mac defined in your mh.private.ini

alexaHttpIp=192.168.1.1
alexaMac=8086F287C674

_Wayne

On Mon, Mar 6, 2017 at 10:09 PM, Timothy Spaulding <[hidden email]> wrote:

It seems that neither option of adding the new line in AlexaBridge.pm or adding the 2 INI config lines worked.  The multicast still only shows on eth0.

 

 

From: Wayne Gatlin [mailto:[hidden email]]
Sent: Monday, March 6, 2017 10:19 PM
To: Timothy Spaulding <[hidden email]>
Cc: [hidden email]
Subject: Re: [mh] AlexaBridge and MH

 

I thought it was supposed to add to all interfaces if one is not defined, I guess not.

 

Try adding the line below (315) to "mh/lib/AlexaBridge.pm" with the IP of eth1 where 192.168.1.1 is and restart MH. If it works, I'll make it where alexaHttpIp is used here when it is defined. I may also make it where you can specify the interface that is discovered and use the discovered IP here.

 314         my $ssdpListenSocket = new IO::Socket::INET->new(
 315                                                LocalAddr=> '192.168.1.1',
 316                                                LocalPort => $SSDP_PORT,
 317                                                Proto     => 'udp',
 318                                                Reuse     => 1)
 

You will also probably have to specify the IP and mac of the eth1 in the mh.private.ini as well because eth0 is probably being discovered. 

alexaHttpIp=192.168.1.1
alexaMac=8086F287C674

 

_Wayne

 

On Mon, Mar 6, 2017 at 8:38 PM, Timothy Spaulding <[hidden email]> wrote:

The OS is Linux/Debian Jesse

 

The netstat -g does return that eth0 is part of the 239.255.255.250 multicast group; however, I need it to be eth1 because eth0 is the external network.

 

From: Wayne Gatlin [mailto:[hidden email]]
Sent: Monday, March 6, 2017 8:22 PM
To: Timothy Spaulding <[hidden email]>
Cc: [hidden email]
Subject: Re: [mh] AlexaBridge and MH

 

Port 80 is not required for the Echo, only Google Home so your set up is fine. The Echo uses multicast (Upnp/SSDP) to discover MH (emulated Hue) which responds with the MH port (9191) , the MH IP, and the description.xml config file URL. The Echo then does a GET for the description.xml, then discovers all the objects you have configured.

The configuration you sent out looks right, but it seems that the initial multicast discovery is not happening (no SSDP messages logged "[Alexa] Debug: SSDP"). 

 

For the multicast discovery to work the Echo needs to be in the same subnet as MH or you have to configure multicast routing on your router.
 

With debug 5 on, you would should be seeing lots of SSDP messages in the logs as long as you have the Echo or any other devices that use something like upnp in the same subnet.

When the discovery works, you will see logs like this (not including the SSDP messages):

03/05/17 12:47:17 AM [Alexa] Debug: Port: ( 8080 ) URI: ( /description.xml ) Body: ( ) Type: ( GET )

03/05/17 12:47:17 AM [Alexa] Debug: Port: ( 8080 ) URI: ( /api/odtQdwTaiTjPgURo4ZyEtGfIq1fl2AMG2/lights ) Body: () Type: ( GET )

03/05/17 12:47:17 AM [Alexa] Debug: get_set_state (44 get ) : name: Kitchen_Sink_Light  realname: $Kitchen_sink_light sub: set state:

03/05/17 12:47:17 AM [Alexa] Debug: get_state (actual object state: off) - (object type: Insteon::SwitchLinc) -  returning - "on":false,"bri":254

03/05/17 12:47:17 AM [Alexa] Debug: get_set_state (22 get ) : name: Guest_Hall_Light  realname: $hall_main_light sub: set state:

To verify that the module has properly joined the multicast group run a "netstat -g" and look for "239.255.255.250". I recently changed the multicast code so the IO::Socket::Multicast module is not required, so its possible that the new code is not working for you.


root@mh# netstat -g
IPv6/IPv4 Group Memberships
Interface       RefCnt Group
--------------- ------ ---------------------
lo              1      all-systems.mcast.net
eth0            1      239.255.255.250
eth0            1      vrrp.mcast.net
eth0            1      all-systems.mcast.net
lo              1      ip6-allnodes
lo              1      ff01::1
eth0            1      ff02::202
eth0            1      ff02::1:ffe9:5c68
eth0            1      ip6-allnodes
eth0            1      ff01::1
 

 

What OS are you running?

_Wayne

 

 

On Mon, Mar 6, 2017 at 4:08 PM, Timothy Spaulding <[hidden email]> wrote:

Hello All,

 

I am trying to use the new code from Wayne and Brian to integrate my Echo to MH.  I am trying to use Wayne’s method that just does the work inside the house.

 

I have the following INI params set:

alexa_enable = 1

alexaEnableChunked = 1

 

As I think I understand it, these are the only 2 params I need to set.

 

MH is not listening directly on port 80, but I do have Apache2 proxying port 80 to my normal MH port.

 

Sample user code:

 

$Alexa = new AlexaBridge();  # parent object

$AlexaItems = new AlexaBridge_Item($Alexa);  # child object

 

$AlexaItems->add('$Foyer_Lamp');

$AlexaItems->add('$Dining_Room_Lights');

$AlexaItems->add('$Pantry_Lights');

$AlexaItems->add('$Master_bedroom_TV');

 

And entries from the log file with debug=alexa:5

 

- creating alexaSsdpNotification on udp 50000

03/06/17 04:41:11 PM Alexa open_port: p=50000 pn=alexaSsdpNotification s=Socket_Item=HASH(0x4425c28)

- creating alexaSsdpListen on udp  1900

03/06/17 04:41:11 PM Alexa open_port: p= pn=alexaSsdpListen s=Socket_Item=HASH(0x448e830)

 

 

03/06/17 04:41:11 PM [Alexa] Debug: Configured for port 9191

03/06/17 04:41:11 PM [Alexa] Debug: UUID:( 1 ) Count: ( 0 )

03/06/17 04:41:11 PM [Alexa] Debug: UUID:( 2 ) Count: ( 0 )

03/06/17 04:41:11 PM [Alexa] Debug: UUID:( 3 ) Count: ( 0 )

03/06/17 04:41:11 PM [Alexa] Debug: UUID:( 4 ) Count: ( 0 )

 

I don’t get any other entries when I ask Alexa to discover devices.


------------------------------------------------------------------------------
Announcing the Oxford Dictionaries API! The API offers world-renowned
dictionary content that is easy and intuitive to access. Sign up for an
account today to start using our lexical data to power your apps and
projects. Get started today and enter our developer competition.
http://sdm.link/oxford
________________________________________________________
To unsubscribe from this list, go to: https://lists.sourceforge.net/lists/listinfo/misterhouse-users

 

 



------------------------------------------------------------------------------
Announcing the Oxford Dictionaries API! The API offers world-renowned
dictionary content that is easy and intuitive to access. Sign up for an
account today to start using our lexical data to power your apps and
projects. Get started today and enter our developer competition.
http://sdm.link/oxford
________________________________________________________
To unsubscribe from this list, go to: https://lists.sourceforge.net/lists/listinfo/misterhouse-users

Reply | Threaded
Open this post in threaded view
|

Re: AlexaBridge and MH

Timothy Spaulding

Thank you.

 

I went hacking and started tinkering with IO::Socket::Multicast as it showed me a way to specify the interface (or address) that I wanted to add to the group.

 

http://flylib.com/books/en/3.214.1.144/1/

 

I booted my crap and implemented your suggestions and now I see netstat -g showing eth1 in group 239.255.255.250.

 

From: Wayne Gatlin [mailto:[hidden email]]
Sent: Tuesday, March 7, 2017 8:10 PM
To: Timothy Spaulding <[hidden email]>
Cc: [hidden email]
Subject: Re: [mh] AlexaBridge and MH

 

I have a fix, I added an interface on my dev box and tested.

Remove line the 315 you added last time:

315                                                LocalAddr=> '192.168.1.1',"


Replace line 381 "my $ip_mreq = inet_aton( $addr ) . INADDR_ANY;"

With lines 382 - 388 below:

 379 sub _mcast_add {
 380     my ( $sock, $addr ) = @_;
 381     #my $ip_mreq = inet_aton( $addr ) . INADDR_ANY;
 382     my $ip_mreq;
 383      if (defined $::config_parms{'alexaHttpIp'}) {
 384        $ip_mreq = inet_aton($::config_parms{'alexaHttpIp'});
 385       } else {
 386         $ip_mreq = inet_aton('0.0.0.0');
 387       }
 388      $ip_mreq = inet_aton( $addr ) . $ip_mreq;
 389
 390     setsockopt(

Leave the IP and mac defined in your mh.private.ini

alexaHttpIp=192.168.1.1
alexaMac=8086F287C674

_Wayne

 

On Mon, Mar 6, 2017 at 10:09 PM, Timothy Spaulding <[hidden email]> wrote:

It seems that neither option of adding the new line in AlexaBridge.pm or adding the 2 INI config lines worked.  The multicast still only shows on eth0.

 

 

From: Wayne Gatlin [mailto:[hidden email]]
Sent: Monday, March 6, 2017 10:19 PM
To: Timothy Spaulding <[hidden email]>
Cc: [hidden email]
Subject: Re: [mh] AlexaBridge and MH

 

I thought it was supposed to add to all interfaces if one is not defined, I guess not.

 

Try adding the line below (315) to "mh/lib/AlexaBridge.pm" with the IP of eth1 where 192.168.1.1 is and restart MH. If it works, I'll make it where alexaHttpIp is used here when it is defined. I may also make it where you can specify the interface that is discovered and use the discovered IP here.

 314         my $ssdpListenSocket = new IO::Socket::INET->new(
 315                                                LocalAddr=> '192.168.1.1',
 316                                                LocalPort => $SSDP_PORT,
 317                                                Proto     => 'udp',
 318                                                Reuse     => 1)
 

You will also probably have to specify the IP and mac of the eth1 in the mh.private.ini as well because eth0 is probably being discovered. 

alexaHttpIp=192.168.1.1
alexaMac=8086F287C674

 

_Wayne

 

On Mon, Mar 6, 2017 at 8:38 PM, Timothy Spaulding <[hidden email]> wrote:

The OS is Linux/Debian Jesse

 

The netstat -g does return that eth0 is part of the 239.255.255.250 multicast group; however, I need it to be eth1 because eth0 is the external network.

 

From: Wayne Gatlin [mailto:[hidden email]]
Sent: Monday, March 6, 2017 8:22 PM
To: Timothy Spaulding <[hidden email]>
Cc: [hidden email]
Subject: Re: [mh] AlexaBridge and MH

 

Port 80 is not required for the Echo, only Google Home so your set up is fine. The Echo uses multicast (Upnp/SSDP) to discover MH (emulated Hue) which responds with the MH port (9191) , the MH IP, and the description.xml config file URL. The Echo then does a GET for the description.xml, then discovers all the objects you have configured.

The configuration you sent out looks right, but it seems that the initial multicast discovery is not happening (no SSDP messages logged "[Alexa] Debug: SSDP"). 

 

For the multicast discovery to work the Echo needs to be in the same subnet as MH or you have to configure multicast routing on your router.
 

With debug 5 on, you would should be seeing lots of SSDP messages in the logs as long as you have the Echo or any other devices that use something like upnp in the same subnet.

When the discovery works, you will see logs like this (not including the SSDP messages):

03/05/17 12:47:17 AM [Alexa] Debug: Port: ( 8080 ) URI: ( /description.xml ) Body: ( ) Type: ( GET )

03/05/17 12:47:17 AM [Alexa] Debug: Port: ( 8080 ) URI: ( /api/odtQdwTaiTjPgURo4ZyEtGfIq1fl2AMG2/lights ) Body: () Type: ( GET )

03/05/17 12:47:17 AM [Alexa] Debug: get_set_state (44 get ) : name: Kitchen_Sink_Light  realname: $Kitchen_sink_light sub: set state:

03/05/17 12:47:17 AM [Alexa] Debug: get_state (actual object state: off) - (object type: Insteon::SwitchLinc) -  returning - "on":false,"bri":254

03/05/17 12:47:17 AM [Alexa] Debug: get_set_state (22 get ) : name: Guest_Hall_Light  realname: $hall_main_light sub: set state:

To verify that the module has properly joined the multicast group run a "netstat -g" and look for "239.255.255.250". I recently changed the multicast code so the IO::Socket::Multicast module is not required, so its possible that the new code is not working for you.


root@mh# netstat -g
IPv6/IPv4 Group Memberships
Interface       RefCnt Group
--------------- ------ ---------------------
lo              1      all-systems.mcast.net
eth0            1      239.255.255.250
eth0            1      vrrp.mcast.net
eth0            1      all-systems.mcast.net
lo              1      ip6-allnodes
lo              1      ff01::1
eth0            1      ff02::202
eth0            1      ff02::1:ffe9:5c68
eth0            1      ip6-allnodes
eth0            1      ff01::1
 

 

What OS are you running?

_Wayne

 

 

On Mon, Mar 6, 2017 at 4:08 PM, Timothy Spaulding <[hidden email]> wrote:

Hello All,

 

I am trying to use the new code from Wayne and Brian to integrate my Echo to MH.  I am trying to use Wayne’s method that just does the work inside the house.

 

I have the following INI params set:

alexa_enable = 1

alexaEnableChunked = 1

 

As I think I understand it, these are the only 2 params I need to set.

 

MH is not listening directly on port 80, but I do have Apache2 proxying port 80 to my normal MH port.

 

Sample user code:

 

$Alexa = new AlexaBridge();  # parent object

$AlexaItems = new AlexaBridge_Item($Alexa);  # child object

 

$AlexaItems->add('$Foyer_Lamp');

$AlexaItems->add('$Dining_Room_Lights');

$AlexaItems->add('$Pantry_Lights');

$AlexaItems->add('$Master_bedroom_TV');

 

And entries from the log file with debug=alexa:5

 

- creating alexaSsdpNotification on udp 50000

03/06/17 04:41:11 PM Alexa open_port: p=50000 pn=alexaSsdpNotification s=Socket_Item=HASH(0x4425c28)

- creating alexaSsdpListen on udp  1900

03/06/17 04:41:11 PM Alexa open_port: p= pn=alexaSsdpListen s=Socket_Item=HASH(0x448e830)

 

 

03/06/17 04:41:11 PM [Alexa] Debug: Configured for port 9191

03/06/17 04:41:11 PM [Alexa] Debug: UUID:( 1 ) Count: ( 0 )

03/06/17 04:41:11 PM [Alexa] Debug: UUID:( 2 ) Count: ( 0 )

03/06/17 04:41:11 PM [Alexa] Debug: UUID:( 3 ) Count: ( 0 )

03/06/17 04:41:11 PM [Alexa] Debug: UUID:( 4 ) Count: ( 0 )

 

I don’t get any other entries when I ask Alexa to discover devices.


------------------------------------------------------------------------------
Announcing the Oxford Dictionaries API! The API offers world-renowned
dictionary content that is easy and intuitive to access. Sign up for an
account today to start using our lexical data to power your apps and
projects. Get started today and enter our developer competition.
http://sdm.link/oxford
________________________________________________________
To unsubscribe from this list, go to: https://lists.sourceforge.net/lists/listinfo/misterhouse-users

 

 

 


------------------------------------------------------------------------------
Announcing the Oxford Dictionaries API! The API offers world-renowned
dictionary content that is easy and intuitive to access. Sign up for an
account today to start using our lexical data to power your apps and
projects. Get started today and enter our developer competition.
http://sdm.link/oxford
________________________________________________________
To unsubscribe from this list, go to: https://lists.sourceforge.net/lists/listinfo/misterhouse-users