Quantcast
Channel: Configuration - Home Assistant Community
Viewing all articles
Browse latest Browse all 96121

Extending entities with custom attributes

$
0
0

@FutureTense wrote:

I forgot where I discovered this, so if you know where the documentation is, please remind me, but I know it’s possible to ”extend” an entity using customize: to allow you to create a custom attribute for an existing entity.

input_boolean.myboolean_a:
  mapped_input_text_entityid: 'input_text.foo'

input_boolean.myboolean_b:
  mapped_input_text_entityid: 'input_text.bar'

So the above is used to create and set a custom attribute named mapped_input_text_entityid for two input booleans. Then I’m able to use that attribute in an automation. For example, say I have a trigger for when input_boolean.myboolean_a has a state change from false to true, I can then use that attribute to find the entityid of an expected input_text and do something with it.

    action:
      - service: input_text.set_value
        data_template:
          entity_id: trigger.to_state.attributes.mapped_input_text_entityid
          value: "666"

Is it possible to do the same thing for other entities like a binary_sensor? And is there a way to do this on the fly when you create entities instead of having to do this across different locations like customize currently requires? I find tremendous value in the ability to link controls together using this concept.

Posts: 1

Participants: 1

Read full topic


Viewing all articles
Browse latest Browse all 96121

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>