Phew, another dev log!
For me, I had to figure out, what code should be part of the API, and what is the purpose of the coordinator?
I compared to ha-wiiu (https://github.com/wiiu-smarthome/ha-wiiu/blob/main/custom_components/nintendo_wiiu_ristretto/coordinator.py) as an example, and decided that:
- The “API” is the equivalent of “ha-wiiu” coordinator’s “Wii” object - it contains the methods for actually doing the requests. (For this project, Pywikibot does not use asyncio, so the “API” is our “wrapper” so the API calls do not interrupt the main loop)
- The “coordinator” is.. well, now it makes more sense to say it is a coordinator. It will poll the API when needed, but store data that is actually relevant.
So once I figured that out, it was off to me playing around with pywikibot to see how I could get site-specific user contributions. It seems that I will just have to count items in the contribution list, but for global site info (so, like all Wikimedia projects), it has its own accessible field.
So now I have a “0” in the sensor reading “Contributions”, which is correct because I have not made any edits to Test Wikipedia. I should soon be able to hook things up to other MediaWiki instances and see actual values!
Comments 0
No comments yet. Be the first!
Sign in to join the conversation.