Closed bullitt186 closed 10 months ago
Hi, is there any perspective if / by when this PR will be integrated?
I don't think it is the right approach to handle the problem, that a user doesn't know the indexes. What about adding a function to scan for powermeters and return a list of the indexes, that can then be used in the configuration object? In your library you could look for the powermeters key in the configuration object at startup and if it is not present issue a scan?
Scanning the available powermeters was one thing I have been pondering in the HA integration. I actually don't want the user to have to fiddle around with the details. That would be the best way, auto-configuration is always preferable.
As we have now merged https://github.com/fsantini/python-e3dc/pull/80, i this PR can be closed from my end.
get_powermeters_data() respective get_powermeter_data() crashes when called with an invalid index of an powermeter. Without in-depth knowledge of the system, it is hard to know which powermeters with which index are installed. there is no other function in the library to retrieve the number of installed powermeters.
As a simple mitigation to crashes, i added "None"-Handling to get_powermeter_data() & get_powermeter_data(), so that it simply returns the powermeter data when data is available and omits the other ones if no data is returned. By that, you can safely call get_powermeters_data() with index 1 ... 4 and see in the results for which ones data is returned.
This function would help greatly, to integrate additional powermeters in this extension https://github.com/torbennehmer/hacs-e3dc by @torbennehmer