moroen / IKEA-Tradfri-plugin

A Python plugin for Domoticz to controll IKEA Gateway
68 stars 23 forks source link

lights unresponsive #124

Closed tomg06 closed 3 years ago

tomg06 commented 3 years ago

hi,

After updating the tradfri GW today (version 1.12.31) I'm not able to control the lights anymore. When trying to select the pycoap i get the following message:

python3 plugin.py api pycoap
usage: plugin.py [-h] [--debug]
                 {list,on,off,level,raw,version,reboot,get,put,post,config}
                 ...
plugin.py: error: argument command: invalid choice: 'api' (choose from 'list', 'on', 'off', 'level', 'raw', 'version', 'reboot', 'get', 'put', 'post', 'config')

In domoticz log i get the following:

2020-11-24 19:00:41.636 Error: (Ikea) 'onHeartbeat' failed 'NameError':'name 'close_connection' is not defined'.
2020-11-24 19:00:41.636 Error: (Ikea) ----> Line 779 in '/home/pi/domoticz/plugins/IKEA-Tradfri/plugin.py', function onHeartbeat
2020-11-24 19:00:41.636 Error: (Ikea) ----> Line 736 in '/home/pi/domoticz/plugins/IKEA-Tradfri/plugin.py', function onHeartbeat
2020-11-24 19:00:51.656 Error: (Ikea) 'onHeartbeat' failed 'NameError':'name 'close_connection' is not defined'.
2020-11-24 19:00:51.656 Error: (Ikea) ----> Line 779 in '/home/pi/domoticz/plugins/IKEA-Tradfri/plugin.py', function onHeartbeat
2020-11-24 19:00:51.656 Error: (Ikea) ----> Line 736 in '/home/pi/domoticz/plugins/IKEA-Tradfri/plugin.py', function onHeartbeat

I'm using a rasp pi, tradfri plugin version 0.10.0.

Hope you are able to help me!

moroen commented 3 years ago

@tomg06,

You probably missing the latest version of some (or all) components. Try:

$ cd plugins/IKEA-Tradfri
$ git pull
$ pip3 install -U py3coap tradfricoap

Then version should show:

$ python3 plugin.py version
IKEA Tradfri Plugin: 0.10.1
Tradfricoap: 0.0.11
Py3coap: 0.9.1

The plugin is a work in progress, and even though I try to avoid breaking changes, some times it's unavoidable. The command for setting the API has changed:

$ python3 plugin.py config api py3coap

in the same vein, the command for configuring (or reconfiguring) the gateway has changed as well:

$ python3 plugin.py config gw IP KEY
tomg06 commented 3 years ago

@moroen

Thanks for responding. I tried updating and found that the versions where already up to date.:

IKEA Tradfri Plugin: 0.10.0
Tradfricoap: 0.0.13
Py3coap: 0.9.1
coapcmd: (/home/pi/domoticz/plugins/IKEA-Tradfri/bin/coapcmd) 0.1.6

I noticed that I am using Tradfricoap 0.0.13 and you stated 0.0.11 but I do not know how to get back to 0.0.11. I tried updating them again and did the configuring command with the correct IP and code to be sure but am again facing the same issue:

2020-11-25 16:48:13.370 Error: (Ikea) Failed to initialize tradfri module.
2020-11-25 16:48:13.370 Error: (Ikea) Unable to find tradfricoap
2020-11-25 16:48:23.391 Error: (Ikea) 'onHeartbeat' failed 'NameError':'name 'close_connection' is not defined'.
2020-11-25 16:48:23.391 Error: (Ikea) ----> Line 779 in '/home/pi/domoticz/plugins/IKEA-Tradfri/plugin.py', function onHeartbeat
2020-11-25 16:48:23.391 Error: (Ikea) ----> Line 736 in '/home/pi/domoticz/plugins/IKEA-Tradfri/plugin.py', function onHeartbeat
2020-11-25 16:48:43.899 Error: (Ikea) 'onHeartbeat' failed 'NameError':'name 'close_connection' is not defined'.
2020-11-25 16:48:43.899 Error: (Ikea) ----> Line 779 in '/home/pi/domoticz/plugins/IKEA-Tradfri/plugin.py', function onHeartbeat
2020-11-25 16:48:43.899 Error: (Ikea) ----> Line 736 in '/home/pi/domoticz/plugins/IKEA-Tradfri/plugin.py', function onHeartbeat

Running python3 plugin.py list shows no problem( xxx replacing names):

Lights:
65537: xxx(State: 0 - Level: 228 - Hex: None)
65541: xxx(State: 1 - Level: 193 - Hex: efd275)
65542: xxx (State: 1 - Level: 177 - Hex: efd275)
65543: xxx (State: 0 - Level: 228 - Hex: None)
65544: xxx (State: 0 - Level: 1 - Hex: None)
65547: xxx (State: 0 - Level: 172 - Hex: None)
65549: xxx (State: 1 - Level: 177 - Hex: None)
65551: xxx (State: 0 - Level: 76 - Hex: None)
65555: xxx bulb 8 (State: 0 - Level: 32 - Hex: None)
65556: xxx (State: 1 - Level: 160 - Hex: None)

Groups:
131073: xxx
131074: xxx
131076: xxx
131078: xxx
131080: xxx
131081: xxx
131082: SuperGroup

Others:
65536: TRADFRI motion sensor (State: None - Level: None - Hex: None)
65545: xxx (State: None - Level: None - Hex: None)
65554: TRADFRI motion sensor 3 (State: None - Level: None - Hex: None)
65557: TRADFRI remote control (State: None - Level: None - Hex: None)

Batteries:
65536: TRADFRI motion sensor - 47
65545: xx - 60
65554: TRADFRI motion sensor 3 - 74
65557: TRADFRI remote control - 47

Is there anything else I could try?

Again thanks for your help!

moroen commented 3 years ago

Sorry, this is the same as #125. As I said there, blame it on bad quality control. Try upgrading to the latest version of the plugin, just released:

IKEA Tradfri Plugin: 0.10.2 Tradfricoap: 0.0.13 Py3coap: 0.9.1

tomg06 commented 3 years ago

Working great again, thanks!

moroen commented 3 years ago

Great!