Amazon Alexa


#21

Hi, @David_Wallis.
Got my Echo recently. Do I need any specific skill installed in Echo?
Right now I installed your interface using zip file, disabled UPnP interface, but Echo doesn’t see HG and devices.


#22

no - nothing… just say “alexa discover” it should then go an do a upnp to find the device.

set nlog.config to include debug (as I cant remember logging levels I set)


#23

also given networking died on my pi, I need to rebuild so I will also test again.


#24

just downloaded and installed on a vanilla hg-bounz version:

Log:

The red line is where it finds “boiler switch”

And after discovery “Alexa turn on boiler switch works fine”


#25

Is it in any way possible to ask for information like temp or humidity? Or is it only on/off?


#26

that would need us to create a skill and expose your hg externally I believe


#27

Thank you for the response.

It would be cool. But don’t know if I would like to expose HG on the internet.


#28

Thank you, David.
Something is wrong with my setup, there are errors in logs:

first error logs
2018-02-15 22:15:07.8482 Debug Enabling Interface HomeAutomation.EchoBridge
2018-02-15 22:15:07.8573 Info Starting HGEchoBrige Version 1.0.6416.36555
2018-02-15 22:15:07.8679 Info Mig: Connecting to Homegenie API [10.0.1.10] to discover valid devices
2018-02-15 22:15:07.8702 Info Log: Connecting to Homegenie API [10.0.1.10] to discover valid devices
System.NullReferenceException: Object reference not set to an instance of an object
  at MIG.Interfaces.HomeAutomation.Api.ApiHelper.Get (System.String url) [0x0004a] in <c327bfe4a477472fa55b43526bd25ed9>:0
  at MIG.Interfaces.HomeAutomation.Api.ApiHelper.GetModules (System.String host) [0x0000d] in <c327bfe4a477472fa55b43526bd25ed9>:0
  at MIG.Interfaces.HomeAutomation.HgHelper.GetDevicesFromHg (System.String ipAddress) [0x00007] in <c327bfe4a477472fa55b43526bd25ed9>:0
  at MIG.Interfaces.HomeAutomation.EchoBridge.Connect () [0x0006e] in <c327bfe4a477472fa55b43526bd25ed9>:0
  at MIG.MigService.EnableInterface (System.String domain) [0x0003e] in <0d2ae8560a244b2680fb8ebf44c6713f>:0
  at MIG.MigService.Gateway_PreProcessRequest (System.Object sender, MIG.ProcessRequestEventArgs args) [0x000cb] in <0d2ae8560a244b2680fb8ebf44c6713f>:0
  at MIG.Gateways.WebServiceGateway.OnPreProcessRequest (MIG.MigClientRequest request) [0x00021] in <0d2ae8560a244b2680fb8ebf44c6713f>:0
  at MIG.Gateways.WebServiceGateway.Worker (System.Object state) [0x0042a] in <0d2ae8560a244b2680fb8ebf44c6713f>:0

I’ll try to investigate it during the weekend.

