I want to create my own “custom_initial_state” attribute for every automation, because when I start Home Assistant, I disable every automation until initialization of the system is completed. Then I turn on every automation. I’d like to be able to use custom_initial_state to decide which automations should be enabled.
Is there a way to create such custom attributes that I can, with native HA functionality
configure the initial value in a yaml file
modify the value with code
store the state in the database
I’ve seen some people use AppDaemon, but I’d like to avoid going “outside” of HA.
I am trying to fathom how this works but cannot fully understand.
I have covers that I would like to add an attribute open_position: to which would be the value from an input_number helper by the same name i.e. [cover|input_number].kitchen blind_1 for example and trying to dtermine the cleanest way to do this in customize.yaml…
Sorry, I should have made it clearer… what that allows you is to create new attributes with static values in them.
What you can then do is create new sensors that will use those static values: in my case, I am using those extra attributes to have “companion” devices that I will then monitor for specific automations (for example, when door A is open, turn on the indicated companion lamp)
Nevermind, I was trying to read more into what you’re doing than what is simply there!
I found 2 other entities I gleaned from somewhere which template their friendly_name: in a strange way so I copied that code and now have
I’ve successfully been using this strategy for storing string data as custom attributes for a while and just realized that some of these are now being cleared. I assume that this happened after I updated something.
This happens on a zigbee2mqtt device binary_sensor entity (a motion sensor). After reloading my customize.yaml, I see the custom attributes, but after about a minute, they are gone. I was relying on these for templating in automations and to avoid LONG templating with a ton of IF/ELSE statements. When the motion triggers, I want to read the attribute to know what to do with that state change.
Anyone have any idea why this is happening or a better way of doing this? I tried looking into how to add the attributes from z2m, but didn’t get anywhere. I assume that when the MQTT message is sent to update the device’s entities that it is wiping out my custom attributes.