Just setting up HA with a view to migrating from ANOther automation system after many years. I’m trying to replicate my current automations, but I’ve got stuck on a really basic case!
I have several rooms where a wall switch triggers an automation that toggles the table lamps on/off. When the lamps are on smart plugs, the automation is easy:
… trigger: wall switch [on or off]
… action: toggle lamp’s switch
But when the lamps are smart bulbs - in this case, zigbee tuneable white, dimmable ones - I can’t see how to do that.
The lamp is there on my dashboard, but I can’t select it as the device in an automation. I tried enabling advanced mode and was able to create a scene using the lamp’s entity rather than its device, but entities don’t show up in automations. In any case, I can’t actually do this with ‘on’ and ‘off’ scenes as the automation wouldn’t know which to activate as its conditions can’t test the current state of the lamp.
Help! How do I get these lamps into an automation? It seems such a very basic, simple thing to do in the UI, yet I can’t see how and an hour with google hasn’t found a solution. In the current system, I simply make the trigger device the switch and tell it to toggle the lamp state.
Thanks!
[HA latest docker, zigbee devices via zigbee2mqtt]
Ah, I think I see it. If I add the ‘Light: Toggle’ service and point that to the lamp entity, then fingers crossed… Thanks for the pointer!
Honestly, I’m struggling with the idea that switching on a lamp needs me to do anything non-obvious; it’s the most basic automation around! At least you didn’t tell me I needed to edit some YAML
The way things fit the object model in HA is hard to fathom… Why is a dimmable lamp an entity when a dimmer switch - functionally the same thing - is a device, and why can I add an entity to a scene but not directly to an action? I can see I’m going to need some headache tablets for this migration!
Devices are collections of entities and are, in HA terms, pretty new. Any integration that pre-dates devices doesn’t have them.
Device triggers/conditions/actions are very simple, and very limited. They’re the training wheels. If you’ve picked a device action you only see devices there, and you can’t do a lot with them. Same for triggers.
However, once you remove the training wheels you discover that there’s so much more you can do. That light that you can simply turn on/off… now you can pick a colour, set the brightness, have it transition to the new state… and so much more. For a state trigger, you’ve no longer got the simple dumbed down “turned on”, but you can do something like turned on to at least 50% brightness or was unavailable and is now off.
Got it I think the difference between new and old there is what creates some confusion, especially when you can’t use what appear to be equivalent real-world things in the same way.
Thanks for your help! I’ve set up a few more of my automations and got comfortable with the service-based actions; they’re not something I’d encourage novices to play with, but they’re fairly clear when you look at them. Pity that groups can’t include both lights and switches; that’s creating some extra work (current system has mixed groups). I guess HA can’t handle the differing attributes/controls.
I’m off to think about my migration plan now. I’m trying to replicate my automations on a test HA system using the current z-wave and zigbee handlers via MQTT, then migrate to HA and its equivalent add-ons once I have most of my automations ready to copy & paste. Feels do-able.