I have an entity where I can see the state and if I use is_state(, “value”) it works, but if I try to use state_attr(,“state”) or state_attr(, “State”), it returns none. I have also tried state.state, but that doesn’t work either.
What is the correct way to get the value for state of an entity?
to get the current temperature, but the other value I want (the mode) is only listed in the State column using the developer tools States tab. So I want to be able to do a state_attr that returns the value of that. I know I can use is_state, but I would like to understand how to get this value using state_attr.
I understood your original question and answered it. Use states() to get an entity’s state value, use state_attr() to get the value of an entity’s attribute. Two different functions for two different purposes.
You’re asking how to use state_attr() to get the value of an entity’s state. It’s not designed to do that.
Question for you:
Why do you want to use a function intended for getting the value of an entity’s attributes to get the value of an entity’s state?