Working on multiple emulated_hue instances

Just to let you know - I counted the number of devices in this API output. There are only 48 devices listed.

Note: this is the URL that is queried by the Echo to get the list of devices. So, I’m not sure how your Alexa account gets updated with more than these 48 devices.

I’m still working on this emulated_hue idea. But, this is helpful info.

Sorry, don’t have any current info on why ‘scene’ might be an issue. I’ll have to look at the code I hacked on to see if anything is different around that domain.

How many scene entities do you have?

Ohh I never did …

I counted the Alexa devices in the Alexa up, and they are 138 …

Ahh so is only form the HASS, all the rest must be fro the Hue Bridge: I DO have a phisical Hue (discovered automatically) beside emulated_hue.

So it is true that the limit is 49 (maybe you counted 1 less?)

I wonder if your trick of having multiple_hue is working

In HASS I have
14 script
19 switches
5 yeelight
1 flux_led
2 xiaomi

so that’s 41 …

My scenes are 35-12 excluded so 23

35 in HASS but some I excluded since they are also in the hue bridge, to avoid duplicate (but never really tested )

below the excluded

 scene.dimmed_livingroom:
    emulated_hue: false
 scene.relax_livingroom:
    emulated_hue: false
 scene.bright_livingroom:
    emulated_hue: false
 scene.concentrate_livingroom:
    emulated_hue: false
 scene.dimmed_front_yard:
    emulated_hue: false
 scene.relax_front_yard:
    emulated_hue: false
 scene.bright_front_yard:
    emulated_hue: false
 scene.concentrate_front_yard:
    emulated_hue: false
 scene.dimmed_tv_room:
    emulated_hue: false
 scene.relax_tv_room:
    emulated_hue: false
 scene.bright_tv_room:
    emulated_hue: false
 scene.concentrate_tv_room:
    emulated_hue: false

I don’t understand: you did or not split in multiple emulated_hue, so you find the solution or not?

Yes - running multiple emulated_hue instances on my HAAS solved my problem of my Echo discovering a high number of devices.

I split my light loads and other devices (scripts/climate/fan/etc.) between two emulated_hue instances.

Ok, thanks.

You showed us various solutions. WHich is the one that works best?

@shenning00
I do not understand this. Beside modifying the configuration.yaml with the emulated_hue instruction (posting multiple hue) do I need to do anything else?

where does this go … ?

In this thread I am talking about changes I have made to my version of HA. These changes are not part of the current distribution. I am not a HA developer - but I might eventually look at merging some of these changes into HA.

In a few days I will post the code changes to this thread.

You can try this version of the emulated_hue at that time.

I will provide directions on how to get it running at that time.

now I understand, hope to see this change in the HA distribution

@anon35356645 - I migrated my changes to the 0.38.3 version of HA.

I have been busy and haven’t had much time to confirm the changes. I was able to get 79 devices registered with Alexa. But, I haven’t tried any “Alex, turn on…” options.

I went ahead and created a new github repository to store the component for now.

You can download it from here: https://github.com/shenning00/emulated_hue

To install it you can just copy the ‘emulated_hue’ directory into the /config/custon_components directory.
Let me know if you try it out.

1 Like

no need to put host_ip?

trying now this new setup

emulated_hue:
  hue1:
    type: alexa
    listen_port: 8301
    exposed_domains:
      - switch
      - script
      - light
  hue2:
    type: alexa
    listen_port: 8302
    exposed_domains:
      - scene
      - group

Instead of this

emulated_hue:
  host_ip: 192.168.1.239
  type: alexa
  expose_by_default: true
  exposed_domains:
    - switch
    - script
    - light

no script, no scene (just scene from phisical hue) and no switch are discovered.

LOG

17-02-18 11:11:35 WARNING (Thread-7) [custom_components.emulated_hue] Alexa type is deprecated and will be removed in a future version
17-02-18 11:11:35 WARNING (Thread-7) [custom_components.emulated_hue] Listen IP address not specified, auto-detected address is 192.168.1.239
17-02-18 11:11:35 ERROR (Thread-7) [custom_components.emulated_hue] listen port - 8301
17-02-18 11:11:35 WARNING (Thread-7) [custom_components.emulated_hue] Alexa type is deprecated and will be removed in a future version
17-02-18 11:11:35 WARNING (Thread-7) [custom_components.emulated_hue] Listen IP address not specified, auto-detected address is 192.168.1.239
17-02-18 11:11:35 ERROR (Thread-7) [custom_components.emulated_hue] listen port - 8302

I don’t understand that error on the port: I will now use 8300 for Hue1 and 8303 for Hue 2

EDIT, no same error

17-02-18 11:31:06 WARNING (Thread-1) [custom_components.emulated_hue] Listen IP address not specified, auto-detected address is 192.168.1.239
17-02-18 11:31:06 ERROR (Thread-1) [custom_components.emulated_hue] listen port - 8300
17-02-18 11:31:06 WARNING (Thread-1) [custom_components.emulated_hue] Alexa type is deprecated and will be removed in a future version
17-02-18 11:31:06 WARNING (Thread-1) [custom_components.emulated_hue] Listen IP address not specified, auto-detected address is 192.168.1.239
17-02-18 11:31:06 ERROR (Thread-1) [custom_components.emulated_hue] listen port - 8303

The ‘error’ log about the port is not really an error it is just a log that I added for myself that uses _LOGGER.error(). I some times use that because the highlighting (red) stands out.

I will change it to info or remove it.

Also, the IP address is not required. It will default to the primary IP address for HA.

I have not tried using two different IP addresses. I don’t see a problem with that working.

Now - as to why you are having trouble. Did you look at the two new emulated_hue descriptions and lights api?:

http://192.168.1.239:8301/description.xml
http://192.168.1.238:8302/description.xml

You should get something that looks like this:

<?xml version="1.0" encoding="UTF-8" ?>
<root xmlns="urn:schemas-upnp-org:device-1-0">
<specVersion>
  <major>1</major>
  <minor>0</minor>
</specVersion>
<URLBase>http://192.168.1.211:8301/</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>1234</serialNumber>
    <UDN>uuid:2f402f80-da50-11e1-8301-001788255acc</UDN>
  </device>
</root>

Note: the configured port number (e.g. 8301) should show up in the UDN:

<UDN>uuid:2f402f80-da50-11e1-(port)-001788255acc</UDN>

Then take a look at the lights API for both emulated_hue ports:

http://192.168.1.239:8301:8301/api/pi/lights
http://192.168.1.239:8301:8302/api/pi/lights

These emulated_hue links should report the exposed_domain devices as defined in your configuration file.

I should be able to do some more testing this evening. But, let me know how these reports look on your system.

Yes I get both description.xml and api/pi/lights correctly.

But Alexa finds only the regular HUE and not the emulated HUE

<root xmlns="urn:schemas-upnp-org:device-1-0">
<specVersion>
<major>1</major>
<minor>0</minor>
</specVersion>
<URLBase>http://192.168.1.239:8302/</URLBase>
<device>
<deviceType>urn:schemas-upnp-org:device:Basic:1</deviceType>
<friendlyName>HASS Bridge (192.168.1.239)</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>1234</serialNumber>
<UDN>uuid:2f402f80-da50-11e1-8302-001788255acc</UDN>
</device>
</root>

Now trying hue 1 with light, script and switch, and hue 2 only scene (take out groups, maybe they are too many)

You might try turning off the regular HUE and try it with just the emulated HUE. I remember reading somewhere that they have some issues working together.

The emulated_hue has as random response time delay between 1 and 8 seconds. I added this because even the different instances of emulated_hue’s were having issues when responding simultaneous.