hard to identify code issues if it’s not formatted.
forcing some sort of polling is a real hack. have you looked at the traces and see if it got triggered and maybe eliminatedby the condition? or did it not get triggered at all?
also look at the sensor history and see what the system is seeing for the change in sensor readings. if the history logs in home assistant are indeed seeing the right values, then it’s most likely bug in your code.
also you’ll help yourself a lot if you switch from using those unreadable device_id’s and use friendly entity_id’s: