cjkrolak / ThermostatSupervisor

supervisor to detect and correct thermostat deviations
MIT License
0 stars 0 forks source link

blink: ValueError when checking current blink package version #695

Closed cjkrolak closed 11 months ago

cjkrolak commented 11 months ago
WARNING: attempting local import of blinkpy.auth from working directory C:\github\ThermostatSupervisor...
Traceback (most recent call last):
  File "<frozen runpy>", line 198, in _run_module_as_main
  File "<frozen runpy>", line 88, in _run_code
  File "C:\github\ThermostatSupervisor\thermostatsupervisor\blink.py", line 459, in <module>
    tc.thermostat_basic_checkout(
  File "C:\github\ThermostatSupervisor\thermostatsupervisor\thermostat_common.py", line 1132, in thermostat_basic_checkout
    Thermostat, Zone = create_thermostat_instance(thermostat_type, zone,
                       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\github\ThermostatSupervisor\thermostatsupervisor\thermostat_common.py", line 1095, in create_thermostat_instance
    Thermostat = ThermostatClass(zone, verbose=verbose)
                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\github\ThermostatSupervisor\thermostatsupervisor\blink.py", line 65, in __init__
    if env.get_package_version(blinkpy) >= (0, 22, 0):
       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\github\ThermostatSupervisor\thermostatsupervisor\environment.py", line 266, in get_package_version
    ver_tuple = tuple(map(int, module.__version__.split(".")))
                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
ValueError: invalid literal for int() with base 10: 'dev0'
cjkrolak commented 11 months ago

module version has a suffix causing the problem, e.g. "0.22.0.dev0". Fix is to strip everything after the last tuple.