Virtual light setup in yaml

So I’ve been following numerous posts about setting up Alexa to respond based on the brightness of a virtual light. Unfortunately I can’t seem to get my setup to recognize that the light has a brightness attribute. Here is my code for setting up the light which is in my configuration.yaml. When I go to the Dev Tools Templating, I get “None” when I try to return brightness.

{{ state_attr('light.alexa_virtual','brightness') }}

    - platform: template
          friendly_name: "Alexa Dummy Light"

The brightness attribute is rendered based on the level_template. You haven’t set a level_template.

1 Like

Thanks that did it. I copied the Template Light from the documentation and add this line as suggested:

level_template: "{{ state_attr('sensor.theater_brightness', 'lux')|int }}"

Now I can retrieve the brightness. If I go to Dev Tools and set the brightness, it returns as expected. Now the next issue. When I have Alexa set the brightness, I get 0. Doesn’t matter what I put in. Do I need to use Emulated Hue in this case?

I was able to get it working. I decided to go the route of hass-virtual by twrecked.

Installed that using HACS and put it in the configuration.yaml. Once that was done I just had to update my entity ids appropriately and it was off and running.