Trouble with HUE Emulated Lights in Hassio 98.5

Hi all,

I posted this under an old thread with no responses. I’m guessing it was too old so I’m re-posting it as a new issue. I hope this is ok on the forum but I wonder if anyone else has experienced a problem like this.

My Emulated hue light was working great as mentioned here until I had to rebuild my system. I used the latest version at the time 2.12 (Hassio 98.5) upgraded from 88.4. Funny thing is that

  1. my Alexa app now says “device doesn’t support requested data”
  2. I can see the brightness value change in HA using the “States” page. But,…
  3. when Alexa sets it to 1% brightness, HA States show it to be 4
  4. Alexa shows a status of “device malfunction”

My Configuration.yaml looks like this (used to work):

emulated_hue:
 # type: alexa
  host_ip: 192.168.0.xxx
  listen_port: 80
  expose_by_default: false
  exposed_domains:
 #  - light (don't want all lights exposed - Alexa does it fine)
  entities:
    light.alexa_virtual:
      name: "Alexa Virtual Light"
      hidden: false

I’ve deleted the light from Alexa then discovered devices and same behavior. I don’t know why it broke and I hope someone can help me get it going again.
EDIT:
When I look at the json from the emulated hue using my browser hassio-ip:80/api/pi/lights, I see:

{"1": {"modelid": "HASS123", "name": "security check", "state": {"bri": 0, "hue": 0, "on": false, "reachable": true, "sat": 0}, "swversion": "123", "type": "Dimmable light", "uniqueid": "light.security_check"}, "2": {"modelid": "HASS123", "name": "Alexa Virtual Light", "state": {"bri": 4, "hue": null, "on": true, "reachable": true, "sat": null}, "swversion": "123", "type": "Dimmable light", "uniqueid": "light.alexa_virtual"}}

And looking at some of the comments on the github page, maybe the null values are causing Alexa errors?
Thanks for any help.

Some minor progress but still - the status of the emulated hue on the Alexa app is “Device doesn’t support requested value” and also the values from 1% to 4% are off in HA. A 1% should come back to HA as less than 3 (2.54 but I don’t know if it only sends an integer already rounded off or up or down. ) When we do a states.light.alexa_virtual.attributes.brightness | int / 255 * 100 it used to correctly give a 1, 2, 3 but no more. Now a 1% resolves to 2, 2% also = 2, 3%= 4, 4% = 4, while 5 and up seem to be ok. I realize I could change my multi-command automation to not use 1 through 4, but it just seems unreliable and probably won’t survive another upgrade. I’d rather fix it.

Here is a test automation:

- id: test_command_alexa
  alias: Vtest
  trigger:
  - entity_id: light.alexa_virtual
    from: 'off'
    platform: state
    to: 'on'
  condition: []
  action:
  - service: alexa_media.update_last_called
  - delay: 00:00:01
  - service: notify.alexa_media
    data_template:
      target:
      - '{{ states.sensor.last_alexa.state }}'
      data:
        type: tts
      message: Virtual light set to level '{{ states.light.alexa_virtual.attributes.brightness }}' which equals '{{(states.light.alexa_virtual.attributes.brightness | int / 255 * 100 ) | round}}'.
  - delay: 00:00:03
  - data:
      entity_id: light.alexa_virtual
    service: light.turn_off

Can someone else run it and let me know what your Alexa says? Also, please let me know what version of HA, emulated_hue, and Alexa_Media add-on you are running?

Thanks all.

emulated hue is semi broken right now, been this way for quite a few versions.

https://github.com/home-assistant/home-assistant/issues/26425

https://github.com/home-assistant/home-assistant/pull/26541

I moved away from it because it’s not getting better.

Hey thanks Petro.

I finally found this morning the github issues page and saw how broken it has been. You’ll see a writeup from me there today. I’m guessing the coincidence of me rebuilding my system at the same time it broke has stymied my troubleshooting efforts. I thought I was doing something wrong with my new build.

However, I use hassio and it was producing an emulated_hue virtual light just from my configuration.yaml entry without having the hue_api.py in custom_components folder. So I made the folder and put the latest version in the emulated_hue folder. Since nothing happened, some of my troubleshooting included making a tiny text change (swversion=133 instead of 123) in hue_api.py to see what was producing the errors. None of my changes show up which tells me hue support is coming from somewhere else but I can’t find it.

Still working on it so thanks for the assist. I appreciate it.

Bart

Alexa’s firmware has a tendency to cache devices and it doesn’t let go of them. This is probably what’s happening.

Thanks for the response Petro.
I don’t think the issue I see is an Alexa cache problem. I use a browser to open port 80 on the HA Pi system running Hassio and I see the hue device JSON string returned from HA. It doesn’t reflect the python script in the components folder. That’s what has me confused as to what is responding to the emulated hue requests.
The JSON string looks ok until I try to turn one of the lights on to a certain brightness. The next time I access the web page I see null values in the return JSON. But the swversion remains 123 not 133 as I explained when I changed it to be 133.
Still scratching my head over that.

Cheers,
Bart