wingertge / ambientika-py

MIT License
3 stars 0 forks source link

air_quality Enum? #1

Open RichieB2B opened 3 weeks ago

RichieB2B commented 3 weeks ago

Thanks a lot for this project! It works great from my O.ERRE Ghost APP ventilator just by setting the host to https://www.app-oerre.it:4521

I'm implementing a Prometheus exporter and I'm surprised to see that air_quality is a string and not an Enum. I understand it is the API that works that way, but I want to convert it back to an int for logging purposes. So far I've seen these values:

Medium VeryGood

Do you know what other values are possible? Low? Good?

wingertge commented 3 weeks ago

There's no official way to access the API, I had to reverse engineer it with an HTTP interceptor. Unfortunately that means I can't see the full range of enum values, only what I get on my device. That's why I left it as a string for the time being. So far I've seen "Good" and "Medium", and what is displayed as "Bad" in the UI but I wasn't looking at the requests at the time so I don't know if that's the internal name. Seems in line with "Good" and "VeryGood" tho. If I had to guess there's probably a "VeryBad" on the other end too.

RichieB2B commented 3 weeks ago

Interesting. I've just seen "Good" as well. So it could be:

VeryBad Bad Medium Good VeryGood

wingertge commented 3 weeks ago

I've seen a similar pattern elsewhere in the API. I'll try to make an enum out of it with those values when I have some time and see if it encounters anything else.

RichieB2B commented 3 weeks ago

Last night I saw "Poor" both in the app and API. So I think we should go for:

Poor Bad Medium Good VeryGood

Assuming that is the correct order.