pysonofflan icon indicating copy to clipboard operation
pysonofflan copied to clipboard

Device discovery not working, some commands hang e.g. switch on device

Open beachhouse123 opened this issue 3 years ago • 1 comments

  • pySonoffLAN version: pysonofflanr3 v 1.1.4
  • Python version: 3.9.6
  • Operating System: Mac OSX 10.12.6

Device discovery not working

Trying to confirm device discovery No devices found Also warning message about future implementations reliant upon Zeroconf No DEBUG messages indicating attempts to connect to all addresses on network (compare with pysonofflan)

_pysonofflanr3 discover 2021-07-23 22:31:48,710 - info: Attempting to discover Sonoff LAN Mode devices on the local network, please wait... /usr/local/lib/python3.9/site-packages/zeroconf/services/browser.py:170: FutureWarning: <pysonofflanr3.discover.MyListener object at 0x106f25e50> has no update_service method. Provide one (it can be empty if you don't care about the updates), it'll become mandatory. warnings.warn(

pysonofflanr3 -l DEBUG discover 2021-07-23 22:39:28,690 - info: Attempting to discover Sonoff LAN Mode devices on the local network, please wait... 2021-07-23 22:39:28,691 - debug: Looking for all eWeLink devices on local network. /usr/local/lib/python3.9/site-packages/zeroconf/_services/browser.py:170: FutureWarning: <pysonofflanr3.discover.MyListener object at 0x110f82580> has no update_service method. Provide one (it can be empty if you don't care about the updates), it'll become mandatory. warnings.warn(

pysonofflanr3 --host 192.168.0.10 --api_key "blah blah blah" listen 2021-07-23 22:51:14,898 - info: Initialising SonoffSwitch with host 192.168.0.10 2021-07-23 22:51:16,260 - info: Service type _ewelink._tcp.local. of name eWeLink_1000b88b5e._ewelink._tcp.local. added 2021-07-23 22:51:16,263 - info: None: Connected event, sending 'available' update 2021-07-23 22:51:16,263 - info: unsolicited update received from switch: on 2021-07-23 22:51:16,263 - info: == Device: 1000b88b5e (192.168.0.10) == 2021-07-23 22:51:16,264 - info: State: ON 2021-07-23 22:51:16,264 - info: None: Connected event, waiting for disconnect 2021-07-23 22:52:03,365 - info: None: Connected event, sending 'available' update 2021-07-23 22:52:03,365 - info: unsolicited update received from switch: off 2021-07-23 22:52:03,365 - info: == Device: 1000b88b5e (192.168.0.10) == 2021-07-23 22:52:03,365 - info: State: OFF 2021-07-23 22:52:17,701 - info: None: Connected event, sending 'available' update 2021-07-23 22:52:17,701 - info: unsolicited update received from switch: on 2021-07-23 22:52:17,702 - info: == Device: 1000b88b5e (192.168.0.10) == 2021-07-23 22:52:17,702 - info: State: ON

Some commands hang e.g. switch on/off device

Set state for a given device Works but command hangs from time to time

pysonofflanr3 --host 192.168.0.10 --api_key "blah blah blah" off 2021-07-23 22:56:06,331 - info: Initialising SonoffSwitch with host 192.168.0.10 2021-07-23 22:56:06,678 - info: Service type _ewelink._tcp.local. of name eWeLink_1000b88b5e._ewelink._tcp.local. added 2021-07-23 22:56:06,680 - info: None: Connected event, sending 'available' update 2021-07-23 22:56:06,680 - info: unsolicited update received from switch: on 2021-07-23 22:56:06,680 - info: == Device: 1000b88b5e (192.168.0.10) == 2021-07-23 22:56:06,680 - info: State: ON 2021-07-23 22:56:06,681 - info: None: Connected event, waiting for disconnect 2021-07-23 22:56:08,931 - info: None: Connected event, sending 'available' update 2021-07-23 22:56:08,932 - info: == Device: 1000b88b5e (192.168.0.10) == 2021-07-23 22:56:08,932 - info: State: OFF

beachhouse123 avatar Jul 23 '21 12:07 beachhouse123

After i changed the version of the python package "zeroconf" from the current 0.38.1 to the older version 0.26.0 the "discover" command works for me.

pip install zeroconf==0.26.0

See also the requirements for this repo: grafik

gottlebek avatar Jan 02 '22 16:01 gottlebek