Edit
Ok, solved the first problem changing HomeGenie’s http port from 8081 to 80. Are you passing host:port to the GetModules method (https://github.com/davidwallis3101/HomegenieEchoBridge/blob/master/MIG-Interface/Api/ApiHelper.cs#L22) or just host?

But after that got another error :slight_smile:

second error logs
2018-02-15 22:32:05.5251 Debug Enabling Interface HomeAutomation.EchoBridge
2018-02-15 22:32:05.5265 Info Starting HGEchoBrige Version 1.0.6416.36555
2018-02-15 22:32:05.5286 Info Mig: Connecting to Homegenie API [10.0.1.10] to discover valid devices
2018-02-15 22:32:05.5302 Info Log: Connecting to Homegenie API [10.0.1.10] to discover valid devices
2018-02-15 22:32:05.5344 Info WebServiceGateway	10.0.1.10	HTTP	GET	200 /api/HomeAutomation.HomeGenie/Config/Modules.List [OPEN]
2018-02-15 22:32:05.8661 Info WebServiceGateway	10.0.1.10	HTTP	GET	200 /api/HomeAutomation.HomeGenie/Config/Modules.List [CLOSED AFTER 0.332 seconds]
2018-02-15 22:32:05.9869 Info Dynamically generating objects from Homegenie api
2018-02-15 22:32:05.9883 Info Starting SSDP service
2018-02-15 22:32:05.9898 Info New SSDP Service initiated on IP [239.255.255.250], port [1900]
2018-02-15 22:32:05.9911 Info Starting SSDP Service on IP [239.255.255.250], port [1900]...
2018-02-15 22:32:05.9924 Info Joining multicast group on IP [10.0.1.10]...
2018-02-15 22:32:05.9936 Info Starting Multicast Receiver...
2018-02-15 22:32:05.9948 Info SSDP Service started.
2018-02-15 22:32:05.9960 Info Starting Web Server
2018-02-15 22:32:05.9971 Info New webserver initiated.
2018-02-15 22:32:05.9982 Info Created Devices from object
2018-02-15 22:32:05.9996 Info Created [0] Device(s) from object.
2018-02-15 22:32:06.0008 Info Webserver created.  DeviceConfig holds [0] device(s)
2018-02-15 22:32:06.0018 Info Webserver starting up, listening on http://10.0.1.10:8080/
2018-02-15 22:32:06.0104 Info Webserver configuration initiated...
System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---> System.Net.HttpListenerException: There's another listener for http://10.0.1.10:8080/
  at System.Net.EndPointListener.AddPrefix (System.Net.ListenerPrefix prefix, System.Net.HttpListener listener) [0x000f4] in <5071a6e4a4564e19a2eda0f53e42f9bd>:0
  at System.Net.EndPointManager.AddPrefixInternal (System.String p, System.Net.HttpListener listener) [0x0006a] in <5071a6e4a4564e19a2eda0f53e42f9bd>:0
  at System.Net.EndPointManager.AddListener (System.Net.HttpListener listener) [0x00030] in <5071a6e4a4564e19a2eda0f53e42f9bd>:0
   --- End of inner exception stack trace ---
  at System.Reflection.MonoMethod.Invoke (System.Object obj, System.Reflection.BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) [0x00053] in <8f2c484307284b51944a1a13a14c0266>:0
  at System.Reflection.MethodBase.Invoke (System.Object obj, System.Object[] parameters) [0x00000] in <8f2c484307284b51944a1a13a14c0266>:0
  at Microsoft.Owin.Hosting.ServerFactory.ServerFactoryAdapter.Create (Owin.IAppBuilder builder) [0x00100] in <f9c6a24237684643b127a582774aa6dc>:0
  at Microsoft.Owin.Hosting.Engine.HostingEngine.StartServer (Microsoft.Owin.Hosting.Engine.StartContext context) [0x0000c] in <f9c6a24237684643b127a582774aa6dc>:0
  at Microsoft.Owin.Hosting.Engine.HostingEngine.Start (Microsoft.Owin.Hosting.Engine.StartContext context) [0x00065] in <f9c6a24237684643b127a582774aa6dc>:0
  at Microsoft.Owin.Hosting.Starter.DirectHostingStarter.Start (Microsoft.Owin.Hosting.StartOptions options) [0x0000c] in <f9c6a24237684643b127a582774aa6dc>:0
  at Microsoft.Owin.Hosting.Starter.HostingStarter.Start (Microsoft.Owin.Hosting.StartOptions options) [0x0002e] in <f9c6a24237684643b127a582774aa6dc>:0
  at Microsoft.Owin.Hosting.WebApp.StartImplementation (System.IServiceProvider services, Microsoft.Owin.Hosting.StartOptions options) [0x0004b] in <f9c6a24237684643b127a582774aa6dc>:0
  at Microsoft.Owin.Hosting.WebApp.Start (Microsoft.Owin.Hosting.StartOptions options) [0x00014] in <f9c6a24237684643b127a582774aa6dc>:0
  at Microsoft.Owin.Hosting.WebApp.Start[TStartup] (Microsoft.Owin.Hosting.StartOptions options) [0x00023] in <f9c6a24237684643b127a582774aa6dc>:0
  at Microsoft.Owin.Hosting.WebApp.Start[TStartup] (System.String url) [0x00006] in <f9c6a24237684643b127a582774aa6dc>:0
  at HGEchoBridge.WebServer.Start () [0x00016] in <c457fb3761194b11aeb0f3057b382349>:0
  at MIG.Interfaces.HomeAutomation.EchoBridge.Connect () [0x000cf] in <c327bfe4a477472fa55b43526bd25ed9>:0
  at MIG.MigService.EnableInterface (System.String domain) [0x0003e] in <0d2ae8560a244b2680fb8ebf44c6713f>:0
  at MIG.MigService.Gateway_PreProcessRequest (System.Object sender, MIG.ProcessRequestEventArgs args) [0x000cb] in <0d2ae8560a244b2680fb8ebf44c6713f>:0
  at MIG.Gateways.WebServiceGateway.OnPreProcessRequest (MIG.MigClientRequest request) [0x00021] in <0d2ae8560a244b2680fb8ebf44c6713f>:0
  at MIG.Gateways.WebServiceGateway.Worker (System.Object state) [0x0042a] in <0d2ae8560a244b2680fb8ebf44c6713f>:0

#29

if your not running on the std port it won’t work… but looks like it’s
either not finding modules or connecting. I’ll add you as contributor and
configure Appveyor tomorrow :slight_smile:


#30

That looks like owin is unable to bind to the IP on port 8080… do you have anything else running on that port still?

Looking at webserverstartup.cs (not my code) it then adds the routes for the controllers.

but its then not getting back to webserver.cs as line 43 is never logged… so OWIN is unable to run on your machine… I wonder if the fact that it finds 0 devices could cause any issues…

Just add a basic switch and see if that makes any difference…

Appveyor build sorted too.


#31

Had another look at your error and actually scrolled right and seen:

There's another listener for http://10.0.1.10:8080/

It could be that the TCP port wasn’t cleared down before the fact that you retried. give it retry…

Failing that nestat should be able to get you the PID that is running on that to then work out what is using that port :slight_smile:


#32

Finally got it working!
Nice!
I’ll push my code changes tomorrow because now it’s almost midnight here =)


