Incorporating Meross-iot into a broader application
My apologies, as I am new to this, and I am hoping someone can offer some guidance. I have taken the sample code, and been able to to get it to recognise my devices etc. (and I have quite a few!). However, I am trying to incorporate the Meross devices into a broader application, and this is where I have become stuck. What I need to be able to do, is to perform initialisation, then at arbitrary times, check the state of e.g. a power outlet, and then maybe change the state. Maybe this is my lack of familiarity with the asynchronous library, but I cannot appreciate how with the asynchronous loop, I can perform other external tasks, and then arbitrarily check - or change the state of e.g. a power outlet. I even looked at the mqtt approach, and thought that anyone using the library would want to do more than have a "one-shot" program! Any help would be most appreciated.
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.
I have done this, but it is hard to explain.
For relays: https://github.com/theyosh/TerrariumPI/blob/main/hardware/relay/meross_relay.py For sensors: https://github.com/theyosh/TerrariumPI/blob/main/hardware/sensor/meross_sensor.py General cloud connection: https://github.com/theyosh/TerrariumPI/blob/main/terrariumCloud.py
It can be tricky if you app is not async (like mine). So there are some tricks needed to run async code in non async project.
You are free to copy my code if that helps.