Yes that’s correct. For clarity, this component doesn’t need eWeLink app or ITead cloud to be available for HA to switch the device. And that is irrespective of if the device is in ‘standard’ eWeLink mode or in DIY mode (supported on more recent devices).
Tried S20 and confirmed working.
Used wget post to connect the unit to my SSID and able to delete the unit from EweLink after that.
This way I can run both this component and the component from PeterBuga ( to use multichannel devices) without duplicates.
Looking forward to support for multichannel devices and devices with temperature sensor. (Dual R2 and TH16)
I’d expect that the TH16 would work as a switch already. Since I don’t have one, if you could verify that, but also send the relevant part of a debug log which shows the unencrypted message, I suspect I can add the temperature as a property fairly simply. If you are game, would you mind raising an issue on GitHub for the feature request and post the log?
The TH16 is on 2.6 firmware, so there is no LAN mode except when you use the procedures described in Beveradb’s component. And in this case the component from PeterBuga can be used instead. We will have to wait for a firmware update. I will give you a notice when/if it arrives.
Or perhaps try to integrate yours an Beveradb’s components
Thanks for the info, that certainly provides a good reason to support firmware earlier than 3.x.
However the effort to integrate the 2.x and 3.x into a single component, I don’t think is worth it. I’m minded to wait for 3.x to be supported on every device based on the limited feedback we’ve had on this forum to say it needs to be a single component.
As mentioned, you can run both the 2.x and 3.x components in parallel and there is not much additional effort.
I finally received a Sonoff Basic R3 and succeeded in getting it into DIY mode and establish a connection to the DIY demo app. A bit complicated.
Tried to put it into Home Assistant using your component. The switch was created but I cannot activate on or off. But when I turn the Sonoff Basic R3 on in the demo program or manually by pressing the switch, the status of the switch in HA changes status. But in HA the switch doesn’t work.
I didn’t use an Apikey as explained in your documentation. That is perhaps the explanation.
All this just for your information.
Perhaps I should try to get an Apikey as I did with all the other switches (that work)
Sounds like you are doing it all correctly, especially since it is updating in HA. You don’t need API key for DIY mode.
Can you post an issue in GitHub with all the relevant info. Config file extract, firmware version and debug log?
I will shortly
Bingo. It works with the new update, Now the Sonoff Basic R3 in DIY mode makes sense. And you don’t need to fumble around with the strange procedures described by Itead as shown by Dr. Zzs (among others). And using DIY mode you don’t have to use the api key which is also rather complicated to get. So I see a great future for this component as there will be more and more Sonoffs with DIY mode around in the future (including the new mini). So a big thank you to mattsaxon
Hi @mattsaxon
I installed your addon and configured 2 switches. one 3 gang sonoff T1 and one Sonoff basic. Both devices are showing offline.
Ewelink version : 3.3.0
Hassio version : 0.97.2
Device : Raspberry pi 4
Debug logs are as follows:-
2019-08-25 17:43:43 DEBUG (MainThread) [homeassistant.components.switch.sonoff_lan_mode_r3] Initializing SonoffLANModeClient class in SonoffDevice
2019-08-25 17:43:43 DEBUG (MainThread) [homeassistant.components.switch.sonoff_lan_mode_r3] HassSonoffSwitch __init__ finished creating SonoffSwitch
2019-08-25 17:43:43 DEBUG (MainThread) [homeassistant.components.switch.sonoff_lan_mode_r3] Initializing SonoffLANModeClient class in SonoffDevice
2019-08-25 17:43:43 DEBUG (MainThread) [homeassistant.components.switch.sonoff_lan_mode_r3] HassSonoffSwitch __init__ finished creating SonoffSwitch
2019-08-25 17:43:43 DEBUG (MainThread) [homeassistant.components.switch.sonoff_lan_mode_r3] enter send_availability_loop()
2019-08-25 17:43:43 DEBUG (MainThread) [homeassistant.components.switch.sonoff_lan_mode_r3] waiting for connection
2019-08-25 17:43:43 DEBUG (MainThread) [homeassistant.components.switch.sonoff_lan_mode_r3] send_updated_params_loop is active on the event loop
2019-08-25 17:43:43 DEBUG (MainThread) [homeassistant.components.switch.sonoff_lan_mode_r3] Starting loop waiting for device params to change
2019-08-25 17:43:43 DEBUG (MainThread) [homeassistant.components.switch.sonoff_lan_mode_r3] send_updated_params_loop now awaiting event
2019-08-25 17:43:43 DEBUG (MainThread) [homeassistant.components.switch.sonoff_lan_mode_r3] enter send_availability_loop()
2019-08-25 17:43:43 DEBUG (MainThread) [homeassistant.components.switch.sonoff_lan_mode_r3] waiting for connection
2019-08-25 17:43:43 DEBUG (MainThread) [homeassistant.components.switch.sonoff_lan_mode_r3] send_updated_params_loop is active on the event loop
2019-08-25 17:43:43 DEBUG (MainThread) [homeassistant.components.switch.sonoff_lan_mode_r3] Starting loop waiting for device params to change
2019-08-25 17:43:43 DEBUG (MainThread) [homeassistant.components.switch.sonoff_lan_mode_r3] send_updated_params_loop now awaiting event
2019-08-25 17:43:43 INFO (MainThread) [homeassistant.components.notify] Setting up notify.mobile_app
2019-08-25 17:43:43 INFO (MainThread) [homeassistant.setup] Setup of domain person took 3.4 seconds.
2019-08-25 17:43:43 DEBUG (MainThread) [homeassistant.components.switch.sonoff_lan_mode_r3] HassSonoffSwitch async_update called
2019-08-25 17:43:43 DEBUG (MainThread) [homeassistant.components.switch.sonoff_lan_mode_r3] Sonoff device basic info still none, waiting for init message
2019-08-25 17:43:43 DEBUG (MainThread) [homeassistant.components.switch.sonoff_lan_mode_r3] HassSonoffSwitch returning _name: Outside light
2019-08-25 17:43:43 DEBUG (MainThread) [homeassistant.components.switch.sonoff_lan_mode_r3] HassSonoffSwitch returning _available: False
2019-08-25 17:43:43 DEBUG (MainThread) [homeassistant.components.switch.sonoff_lan_mode_r3] HassSonoffSwitch returning _name: Outside light
2019-08-25 17:43:43 DEBUG (MainThread) [homeassistant.components.switch.sonoff_lan_mode_r3] HassSonoffSwitch async_update called
2019-08-25 17:43:44 DEBUG (MainThread) [homeassistant.components.switch.sonoff_lan_mode_r3] Sonoff device basic info still none, waiting for init message
2019-08-25 17:43:44 DEBUG (MainThread) [homeassistant.components.switch.sonoff_lan_mode_r3] HassSonoffSwitch returning _name: Master Bedroom Switches
2019-08-25 17:43:44 DEBUG (MainThread) [homeassistant.components.switch.sonoff_lan_mode_r3] HassSonoffSwitch returning _available: False
2019-08-25 17:43:44 DEBUG (MainThread) [homeassistant.components.switch.sonoff_lan_mode_r3] HassSonoffSwitch returning _name: Master Bedroom Switches
2019-08-25 17:43:44 DEBUG (MainThread) [homeassistant.components.switch.sonoff_lan_mode_r3] HassSonoffSwitch returning _name: Outside light
2019-08-25 17:43:44 DEBUG (MainThread) [homeassistant.components.switch.sonoff_lan_mode_r3] HassSonoffSwitch returning _name: Master Bedroom Switches
2019-08-25 17:43:44 DEBUG (MainThread) [homeassistant.components.switch.sonoff_lan_mode_r3] HassSonoffSwitch returning _name: Outside light
2019-08-25 17:43:44 DEBUG (MainThread) [homeassistant.components.switch.sonoff_lan_mode_r3] HassSonoffSwitch returning _name: Master Bedroom Switches
2019-08-25 17:43:44 INFO (zeroconf-ServiceBrowser__ewelink._tcp.local.) [homeassistant.components.switch.sonoff_lan_mode_r3] Service type _ewelink._tcp.local. of name eWeLink_10004ea43b._ewelink._tcp.local. added
2019-08-25 17:43:44 INFO (zeroconf-ServiceBrowser__ewelink._tcp.local.) [homeassistant.components.switch.sonoff_lan_mode_r3] Service type _ewelink._tcp.local. of name eWeLink_10004ea43b._ewelink._tcp.local. added
2019-08-25 17:43:44 DEBUG (zeroconf-ServiceBrowser__ewelink._tcp.local.) [homeassistant.components.switch.sonoff_lan_mode_r3] service is at 192.168.1.64:8081
2019-08-25 17:43:44 DEBUG (zeroconf-ServiceBrowser__ewelink._tcp.local.) [homeassistant.components.switch.sonoff_lan_mode_r3] properties: {b'txtvers': b'1', b'id': b'10004ea43b', b'type': b'strip', b'apivers': b'1', b'seq': b'54', b'encrypt': True, b'iv': b'MDMwNjcxNDk2Mzg2NDc5Mg==', b'data1': b'4ip3MH/ILEsksDPdJ70mgcD8ULUk3+fTzDUbcbsSP6EtU8BHztAR2fLLjqJy8mki38zkLhnxVYibLWye/tHR9pyXl78nvVVhLjCWCopnJZWivjxj/JwNg8rEMf1qq3/RJDf+v5Uw2z9iEJ/TRXSu/Xj9udj6v+BIYYIDJW4v6Kw6iIEHaubLLVPicFUygfTmkP7UAc83ULr9sUMwBZ54LFrdFKNWgI17opGKFaejRzdms06rlkAs9GDH/', b'data2': b'uiU6PJrTVLFlo4E5VVFhdQ3jvVfUdjBIuyB3df68ZnlbpZQArURwjA9frjsuNPfoxKOjcDWw5kLookuGFku9OkkWWe274VMLQ58TYedYWXmoQUQK1q4oBS+gN0BcgOQSnJwE9Lzj3h1ay/UytJFXtcCEu/NiD4SFW5AeyvB1X0yQohr+DwfuDFNuKJNISO738O2tMq7SaAeRZPWvM3fxo4+XwNqeWoJ+pADSkqeD+BWxj0SQBrsnKZIB5', b'data3': b'IFtOtxDmbI7QejSp1ix36YwTBA3NOENDYhozGweTz6Hbd9yKK0e5iLlKFFwMr/XPe03ZsqQ3B4BT1KyZrIWZR7H6MDf5HuAB+fzQ=='}
2019-08-25 17:43:44 DEBUG (zeroconf-ServiceBrowser__ewelink._tcp.local.) [homeassistant.components.switch.sonoff_lan_mode_r3] service is at 192.168.1.64:8081
2019-08-25 17:43:44 DEBUG (zeroconf-ServiceBrowser__ewelink._tcp.local.) [homeassistant.components.switch.sonoff_lan_mode_r3] properties: {b'txtvers': b'1', b'id': b'10004ea43b', b'type': b'strip', b'apivers': b'1', b'seq': b'54', b'encrypt': True, b'iv': b'MDMwNjcxNDk2Mzg2NDc5Mg==', b'data1': b'4ip3MH/ILEsksDPdJ70mgcD8ULUk3+fTzDUbcbsSP6EtU8BHztAR2fLLjqJy8mki38zkLhnxVYibLWye/tHR9pyXl78nvVVhLjCWCopnJZWivjxj/JwNg8rEMf1qq3/RJDf+v5Uw2z9iEJ/TRXSu/Xj9udj6v+BIYYIDJW4v6Kw6iIEHaubLLVPicFUygfTmkP7UAc83ULr9sUMwBZ54LFrdFKNWgI17opGKFaejRzdms06rlkAs9GDH/', b'data2': b'uiU6PJrTVLFlo4E5VVFhdQ3jvVfUdjBIuyB3df68ZnlbpZQArURwjA9frjsuNPfoxKOjcDWw5kLookuGFku9OkkWWe274VMLQ58TYedYWXmoQUQK1q4oBS+gN0BcgOQSnJwE9Lzj3h1ay/UytJFXtcCEu/NiD4SFW5AeyvB1X0yQohr+DwfuDFNuKJNISO738O2tMq7SaAeRZPWvM3fxo4+XwNqeWoJ+pADSkqeD+BWxj0SQBrsnKZIB5', b'data3': b'IFtOtxDmbI7QejSp1ix36YwTBA3NOENDYhozGweTz6Hbd9yKK0e5iLlKFFwMr/XPe03ZsqQ3B4BT1KyZrIWZR7H6MDf5HuAB+fzQ=='}
2019-08-25 17:43:44 DEBUG (zeroconf-ServiceBrowser__ewelink._tcp.local.) [homeassistant.components.switch.sonoff_lan_mode_r3] decrypted data: b'{"sledOnline":"on","configure":[{"startup":"off","outlet":0},{"startup":"off","outlet":1},{"startup":"off","outlet":2},{"startup":"off","outlet":3}],"pulses":[{"pulse":"off","width":1000,"outlet":0},{"pulse":"off","width":1000,"outlet":1},{"pulse":"off","width":1000,"outlet":2},{"pulse":"off","width":1000,"outlet":3}],"switches":[{"switch":"off","outlet":0},{"switch":"off","outlet":1},{"switch":"off","outlet":2},{"switch":"off","outlet":3}]}'
2019-08-25 17:43:44 DEBUG (zeroconf-ServiceBrowser__ewelink._tcp.local.) [homeassistant.components.switch.sonoff_lan_mode_r3] decrypted data: b"\x81\xbe1\x1db\x14\xbd\xd6\xd4\x1b\xef;\x85\xa8\x82t\xaa\x87\xa5\xb3\xe83BJ\xae\xeeV\xdb\xdc\x7f0\x89Y\xc2\xd1\x97\xb1\xa1\xbe..\xd0g\x8a\x0b\x19A%\x82.\x16\rC\xeaX\xc2\xe3\x06\t\x82_.t\xe2\xd0\x9a\xb3-\x83\xcf\xdcC\xcf\xb6OmR\x8a\xe9\r\x8a\x8f\xe4\xbd\xd70fJ\x14\xc0\xe0d\x03\x89r\xbd\x8c\x1b\xc9\xee\x14H\\\xee5\xb2T0\xc7z\x1d\x88\xc5~\xda\xa5\xf7\xe6\xa0\x9d`\x96o\xaa\x0eu\xb0'Y\xadi\xed\x1bhC\xdd\x84`\x88\xac\x9dBE\x9b;^\xa0\x89\xa0\xe1u\xeb\x9b\xd6\xe9\xab\xca\xbe4\n\x186N\x139\xe6\xb7\xc3N\xd9\xa4a\xebQ?&\x93\xf2\x9cWP\x96P:\x9d%H$'F\x98\xf4{\x942p\xc1\xe6\x08\x12\x9c\xe7;m\xe9!Dh\x81Y-\x81g\xdbw\xe7uVR\xbe\x9b\x19\x1b\x89\xd6\xbd\xb8\xd8\x08\xf2\xba\x17\xa8\x1f\x8fR$T_\x1eY\xb2\x8dX\xc9\xf4M\xcd\xee#\xd6\xa7fGD%bP#\xfe\xd1\x8e\x0e\x1a\\\xfb|[\xe3\x8b\x1e\xb5[\xdc\x11\x96\x95g\xb0\xcb\xc9\xf9\xd8/9\xad\x14\x9e\xaa\xb2\xb7e\xebG%\xf2\xdd4\x06V\xcd>\xf8\xac\xb3\xbf0\xcc|pK:h\xd2k\xb2ik]\xe0T\x1e:\xb9\x11\x8b\x98\xeeyP\xb8\x1f\xa8\xdf\xe4\xad\xb7r)c\xb6|;\xfa\xab\x1f\x16\xf6\xf0\xea\t\xb2H2\x95\xfe\xba\xf8\xf9\xd6R/\xceQ\x7f\xbaIyN,*\x95\xb8\xb0E\x1c9l\x82\xa5\x9e\xfd\xd3Bn\x038\xeb(\x11V\x1b\x97\x95*\xbf\xde\xa7\xd3\xf4\xd4\xfd\xe6u\xd0\xcf_e\xf5\x18h\xb5#\xca2\x97>F\xac\xe5\x08\xc6\xc1\xc0n\xc9Z\xe0\xd2\xe6\n\x06\xfc\xd7\xa7\xe6\xa7#\x94\xbf\x93\xb7\xd4\xed\x06\xa7\x12"
2019-08-25 17:43:44 INFO (MainThread) [homeassistant.setup] Setting up default_config
2019-08-25 17:43:44 INFO (SyncWorker_5) [homeassistant.loader] Loaded stream from homeassistant.components.stream
2019-08-25 17:43:44 DEBUG (MainThread) [homeassistant.components.switch.sonoff_lan_mode_r3] enter handle_mesage()
2019-08-25 17:43:44 ERROR (MainThread) [homeassistant.components.switch.sonoff_lan_mode_r3] Unknown message received from device:
2019-08-25 17:43:44 DEBUG (MainThread) [homeassistant.components.switch.sonoff_lan_mode_r3] enter handle_mesage()
The 3 gang T1 is not supported with my component at the moment, but your debug information will allow me to fix that in due course, so appreciated.
Not sure about the basic, this should work fine, can you confirm the firmware version of that device please?
I can’t see it’s information in the debug log, can you provide the relevant extract of your configuration.yaml file as that might provide some insight.
Please can we continue this thread in my GitHub repository, so can you raise a specific issue on this please so we don’t pollute this thread with detailed resolution information?
Hi. I got the basic to work. I had the wrong device ID. There were also some issues installing the add-on. But managed to do it when I turned of Https. May be an home assistant issue rather than your plugin.
I have raised an issue on your GitHub repo re the T1 3 gang switch. Do let me know if you need anything else. Great work there.
My T4EU1C switch is going unavailable in home assistant. Seems to stay available as long as it is in use. Just tried blocking internet access. Will report back if it helps. I notice there is an issue on GitHub about switches going unavailable. This could be the same issue.
EDIT: I can confirm that not allowing the switch to contact the internet appears to have solved this problem so far. It’s a shame that the WiFi light is always flashing like this.
Hi all,
Small contribution from Spain. To capture the Api Key, you can simply put the sonoff on pairing mode, connect your tablet or mobile (in my case an Ipad) to the wifi created by the sonoff (pwd:12345678) and launch from the navigator (in my case safari) “http://10.10.7.1/device”. The sonoff will inmediately return the device ID and the Api Key.
Started to notice that since I blocked the internet on my routers fitewall, the switch loses WiFi every few minutes (is it rebooting/watchdog). This also makes it go unavailable. Might flash this soon. Anyone else having this issue? Turned internet back on for now and it seems to be staying connected to WiFi for longer but expect it to go unavailable again.
Given up with this now, with internet blocked SONOFF keeps disconnecting from WiFi every minute or so. With internet open it stays connected to WiFi but keeps going out of Lan mode and showing unavailable.
T4EU1C now has remains of a bit of solder on R10 and Tasmota 6.7.1 installed. My touch panel is working with no modifications.
I don’t get the API key from the V3 firmware. There is no hotspot where I could connect to.
Any help?
I’ve recently become frustrated with my Sonoff S31s and the extensive delays in updates for power usage (my poor washing machine automations!), so went ahead with the custom_component as described above.
Not sure what I’m doing wrong – I’ve restricted outbound internet to make sure they stay in LAN mode, and have double-checked the IDs vs the API keys. I can see in the debug log all kinds of entries w/ the data I’m after but I don’t see any devices in Home Assistant…
EDIT
OK I lied - I can now see them in HomeAssistant (and there was much rejoicing?)
But they are coming back as unavailable – I’m guessing the message structure doesn’t match what the component is expecting?
2019-12-07 17:02:54 DEBUG (zeroconf-ServiceBrowser_eWeLink_1000384980._ewelink._tcp.local.) [homeassistant.components.switch.sonoff_lan_mode_r3] properties: {b'txtvers': b'1', b'id': b'1000384980', b'type': b'enhanced_plug', b'apivers': b'1', b'seq': b'76', b'encrypt': True, b'iv': b'MjY5NTgzOTY3OTk1MjIxNg==', b'data1': b'PC0ZqdwYHreHvN6XgWbqpffQBQOdalxy3WZedFSa+0+1YCyijOXg2FG4FS+xsOC6odz07YiM4FB/3cfQbxk28eRoH2BRAaVz7Y+9Jn/HwIPzEb6e6lI8IyGdAfcRSKQdUzAqBWwKX279azy9lZTh6zsyHg6g4gT1+CK9lid8FD/yKUr8xUUl+5j59uP2XP/YNlKeHW9mnu6pcM7YpM8uFM5JsrC67f9buauFLp4dsnQ2d3Dsa+yddbpjJ', b'data2': b'U6GrMKS'}
2019-12-07 17:02:54 DEBUG (zeroconf-ServiceBrowser_eWeLink_1000384980._ewelink._tcp.local.) [homeassistant.components.switch.sonoff_lan_mode_r3] type: b'enhanced_plug'
2019-12-07 17:02:54 DEBUG (zeroconf-ServiceBrowser_eWeLink_1000384980._ewelink._tcp.local.) [homeassistant.components.switch.sonoff_lan_mode_r3] decrypted data: b'{"alarmVValue":[-1,-1],"alarmCValue":[-1,-1],"alarmPValue":[-1,-1],"switch":"off","startup":"stay","pulse":"off","pulseWidth":500,"sledOnline":"on","power":0,"voltage":118.72,"current":0}'
2019-12-07 17:02:54 DEBUG (MainThread) [homeassistant.components.switch.sonoff_lan_mode_r3] enter handle_mesage()
2019-12-07 17:02:54 ERROR (MainThread) [homeassistant.components.switch.sonoff_lan_mode_r3] Unknown message received from device:
You didn’t mention what kind of device you were using – on the S31, I had to put it in pairing mode and THEN hold the pairing button for an additional 10s or so to get it to go into a mode that let me do the wifi pairing method (i.e. joining the ad-hoc wifi network w/ the complicated Spaceballs-esque password of ‘12345678’).
How to configure temperature sensors (Sonoff TH16) and use sonoff_lan_mode_r3?
It’s possible?