Hello, sorry for a probably really stupid question, but having tried for hours I cannot get whole room switching working. I am a complete novice with node-red.
I am using Node-red in a home assistant setting.
Have got an inject node connected to a service node and can easily control a single light entity such as light.bed_ceiling_1.
However if I try light.bedceiling to turn them all on I get “Call-Service attempted without connection to server” error in the debug window.
Can anybody point me to an example of how to turn on/off and entire room/area rather than just one light entity.
The actual aim is to get presence faker to control whole rooms rather than one light.
I have my lights grouped into areas.
Thanks.
Have you defined a light group or regular group in HA? NR can only switch things that are defined as entities in HA. In your situation, I would use a light group and then just use the same service call on that works for a single light but replace the entity with the entity created by the group.
Note: you will need to reboot HA after you create the group in your config files for the entity to be created.
Thank you for reply. I have only put the lights in an area so far such as bedroom.
I will take a good look at defining a light group. That sounds like a promising idea.
Put bedroom lights in light group and used generated entity and yes that worked.
Seems a little odd thought that I already had a gui switch labeled bedroom but could not use that in NR or perhaps do not know how.
Thanks again for the help, now I can progress a little more.
Sorry folks, but I’m struggling here and need a bit of help. I’m trying to define light groups our of a combination of lights, and switches.
Using:
light: !include light_groups.yaml
in my configuration.yaml
I’ve defined a switch as a light…
-
platform: switch
name: Bar Light
entity_id: switch.bar_light -
platform: group
name: Kitchen Lights
entities:- switch.bar_light
- switch.ebcbc1fab98b0b4426yu8p_1
- light.kitchen_table_chandelier
- light.kitchen_main_lights
but I’m getting an error. Is there some sort of an inheritance problem? What am I doing wrong?
What’s the error message? Are you sure you can use a light switch inside light groups?
I’m not sure, that’s why I’m asking.
I have “switches”, that I want to behave as “light” entities, so that I can add them to light groups and automations.
The error reads like this
" Invalid config for [light.group]: Entity ID ‘switch.bar_light’ does not belong to domain ‘light’ for dictionary value @ data[‘entities’]. Got [‘switch.bar_light’, ‘switch.ebcbc1fab98b0b4426yu8p_1’, ‘light.kitchen_table_chandelier’, ‘light.kitchen_main_lights’]. (See ?, line ?). "
There’s your error. Light groups expect entities from the ‘light’ domain, and you’re using entities from the ‘switch’ domain.
You must use the light entity created by the code you posted. By the name you chose, it’s probably light.bar_light
.
You’ll have to create a light switch for this entity too.