There’s one issue I noticed now. It seems the filter sensor doesn’t check the air quality when the fan speed is set to 0. I need to figure out how to turn the fan off while still checking the quality. I’m sure this wasn’t an issue before.
Edit: I think I can do it by not setting the fan speed to 0 but by turning the filter off. For some Eason this way it continues to check the air quality. Thought I could do this with a simple choose that turns the filter off if the ID is 0 and the default action being your code but I can’t even figure out how to do a proper choose.
I wanted to do some testing in the meantime to find where the issue comes from and now I’m even more confused.
To test I kept your original script as is except I changed the timer to 10 seconds. Then I turned it on manually to get it to read the actual quality. When the quality went below 5 the purifier turned off. I waited a while, then opened a window to get the value rising and even though the purifier was off it detected the change in air quality and the automation triggered as expected. I suspect it was only working because I kept the VeSync app open on my phone to watch the value and this somehow makes the purifier check the air? I don’t know why else the value sat at 5 for hours until I turned the purifier on manually and the value suddenly jumped above 50.