lemanjo / pyupway

MIT License
1 stars 3 forks source link

MyUplinkService.isOnline not set #2

Closed lobstaj closed 6 months ago

lobstaj commented 6 months ago

Hi,

I noticed that MyUplinkService.isOnline does not seem to be set ever. (Just by reading the code, I'm currently still on the myUpway side of things. :-) My humble apologies if it is set through some mechanism I haven't noticed.)

If it is missing, I guess inserting something like self.isOnline = response_data['systems'][0]['devices'][0]['connectionState'] == "Connected"

around line 36 of the myuplinkservice.py might do the trick. (Figured this from Swagger https://api.myuplink.com/swagger/index.html , the connectionState field seems to be undocumented though.)

If I create a PR for this, would someone be willing to test? Like mentioned, I'm not yet using myUplink, but would like to get things ready for the switch.

Regards, J

lemanjo commented 6 months ago

Good catch, that was kinda just forgotten from the first implementation of the new myUplink as I spent more time refactoring everything else at that point.

I tested the API and the connectionState field is a string defining the current status: Connected or Disconnected. No documentation though, as you said. I still expect it to be what we think it is, so if you do the PR I can test it out 👍

lobstaj commented 6 months ago

Ok, thank you.

I created a PR now. Let's continue over there if there is something to discuss.