Closed pkwagner closed 4 years ago
Solved the issue by myself. The process starves if the device detection duration exceeds the update interval, which is the case when running the tool for the first time (downloading channel lists takes up to several minutes). Therefore fixing it shouldn't be that hard.
I'm currently preparing a MR addressing the bug (and a few other) so that I can close this issue.
Cool, thanks! There are most likely bugs and other shortcomings that I'd like to fix, but haven't gotten around to or had the knowledge to do myself so far. I also want to add some level testing in the future. I have other open topics/questions like
In my current setup I restart the docker container each night as a quick fix, because it would otherwise fail to resume it's work the next morning. This bug is most likely related to the way I deal with offline devices as well.
Thanks for sharing! From what I've seen, the whole YASDI library is a big mess - lots of dated documentation and unpredictable behaviour.
I'm still not sure if it's easier for me to fix issues here or to start over with a completely new project - not because your implementation was bad, but I found it very hard to get into such a undocumented library like YASDI without writing code myself. Either way, I'll let you know!
Right, but wouldn't that project again depend on YASDI? I don't know any other option besides replacing the inverters with ones that have more modern interfaces :D Have you seen these YASDI docs? YASDI API-Documentation (german) YASDI Documentation (english) I am wondering if I it would have been any better if I used the synchronous YASDI API instead of the asynchronous one. Other projects out there using the YASDI sdk use the synchronous API.
Sorry for the late answer! The linked documentation is definitely newer than what I've found on the official SMA page.
Nevertheless I used the last few days to implement an own solution called yasdi2mqtt[1]. The container now runs for 3 days including devices going online/offline without crashing or any other problems, so I think the main work is done now.
Regarding your device removal problem I found out, that at least for the serial driver YASDI_EVENT_DEVICE_REMOVED
[2] only fires after invoking RemoveDevice(...)
manually. Therefore you have to detect device disconnections by your own, the best solution I've found is to remove a device whenever value fetch returns a YE_TIMEOUT
[3].
[1] https://github.com/pkwagner/yasdi2mqtt [2] https://github.com/pkwagner/yasdi2mqtt/blob/master/src/yasdi_handler.c#L278 [3] https://github.com/pkwagner/yasdi2mqtt/blob/master/src/yasdi_handler.c#L205
I'm currently trying to set up this project using Docker on a Raspberry Pi. Unfortunately, after finishing the device discovery nothing happens. For me this seems like a missed callback, but I didn't deep-dive into the yasdi library yet.
Is this a known bug and if, is there any workaround?
yasdishell
works properly inside the container and lists all devices, channels and values correctly.