pyscript
pyscript copied to clipboard
'StateVal' object has no attribute 'old'
I'm trying to receive a notification on 'sensor.hacs' value raise only, rather than lower and raise, and I came up with unexpected behavior. In case you don't know what 'sensor.hacs' is, this sensor indicates the total number of HACS updates available, so if a new update appears, it goes up, and when you install one of them, it goes down.
@state_trigger(int(sensor.hacs) > int(sensor.hacs.old), state_check_now=True)
Results in
int(sensor.hacs) > int(sensor.hacs.old)
^
AttributeError: 'StateVal' object has no attribute 'old'
but the documentation states that .old can be used and only results in None if the .old hasn't yet been filled.