python-e3dc icon indicating copy to clipboard operation
python-e3dc copied to clipboard

bugs in get_idle_periods, with suggested fixes

Open kapet opened this issue 4 months ago • 0 comments

Sorry for not sending a PR, not working on a computer set up for git etc.

  1. _e3dc.py line 462: if idlePeriodsRaw[0] != RscpTag.EMS_GET_IDLE_PERIODS: Looks like the first value in idlePeriodsRaw can be a string, not just the enum. This breaks the code even when the device replies correctly. This works and should catch all variations: if getRscpTag(idlePeriodsRaw[0]) != RscpTag.EMS_GET_IDLE_PERIODS:

  2. _e3dc.py lines 466-467: "idleCharge": [] * 7, "idleDischarge": [] * 7, This can not work, []*7 is still just []. You need something in there to create a list of that size, e.g.: [None] * 7 Without this the assignments on lines 489/491 always throw exceptions.

Thanks!

kapet avatar Oct 05 '24 13:10 kapet