Working on multiple emulated_hue instances

I do have a Google Home too. May I use your component as well?

To be clear - this is not my code. I just modified bits of it to instantiate multiple instances.

But, I looked and there are some restrictions for Google Home. One of them is the port 80 is required. So, having multiple ports for multiple instances will not work.

I assume you can mix Google Home (port 80) and Alexa configurations with multiple instances (port 8301, port 8302, etc.). But, I don’t know. I have not tried.

@shenning00

I finally have some time to set this up and it works amazingly. This is far more superior than the official version.

@balloob & @fabaff please reconsider merging this into the official version. I believe most of us will eventually hit the 49 devices limit as we add more and more lights, switches, scripts, scenes, groups and automations.

Anyway @shenning00, is it possible to create a new service as a virtual link button so that I can call this service in front end > developer tools > services when I want to rediscover new devices in the Alexa app? Right now, I need to restart HA and keep refreshing http://IPADDRESS:8301/description.xml in order to rediscover new devices. It is really inconvenient.

I have more then 200.

And I vote this code one of the best there is

:astonished:

yes clear, for GH I can use only one instance.

Have you any idea on the maximum amount of devices that GH can handle?

Anyway I will try to find out myself

you not? Light, group, switch, script, scene …

and now I can all call them from Alxa … pretty cool

Nope. I just started playing with this. I found out not everything can be controlled from emulated hue. For example, I have a script that reads out the weather report via TTS. I named it… emulated_hue_name: 'Weather Report'.

When I say, “Alexa, turn on weather report”, it gives me its own weather report instead of the one I have in HA. :sweat:

Yes you need to give names that doesn’t conflict with Amazon own database

May I see your script?

I really doubt that trying to replace some Alexa skill would work.

You can use automations in emulated_hue?

haven’t try. I assume I can use it to turn on/off any automation. will try later.

I just want to turn on a script. if I cannot use “weather” in the device name, I wonder what other name that make sense and related to weather report. perhaps “Alexa, turn on outdoor report” ???

sure…

in template sensor…

# Weather conditions
    weather_condition:
      friendly_name: 'Weather Condition'
      value_template: "The weather condition is {{ states('sensor.dark_sky_summary') }} and {{ states('sensor.temp_feel_darksky') }} at {{ states('sensor.dark_sky_temperature') }}°C and the forecast is {{ states('sensor.dark_sky_hourly_summary') }} with temperature ranging from {{ states('sensor.dark_sky_daily_low_temperature') }}°C to {{ states('sensor.dark_sky_daily_high_temperature') }}°C"
      entity_id:
        - sensor.dark_sky_summary
        - sensor.temp_feel_darksky
        - sensor.dark_sky_temperature
        - sensor.dark_sky_hourly_summary
        - sensor.dark_sky_daily_low_temperature
        - sensor.dark_sky_daily_high_temperature


    temp_feel_darksky:
      friendly_name: 'Dark Sky Temperature Feel'
      value_template: >-
          {%- if states.sensor.dark_sky_temperature.state | float < 29 %}
              nice
          {%- elif states.sensor.dark_sky_temperature.state | float < 31 %}
              warm
          {%- elif states.sensor.dark_sky_temperature.state | float < 33 %}
              hot
          {% else %}
              baking
          {%- endif %}
      entity_id: sensor.dark_sky_temperature

in script…

howistheweather:
  alias: 'How is the weather?'
  sequence:
    - service: tts.google_say
      entity_id: media_player.vlc_living_room
      data:
        message: "{{ states('sensor.weather_condition') }}"

so far no discovery of elements from GH.

Someone that has GH and emulated_hue (WITH also a Hue physical hub) can it show me how it worked for them? After how long are the emulated_hue devices discovered by GH app?

that’s my config.

emulated_hue:
  hue1:
    type: alexa
    listen_port: 8301
    target_ip: 192.168.1.92
    exposed_domains:
      - switch
      - script
      - light
  hue2:
    type: alexa
    listen_port: 8302
    target_ip: 192.168.1.92
    exposed_domains:
      - scene
  hue3:
    type: alexa
    listen_port: 8303
    target_ip: 192.168.1.92
    exposed_domains:
      - group
  hue4:
    type: google_home
    listen_port: 80
    target_ip: 192.168.1.91
    exposed_domains:
      - switch
      - script
      - light

has this error anything to do ?

17-02-25 13:34:00 ERROR (MainThread) [homeassistant.components.http] Failed to create HTTP server at port 80: [Errno 13] error while attempting to bind on address (‘192.168.1.239’, 80): permission denied

This error indicates that you might already have some other program that is using this port. You might have a web server, proxy, etc. that is already using port 80.

I had a web server that I took out when I used HA bridge. Now I stopped HA bridge from booting.

Not sure what else can be, or how to troubleshoot

Sorry, missed this message. So, you found that HA Bridge was using the port.

I have this test config:

emulated_hue:
  hue1:
    type: alexa
    listen_port: 8301
    expose_by_default: true
    exposed_domains:
      - fan
      - group
      - climate
      - script
  hue2:
    type: alexa
    listen_port: 8302
    expose_by_default: true
    exposed_domains:
      - light
  hue3:
    type: google_home
    listen_port: 80
    expose_by_default: true
    exposed_domains:
      - fan

Then I checked to see if that port was allocated: netstat -anp | grep 80

This showed that a python application (HA) had the port opened.

Then I queried the web address: http://192.168.1.211/description.xml

I received this:

<root xmlns="urn:schemas-upnp-org:device-1-0">
  <specVersion>
    <major>1</major>
    <minor>0</minor>
  </specVersion>
  <URLBase>http://192.168.1.211:80/</URLBase>
  <device>
    <deviceType>urn:schemas-upnp-org:device:Basic:1</deviceType>
    <friendlyName>HASS Bridge (192.168.1.211)</friendlyName>
    <manufacturer>Royal Philips Electronics</manufacturer>
    <manufacturerURL>http://www.philips.com</manufacturerURL>
    <modelDescription>Philips hue Personal Wireless Lighting</modelDescription>
    <modelName>Philips hue bridge 2015</modelName>
    <modelNumber>BSB002</modelNumber>
    <modelURL>http://www.meethue.com</modelURL>
    <serialNumber>80</serialNumber>
    <UDN>uuid:2f402f80-da50-11e1-80-001788255acc</UDN>
  </device>
</root>

Now - remember my code changes some values in this output - like serialNumber, UDN, etc. I could make a change in the code that if this is ‘google home’ don’t apply these changes.

Then I tried this URL: http://192.168.1.211/api/pi/lights

And got back a series of these:

{
  1:  {
	 modelid: "HASS123",
	 name: "Guest Bedroom Fan",
	 state:  {
		bri: 0,
		on: false,
		reachable: true
	},
	swversion: "123",
	type: "Dimmable light",
	uniqueid: "fan.guest_bedroom_fan"
  },
  … more of the fans
}

I didn’t try to check the UPNP discovery.

I don’t have a Google Home so I can’t confirm that it would work.

But this should give you some idea that most of this seems to be working.