dm82m / hass-Deltasol-KM2

Custom component for retrieving sensor information from Resol KM1/KM2, DL2/DL3, VBus/LAN, VBus/USB
MIT License
25 stars 6 forks source link

automatically determine if endpoint is KM2 or DLX #9

Closed dm82m closed 2 years ago

dm82m commented 2 years ago

@chiefdeputy can you have a look if that works out in your case. any feedback highly appreciated!

dm82m commented 2 years ago

@chiefdeputy I released it as pre-release beta, you can also enable beta in HACS and use 0.1.2b to test it out in your instance

dm82m commented 2 years ago

@chiefdeputy can you test it again with the explicit catch of JSONDecodeError, I updated 0.1.2b so you can just reload it

dm82m commented 2 years ago

@chiefdeputy is it working?

chiefdeputy commented 2 years ago

@chiefdeputy is it working?

Not as it is right now. Either use ValueError, or upgrade request package and use requests.exceptions.JSONDecodeError or back to the general exception.

ostat commented 2 years ago

I am yet to give this a try on our DL3, however what about keeping mode and having "auto[default], km2, dlx". I would prob rather set it than have it try km2 to get an error each time.

Just a thought, If the km2 credentials are wrong or it's down it will attempt the dlx and not log a useful message.

Perhaps we could have detect method that works out what system we should use? For the dlx a call to http/s://{host}/dlx/ should succeed without credentials if its connectable. Its not an api/rest request as HTML is returned.

ostat commented 2 years ago

Submitted an enhanced auto detect #12