Create a virtual Dimmer or light template for Alexa

Hi I’m looking at doing something similar but for exposure to Nodered instead of Alexa.

The above works fine, it gives me a lightbulb in the GUI and the toggle switch and when switching on and off it changes colour in the GUI and NodeRed gets the values. So on/off works perfect.

What I was actually hoping to achieve was getting a dummy light in the GUI that I can also dim. So it’s not just on/off but also a slider to set value between 0-255 or 0-100.

Can anyone help in how I turn the below which gives a light bulb passing on on/off into a light that passes on on/off and %

I expected the set_level line to take care of that but for some reason it doesn’t.

My config is

# Test light
light:
  - platform: template
    lights:
      hallway_lights:
        friendly_name: "Licht gang"
        turn_on:
          #
        turn_off:
          #
        set_level:

I have no issue, passing dim levels from Alexa.

in HA GUI can you change the dummy switch dim levels ?

No it just shows up as a light bulb in the GUI with a toggle switch next to it. So currently can’t enter the level in the GUI.

So I would like this dummy switch to show up as a slider in the GUI, so I can enter the % or brightness in the GUI.

Strange here is my entry

Using a config very similar to yours

@lonebaggie thanks my mistake. It indeed works. I was looking for the slider in the front end

Ok @lonebaggie , I already had the virtual light template as I mentioned in the other thread. But I had limited the emulated_hue to just scripts like this:

emulated_hue:
  type: alexa
  expose_by_default: true
  exposed_domains:
    - script
  entities:
    light.alexa_virtual:
      name: "Alexa Virtual Light"

I saw only 2 of my scripts which worked fine from Alexa. It did not find the Alexa Virtual light.

I then tried using the emulated_hue as above with just the one entity listed and Alexa found every HA device I had plus scripts and automations - 43 new devices! All of them were emulated hue lights and contained duplicates of devices I had already plus the Alexa Virtual Light. So I had to delete them all from Alexa App and change my config to:

emulated_hue:
  exposed_domains:
    - script
  entities:
    light.alexa_virtual:
      name: "Alexa Virtual Light"

and only the scripts are exposed again.

So after looking at the emulated hue thread here I found that I had to explicitly declare hidden: false, like this:

emulated_hue:
  expose_by_default: false
  entities:
    light.alexa_virtual:
      name: "Alexa Virtual Light"
      hidden: false

to finally get just the light to be seen by Alexa.

Thanks for all the help and I hope this helps others find their way.

1 Like

Trouble with HUE Emulated Lights in Hassio 98.5 anyone?

My Emulated hue was working great as mentioned above until I had to rebuild my system. I used the latest version at the time 2.12 (Hassio 98.5). 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):

mulated_hue:
 # type: alexa
  host_ip: 192.168.0.xxx
  listen_port: 80
  expose_by_default: false
  exposed_domains:
 #  - light
  entities:
    light.alexa_virtual:
      name: "Alexa Virtual Light"
      hidden: false

I don’t know why it broke and I hope someone can help me get it going again.

Thanks for any help.

Hi there,

I’m thinking about doing the opposite of what the OP did. I have a ton of input_booleans in HA that I use to trigger infrared transmissions in Node-RED using node-red-contrib-broadlink-control.

Does anyone know a way to encode these input_booleans in groups of 16 inside words (or 8/byte) and expose those words/bytes to Node-RED for later decoding?

Thanks.

Maybe input_number with set_value service?

Hi all,

Following the steps that you all said here, I created this:

light:
  - platform: template
    lights:
      theater_lights:
        friendly_name: "Alexa Lux Sim Entrada"
        turn_on:
          service: script.theater_lights_on
        turn_off:
          service: script.theater_lights_off
        


emulated_hue:
  entities:
    light.alexa_virtual:
      name: "Alexa Lux Sim Entrada"

HO assistant finds it, but Alexa is not finding it. Can you help me?

Also, when trying to turn it on I find the following error “Failed to call service light/turn_on. Unable to find service script/theater_lights_on”

Thanks in advance!

You have created a different light template . For Emulated Hue to see that light you need to expose

emulated_hue:
  entities:
    light.theater_lights:
      name: "theater_lights"

edit your service to call the script is wrong, you need an entity id

service: script.turn_on
data:
  entity_id: script.theater_lights_on

Hi,

Sorry, I’m very new on this and trying to understand this codes.

so in configuration.yaml I have to do:

light:
  - platform: template
    lights:
      alexa_virtual:
        friendly_name: "Dummy light"
        turn_on:
            service: script.turn_on
            data:
            entity_id: script.dummy_ligh_on  
        turn_off:
            service: script.turn_off
            data:
            entity_id: script.dummy_ligh_off
        


