Open
Description
I'm trying to create a virtual light entity by setting its state in my PyScript.
@state_trigger("light.virtual_dimmer == 'on'")
def test():
print("HELLO WORLD!")
attr_dict = {
"friendly_name": "Virtual dimmer",
"supported_color_modes": ["brightness"],
"brightness": 0,
"icon": "mdi:lightbulb",
"device_class": "light",
}
state.set("light.virtual_dimmer", "off", attr_dict)
The entity is created, I can see it in the developer tools. However, when I add it to my dashboard and try to swich it off/on (hoping to see "HELLO WORLD" in the logs) instead I'm getting the WARNING (MainThread) [homeassistant.helpers.service] Referenced entities light.virtual_dimmer are missing or not currently available
.
What am I doing wrong? How is this supposed to work correctly? Is this possible at all?
Metadata:
Home Assistant: 2025.1
HAOS: 14.1
PyScript: 1.6.1
Metadata
Metadata
Assignees
Labels
No labels