superjunky / Domoticz-Brel-Plugin

A Python plugin for Domoticz to controll Brel Home Hub
MIT License
3 stars 3 forks source link

Failed to initialate Brel module #5

Closed basssment closed 3 years ago

basssment commented 3 years ago

Hi Superjunky,

I installed your plugin and followed the instructions. After i enable the plugin 1 screen appears in my devices, I have 4 installed. but that one does not respond.

After starting the plugin in debug in my logging i see the following: 2021-07-14 11:58:50.369 Status: (Brel) Stop directive received. 2021-07-14 11:58:50.369 Status: (Brel) Exiting work loop. 2021-07-14 11:58:50.569 Status: (Brel) Stopping threads. 2021-07-14 11:58:50.569 Status: (Brel) Stopped. 2021-07-14 11:58:50.570 Status: (Brel) Started. 2021-07-14 11:58:50.615 Status: (Brel) Initialized version 1.0.0, author 'Superjunky' 2021-07-14 11:58:50.616 Status: (Brel) Entering work loop. 2021-07-14 11:58:50.630 Status: (Brel) AccessToken ########blurred########## generated. 2021-07-14 11:58:50.698 Error: (Brel) Failed to initialize Brel module.

What could be wrong? i'm running om linux Debian 4.19.171-2

superjunky commented 3 years ago

If you turn on debugging it wil give more info.

superjunky commented 3 years ago

Currently only 1 brel-device-type is added to the plugin. In the docs, file WLAN Integration Guide, page 9, you’ll find an overview of the different types. You can create a PR if you wish ;)

basssment commented 3 years ago

Thank you for the quick reply. I'm not shure if i understand... There is only one device type supported in the plugin? (if so wich one, cant find that) So possibly my device mr45-20 (screens outside) is not supported so i can do a request?

superjunky commented 3 years ago

Only device-type 14 is supported. If you want to support more, you wil have to add them to the code of this plugin.

I am not updating this plugin, but everyone is welcome to expand it :)

basssment commented 3 years ago

Ok thanx, not much of a scripter here :S looked ad plugin.py an found the following on rule 160:

        elif Devices[Unit].SwitchType == 13 or Devices[Unit].SwitchType == 7:
            # Blinds 0=Open 1=Dicht 2=%
            if Devices[Unit].DeviceID[-2:] == ':P':
                position = brel_device['data']['currentPosition']
                if Devices[Unit].sValue != str(position):

                    if int(position) < 1:
                        nValue = 0
                    elif int(position) > 99:
                        nValue = 1
                    else:
                        nValue = 2

                    Devices[Unit].Update(
                        nValue=nValue,
                        sValue=str(position),
                        SignalLevel=RSSItoLevel(brel_device['data']['RSSI'])
                    )
                    deviceUpdated = True

If I edit the 13 (you said 14 but think this is the right rule) to 1 (roller blinds, verduidterende screens in dutch) the devices should be seen found? or am I seeing to easy...

superjunky commented 3 years ago

Experiment as you wish, it's the best and most fun way to learn new skills ;) Those Types you mention, are Domoticz switch types (not Brel), so it will not work.

I did a quick review on the code; It will only work for brel-devices where data for "currentAngle" is present. Yours only have "currentPosition" set. The whole code needs to be reworked/reviewed for that. I'm sorry I can't be of any further assistance to you. Perhaps someone comes by in the future who is in the mood to extend the plugin.

Cheers!

basssment commented 3 years ago

Ok thank you for the quick answers, i'm going for a search if someone can figure this out with me. If so, wil share here for others :)