emulated_hue:
  entities:
    light.dummy_light:
      name: "Dummy light"

If not, I don’t understand in what file the first part of the code has to go.

The part from emulated_hue I imagine that is inside configuration.yaml

The edit the call scrip, I imagine that other than to add this ligts, I have to create a script that has to turn on the device on, correct?

Sorry again, too new and never coded a lot.

Thanks in advance!

Baby steps :slight_smile:

What are you trying to do ?

hahahha, yes, thanks and sorry.

So as said in the other post, I have 2 Tuya door sensor that they are not accessed in Smart Life app from HA, and I’m unable to find their IP, as they connect only for 1 second when door opens and closes, so manual IP configuration for them it’s imposible. The workaround that I found is, as Alexa recognize it, is to have a smartplug to be turned on when the door is open. The issue of this system is that I have to have a smart plug (well, two as they are two sensors) only used of this.

The idea, to solve this issue, is to have a virtual small plug/light/other device that Alexa con turn on and so HA will recognize it. This is usefull for a Home Made alarm system.

So following yout steps, I created a light, but of course I’m doing something bad, because the virtua light is not turning on and off and neither Alexa finds it. The current configuration is the one that I added in the previous post.
I have several Alexa, a Nest Mini and a Hue Bridge with some lights.

Thanks in advance for your help.

OK . small steps .First you have to get Emulated hue , or Nabu Casa working. see

You must able to get a device from HA to be recognised by Alexa , otherwise you have nothing to trigger.

Once you have a device from HA in Alexa . You can create a routine in Alexa that when the motion detector is activated you get alexa to trigger that HA device (switch, bulb , script , etc). That’s the idea for the virtual bulb its just a trigger for HA to react too.

Your trying to do everything in one step

Hi,

Thanks for this links. I managed to create following the instructions the virtual light, but I have 2 problems now with it.

Problem 1: It duplicated all the lights, don’t know if you know a way to undo this and only to have the new lights.
Problem 2: HA and Alexa are unable to turn on and off the light created that I named “Alexa Luz Sim Entrada”. Here I think the issue is #Luz Falsa# that script “script.theater_lights_on” doesn’t exist in my HA, but when creating it, I don’t know what to do with or activate.

If you can help, (another time) I really apreciate it a lot.

This is the code that I used:

#### Fake Hue ###

emulated_hue:
  listen_port: 80
  off_maps_to_on_domains:
    - script
    - scene
  expose_by_default: true
  exposed_domains:
    - light
  entities:
    light.sensor_entrada_light:
      name: "Alexa Luz Sim Entrada"

#### En Fake Hue ####

#Luz Falsa#

light:
  - platform: template
    lights:
      theater_lights:
        friendly_name: "Alexa Luz Sim Entrada"
        turn_on:
          service: script.theater_lights_on
        turn_off:
          service: script.theater_lights_off
        
#End Luz Falsa

I think you have exposed all the lights to Alexa.

Remove

expose_by_default: true
exposed_domains:
- light

Then login into Alexa via the web and forget all and redicover

If the light scripts are not working In HA, then you will need to raise another thread , I dont think you need a virtual bulb :slight_smile:

Hi,

Thanks again for the reply. So I’ll remove that and manually delete it.

The script " script.theater_lights_on" I have not created anything, only added that commanad. You think that a script inside HA with the same name has to be created?

If not, I’ll raise a thread with it. Thanks again (a 1000) for your help!

Regards,

Hi solved!

If I removed the "expose_by_default: true" it will cause that all the devices are detected. So I keep it. Manually I can remove the other devices, but they do not disturb right now, also if they are duplicated. The expose to false maybe I can do it once I want to add more lights or things to HUE, or if removing the rest and doing a future manual check.

To solve the issue with the light on/off I removed the script part and is working, so I left it as:

light:
  - platform: template
    lights:
      theater_lights:
        friendly_name: "Alexa Sensor Sim Entrada"
        turn_on:
        turn_off:

With the Alexa automatio now what I wanted is working perfectly (other that the 20 extra devices :smiley: )

Thanks again and have a nice day!

Regards,

1 Like

Hi all,

Just had another issue after one of the last updates, and the turn_on and turn_off gives an error “Inccorct type. Expected “object””. But I’m unable how to solve it.

light:
  - platform: template
    lights:
      theater_lights:
        friendly_name: "Alexa Sensor Sim Entrada"
        turn_on: *Here is the error code*
        turn_off: *Here is the error code*

Any ideas?