Is it possible to invert or logically negate the state argument?
Suppose I have a sensor that has three (3) possible states. I want to create a history_stat sensor that reports the time for all states but “off.” The result would be for the other two possible states, i.e. NOT “off”. Can this be the history_stat state: argument NOT (“off”) or !(“off”)?
example:
- platform: history_stat
name: state_test
entity: sensor.history_test
state: NOT("off") or !("off")
type: time
start:
end:
Yes, i had tried that and it was not working. Because, despite how entities are written in either all lower case or mixed upper/lower, I have gotten into the habit of entering only lower case in code sections. The yaml interpreter throws up otherwise. This does not apply to entity states in the DB and I sometimes forgot that.
Correcting the state spelling to match exactly as to upper/lower case, fixed the list aspect of the state: entry.
Actually I was trying the other method only as a test which is no longer needed.
Thanks
Please consider marking my post above with the Solution tag. It will automatically place a check-mark next to the topic’s title which signals to other users that this topic has been resolved. This helps users find answers to similar questions.