#33

I think we can eliminate additional web server provided by EchoBridge as we only need functionality from SetupController. This will simplify the code.
And I think it should be possible to replace this custom implementation of SSDP with one of the libraries available on NuGet.
What do you think, @David_Wallis?


#34

More than happy - I simply made a fork an existing project and butchered it to make it work for me… I never actually found time to really dig into the code and see what its doing - Your C# skills make that task a lot easier for you!


#35

This looks really awesome and I an excited to get it working.
My homegenie is running on port 80. I installed it as an interface and then in the interface box I filled in the IP address of my homegenie server and 80 for the port. I found no directions telling me to do this… but it makes sense. It still does not work though. When I poll for devices on the alexa app I see this error in the logs…

2018-05-07 05:22:27.3531 Info Log: Connecting to Homegenie API [10.0.0.58:] to discover valid devices
2018-05-07 05:22:27.3531 Info Mig: Connecting to Homegenie API [10.0.0.58:] to discover valid devices
2018-05-07 05:22:27.3502 Info Starting HGEchoBrige Version 1.0.21.0
2018-05-07 05:22:27.3502 Trace HomeAutomation.EchoBridge: IPAddress=10.0.0.58
2018-05-07 05:22:27.3481 Info WebServiceGateway 10.0.0.101      HTTP    GET     200 /api/MIGService.Interfaces/HomeAutomation.EchoBridge/Options.Set/IPAddress/10.0.0.58/ [OPEN]
2018-05-07 05:22:30.5376 Info WebServiceGateway 10.0.0.101      HTTP    GET     200 /api/MIGService.Interfaces/HomeAutomation.EchoBridge/IsEnabled.Set/1// [CLOSED AFTER 0.009 seconds]
  at MIG.Gateways.WebServiceGateway.OnPreProcessRequest (MIG.MigClientRequest request) [0x00000] in <filename unknown>:0
  at MIG.MigService.Gateway_PreProcessRequest (System.Object sender, MIG.ProcessRequestEventArgs args) [0x00000] in <filename unknown>:0
  at MIG.MigService.EnableInterface (System.String domain) [0x00000] in <filename unknown>:0
  at MIG.Interfaces.HomeAutomation.EchoBridge.Connect () [0x00000] in <filename unknown>:0
  at MIG.Gateways.WebServiceGateway.Worker (System.Object state) [0x00000] in <filename unknown>:0 System.TypeLoadException: A type load exception has occurred.

#36

did you import the HGX file?


#37

This was weeks ago so I cannot say what I did or did not do. I did import a file a file through what, if I remember correctly, was the “install interface” option. It added the app to HG and gave me a new section with a box for an IP address and I believe a port.


#38

you also need to install the hgx file too.


#39

Has anyone tried this for Google Home?
If so does it work?
Google stopped working with several Hue bridge emulators like HA-Bridge.
I have found a cloud based work around using SmartThings (no hub required) but if this works it would be easier.


#40

It wasnt designed for google home and if ha-bridge doesnt work, this wont as that is what this is based on.