For instance, I’d like to refer to my bathroom sink light as both bathroom_sink_light and bathroom_light.
I know I can create a Copy Switch, but is there a cleaner, simpler way to accomplish this?
For instance, I’d like to refer to my bathroom sink light as both bathroom_sink_light and bathroom_light.
I know I can create a Copy Switch, but is there a cleaner, simpler way to accomplish this?
why do you want it to have 2 different names? And by name, do you mean name that shows up in the interface or entity_id?
I mean having a completely separate entity_id. It’s useful for templating to have them named similarly.
For example, with this automation below I’m able to have a single automation that triggers the state of a corresponding switch by manipulating the name of the entity_id. It’s also useful when integrating with Amazon Echo.
##################################################################
- alias: bathroom switches automation
##################################################################
initial_state: true
trigger:
platform: state
entity_id:
- switch.wemo_bathroom_sink_light
- switch.wemo_bathroom_toilet_light
- switch.wemo_bathroom_tub_light
- switch.zwave_bathroom_fan
- switch.zwave_bathroom_heater
action:
service_template: homeassistant.turn_{{ trigger.to_state.state }}
data_template:
entity_id: "{{ trigger.entity_id|regex_replace('(wemo|zwave)_','') }}"
Well, I guess I don’t even understand why that’s needed. Seems like you just have some hardware pointing to some other switches with the same name minus the wemo_/zwave_.
Well, either way, the short answer is exactly what you had in mind. Create another template switch. But you’ll have a second entity in the interface.
Currently, there’s no way to just give an entity a second entity_id. Your only option is to create a template switch. But is that really worth it? That’s a ton of configuration just to get a name that lends well in templates. You can always just build a dictionary that maps names. Or move to appdaemon so you can have 2 entity id’s by building a function that finds what you want based on the ‘unwanted’ names.