999LV / BatteryLevel

Domoticz python plugin to display/log battery level of zwave devices
MIT License
9 stars 5 forks source link

Error in latest domoticz versions #12

Closed dobber81 closed 4 years ago

dobber81 commented 4 years ago

2020-03-23 21:50:32.162 Error: (Battery) Domoticz version check returned an error: invalid literal for int() with base 10: '1 (build 11835)'. Plugin is therefore disabled

Seems like plugin checks domoticz version and gets a new invalid response.

wim2020 commented 4 years ago

I am not a a skilled programmer but I tried a quick fix and it worked for me.

     # check if version of domoticz supports the API call introduced in version 4.11253
    try:
        version = int(Parameters["DomoticzVersion"].split('.')[1])
        if version < 11253 and version != 1:
dobber81 commented 4 years ago

Did not get it working your way. However, I wrote some new code that seems to be working both with old and new layout. Another exception would be nice. But my coding is limited :)

    # check if version of domoticz supports the API call introduced in version 4.11253
    try:
        version = str(Parameters["DomoticzVersion"].split('.')[1])
        try:
            version = str(version.split('(build ')[1].split(')')[0])
        except:
            print(version)

        if int(version) < 11253:
999LV commented 4 years ago

Thanks for reporting. Indeed I just found out a new version numbering convention has been implemented in Domoticz (see https://www.domoticz.com/wiki/Domoticz_versions_-_Commits).

I updated the plugin accordingly with version 0.6.1