Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to correctly create a virtual light entity? (Getting WARNING (MainThread) [homeassistant.helpers.service] Referenced entities light.virtual_dimmer are missing or not currently available) #690

Open
HWiese1980 opened this issue Jan 29, 2025 · 0 comments

Comments

@HWiese1980
Copy link

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant