Sonoff /eWeLink component for original firmware

Hi all,

I have the same problem as Svauz. I have had sonoff working in an earlier version of HASS.
I somehow cannot get it working anymore.

I will test as much as possible… Thanks all!

Please, log files are text, don’t post them as pictures.

ok, sorry. here is rthe text log of the file “_init_cpython-36.pyc” :

3

J]çe„@sÙddlZddlZddlZddlZddlZddlZddlZddlaZaddlZddl Z ddl
Z
ddlZddlZddl
mZddl
m
Z
ddlmZddlmZddlmZddalmZddlmZdd lmZmeZemZmZmZmZm Z m!Z!m"Z"d
Z#dZ$dZ%d
Z&dZ’ddgZ(ddl)Z)eje+ÉZ,ej-e’ej-ej.eeÉej/ej.eeÉej/ej0eÉej/ej1e#ddçej/ej1eeeddçdçej2ej1e$ddçej3ej1e&ddçej4ej1e%ddçej4iej5dçiej5dçZ6ddÑZ7GdedÑdÉZ8GddÑde
j9e)j:ÉZ;Gdd Ñd eÉZ<dS)!ÈN)⁄ timedelta)⁄datetime)⁄Entity)⁄async_track_time_interval)⁄run_coroutine_threadsafe)⁄ discovery)⁄config_validation) ⁄EVENT_HOMEASSISTANT_STOP⁄CONF_SCAN_INTERVAL⁄
CONF_EMAIL⁄
CONF_PASSWORD⁄
CONF_USERNAME⁄HTTP_MOVED_PERMANENTLY⁄HTTP_BAD_REQUEST⁄HTTP_UNAUTHORIZED⁄HTTP_NOT_FOUNDZ
api_regionZgrace_period⁄debugZ
entity_prefix⁄sonoff⁄uuidzwebsocket-client==0.54.0⁄eu)⁄adefaultÈ)⁄asecondsiXTF)⁄extracaÉsŒtjdÉtà|Éàjt<àjtjÉr4tddç}n:|jatiÉjatÉtddçkrd|jatiÉjatÉ}n
tddç}àjtj Ér xdD]}t
jà|ti|ÉqÇWàjj
daàjtjÉáfdd Ñ}tà||Éd
S)z#Setup the eWelink/Sonoff component.zCreate the main objectÈ
)rÈ<⁄switch⁄sensorZsonoff_statecstàjtjÉàjÉdS)N)r⁄data⁄DOMAIN⁄async_update⁄loop)Z
event_time)⁄hass©˙,/config/custom_components/sonoff/init.py⁄update_devicesIsz#async_setup..update_devicesT)rr)⁄a_LOGGERr⁄Sonoffrr⁄get_debug_stater⁄getr

get_wshostra⁄
load_platform⁄bus⁄async_listen⁄state_listenerr)r"⁄config⁄
SCAN_INTERVAL⁄ componentr%r#)r"r$⁄async_setup0s


r2c@s¬eZdZddÑZddÑZddÑZdadÑZd d
ÑZaddÑZd
dÑZ ddÑZ
ddÑZddÑZd0ddÑZ
ddÑZd1dedÑZddÑZdd ÑZd!d"ÑZd#d$ÑZd%d&ÑZd’d(ÑZd)d
ÑZd2d,d-ÑZd.d/ÑZdS)3r’cCs||_|jtiÉjtdÉ|_|jtiÉjtdÉ||jtiÉjtadÉ||jtiÉjt dÉ|
|jtiÉjtdÉ|
t
|jtiÉjtdÉdç|_|jtiÉjtdÉ|_g|_|jr∆|jr∆|jjÉ|_d|_t
|jtiÉjtdÉdç|_g|_d|_d|_d|_|jdddaç|jÉdS)N⁄)rFrz{}T)⁄new)e⁄_hassr)rrZ_emailr
⁄ _usernamer⁄ _password⁄CONF_API_REGION⁄_api_region⁄CONF_ENTITY_PREFIX⁄_entity_prefixr⁄CONF_GRACE_PERIOD⁄
_grace_period⁄
CONF_DEBUG⁄
_sonoff_debug⁄_sonoff_debug_log⁄strip⁄_skipped_login⁄_devices⁄_user_apikey⁄_ws⁄a_wshost⁄write_debug⁄do_login)⁄selfr"r/r#r#r$⁄__init__Qs&zSonoff.__init__cCs|jS)N)r?)rIr#r#r$r(nszSonoff.get_debug_statecCs|jS)N)r;)rIr#r#r$⁄get_entity_prefixqszSonoff.get_entity_prefixcCsddl}d|_|jdttjÉÉdjddÑtdÉDÉÉdata|jÉÉdd d
ddú
}t j
d
|jÉrh|j|d<n
|j|d<d}tj
|tajtj|ÉÉtjdçjÉ}tj|ÉjÉ}d|ddú|tjdj|jeÉ|j|dç}|jÉ}ad|akoÚd|akoÚ|adtkêr |ad|ed|tjd|jeÉ|j ÉdSd|akêrr|adt!t"gkêrrd|jkaêrf|jedekêrfde|e|j ÉdStj#dÉnéd|akaêrätj#dÉdS|ad|$|add |%|jj&d!d"|j$iÉ|j’É|jês–|j(É|j)Édk êrt*j+|j,d#ç|-d$|j-.|j-j/ÉdS)%Nr⁄6r3cSsg|]}ttjddÉÉëqS)rÈ )⁄str⁄random⁄arandint)⁄.0⁄ir#r#r$˙
Åsz#Sonoff.do_login..ÈZ oeVkj2lYFGnJu5XUtWisfW4utiN4u9MqZiOSz
iPhone10,6z11.1.2z3.5.3)
⁄password⁄aversion⁄ts⁄nonce⁄appidZimei⁄os⁄model⁄
romVersionZ
appVersionz[^@]+@[^@]+.[^@]+⁄emailZphoneNumbers 6Nz4n0xA8s8qdxQf2GqurZj2Fs55FUvM)⁄ digestmodzSign zapplication/json;charset=UTF-8)⁄
AuthorizationzContent-Typez-https://{}-api.coolkit.cc:8080/api/user/login)⁄aheaders⁄json⁄error⁄regionzffound new region: >>> %s <<< (you should change api_region option to this value in configuration.yaml)˙@Zcnz5Couldn’t authenticate using the provided credentials!⁄atz’Login failed! Please check credentials!⁄user⁄apikeyr_zaBearer )⁄targetT)0rrBr7⁄int⁄time⁄join⁄rangerN⁄uuid4⁄re⁄matchr6⁄hmacr4⁄encodera⁄dumps⁄ahashlib⁄sha256⁄digest⁄base64⁄ b64encode⁄decode⁄_headers⁄requests⁄post⁄formatr9rrFr&⁄awarningrHrrrb⁄
_bearer_tokenrD⁄updater%⁄
set_wshostr⁄ threading⁄Thread⁄init_websocket⁄thread⁄daemon⁄start)rIrZapp_detailsZdecryptedAppSecretZahex_dig⁄sign⁄r⁄respr#r#r$rHvsf







zSonoff.do_logincCsbtjd|j|jdç}|jÉ}d|krT|ddkrTd|krT|d|_tjad|jÉn
tjdaÉdS)Nz,https://%s-disp.coolkit.cc:8080/dispatch/app)rrbr⁄domainzeFound websocket address: %sz:Couldn't find a valid websocket host, abording Sonoff init) rzr{r9ryrarFr&⁄inforb)rIràrâr#r#r$rÄÀs zSonoff.set_wshostc √sÚ|jÉjstjdÉdStjd|jdÉ|jd}t|taÉrL|rHdnd}|j|jdÉ}|jda}|dk rétjd|d|d |d |Éntjd|d|É|s≤tjdÉd S|dk r‹d|ddi}||d|d<nd|i}dd||dt |dÉt t j ÉÉjddÉd|dkêr&|ddndddú}|d|jÉkêrN|jÉ|d<|jÉj tj|ÉÉxbt|jÉD]T\}a}|d|dkêrn|dk êrÆ||j|add|d<n||j|add<êqnWtjt |dÉ||deúÉ} |j| ddçdS)Nzwebsocket is not connectedz$received state event change from: %s⁄deviceid⁄state⁄on⁄off⁄outletz-Switching %s - %son outlet %d to state: %s⁄nameÈzeSwitching%s to state: %szunknown device to be updatedF⁄switches⁄paramsrr⁄apprg⁄.r3⁄controlTypeÈr)⁄action⁄ userAgentrîrgrå⁄sequencerórWZ selfApikey)⁄ entity_idrê⁄ new_state⁄S)⁄type)⁄get_ws⁄ connectedr&rbrr⁄ isinstance⁄bool⁄ get_devicerNrj⁄areplace⁄get_user_apikey⁄sendrarr⁄ enumeraterCrG) rI⁄eventrù⁄devicerêrî⁄apayloadZidxd⁄devrr#r#r$r.’sL zSonoff.state_listenerc CsHxBtjdÉt||j|jdç|_z|jjddçWd|jjaÉXqWdS)Nz(re)init websocket)r⁄ on_message⁄on_errorÈë)⁄ ping_interval)r&r⁄WebsocketListenerr≠rÆrE⁄run_forever⁄close)rIr#r#r$rÉes zSonoff.init_websocketcaGs¸|d}tjd|Étj|É}d|kr‰|ddkr‰d|kr‰d|dksRda|dkr‰xêt|jÉD]Ç\}}|d|dkr^|d|j|d<da|dkr∆xH|ddaD]}|j|d|d|d Éq¢Wn|j|d|ddÉPq^W|jatj|Éd dçdS) Nrízwebsocket msg: %srôrrîrrìrårê⁄W)rüÈˇˇˇˇ) r&rra⁄loadsr®rC⁄set_entity_staterGrr)rI⁄argsr⁄idxr™rr#r#r$r≠'s zSonoff.on_messagecGs|d}tjdt|ÉÉdS)Nrízwebsocket error: %srµ)r&rbrN)rIr∏rbr#r#r$rÆ=szSonoff.on_errorcCs:|jttjÉÉ}|t|jjÉÉk}|r6|jd7_|S)Nrí)rBrir0⁄ total_secondsr=)rIZgrace_time_elapsedZgrace_statusr#r#r$⁄is_grace_periodAs zSonoff.is_grace_periodNcaaCsäd|jrdnd||dk r(dt|dÉndf}t|jjj|ÉdÉrf|jjj|Éj}|jjja|||Étj |||daúÉ}|j |dd çdS) Nz switch.%s%s%sZasonoff_r3⁄_rí⁄ attributes)rúrêrç⁄s)rü)r;rN⁄ahasattrr5⁄statesr)rΩ⁄setrarrrG)arIrårçrêrú⁄attrrr#r#r$r∑Js zSonoff.set_entity_statecCs¶|jr|jÉrtjdÉ|jStjdja|j|j ÉÉ|j dç}|jÉ}d|krÜ|dtt gkrÜ|jÉrttjdÉ|jStjdÉ|jÉ|jÉ|_|j|jdadç|jS) NzGrace period activezJhttps://{}-api.coolkit.cc:8080/api/user/device?lang=en&apiKey={}&getTags=1)rrbzGrace period activated!zRe-login component⁄D)rü)rBrªr&rãrCrzr)r|r9r¶ryrarrr}rHrG⁄text)rIràrâr#r#r$r%Ys




zSonoff.update_devicesFcCs|r|jÉS|jS)N)r%rC)rI⁄force_updater#r#r$⁄get_devicesuszSonoff.get_devicescCs.x(|jÉD]}d|kr
|d|kr
|Sq
WdS)Nrå)r∆)rIrår™r#r#r$r§{szSonoff.get_devicecCs|jS)N)r~)rIr#r#r$⁄get_bearer_tokenÄszSonoff.get_bearer_tokencCs|jS)N)rD)rIr#r#r$r¶ÉszSonoff.get_user_apikeycCs|jS)N)rE)rIr#r#r$r†Üsz
Sonoff.get_wscCs|jS)N)rF)rIr#r#r$r
âszSonoff.get_wshostc√s|jÉ}dS)N)r%)rI⁄adevicesr#r#r$r åszSonoff.async_updatec>Cs‚dddddddddddddddddddú}ddadd d
ddd
ddddddddddddddeddddd d!d"d#d$d%d&d’d(d)dd+d,d,d-d.d/d0d1d2d3d4d5d6d7d8d9d:d;d<d=d>d?d@dAdBú=}|dC|jÉkrfi||dC|jÉkrfi|||dCSdS)DNríÈÈrò)⁄SOCKET⁄
SWITCH_CHANGE⁄GSM_UNLIMIT_SOCKET⁄SWITCH⁄
THERMOSTAT⁄SOCKET_POWER⁄
GSM_SOCKET⁄POWER_DETECTION_SOCKET⁄SOCKET_2⁄GSM_SOCKET_2⁄SWITCH_2⁄SOCKET_3⁄GSM_SOCKET_3⁄SWITCH_3⁄SOCKET_4⁄GSM_SOCKET_4⁄SWITCH_4⁄CUN_YOU_DOORrÀr”r÷rŸr–rŒr’rÿr€ZOSPFZaCURTAINzEW-REZ FIREPLACErÃrœZ
COLD_WARM_LEDZTHREE_GEAR_FANZSENSORS_CENTERZ
HUMIDIFIERZRGB_BALL_LIGHTZNEST_THERMOSTATr—ZAROMATHERAPYZRuiMiTeWenKongQirÕZ RF_BRIDGEr‘r◊r⁄r“Z
LIGHT_BELTZ FAN_LIGHTZEZVIZ_CAMERAZSINGLE_CHANNEL_DIMMER_SWITCHZHOME_KIT_BRIDGEZ FUJIN_OPSr‹Z$SMART_BEDSIDE_AND_NEW_RGB_BALL_LIGHTr3ZDOWN_CEILING_LIGHTZAIR_CLEANERZMACHINE_BEDZCOLD_WARM_DESK_LIGHTZDOUBLE_COLOR_DEMO_LIGHTZELECTRIC_FAN_WITH_LAMPZSWEEPING_ROBOTZRGB_BALL_LIGHT_4ZMONOCHROMATIC_BALL_LIGHTZMUSIC_LIGHT_BELTZNEW_HUMIDIFIERZKAI_WEI_ROUTERZMEARICAMERAZZIGBEE_MAIN_DEVICEZRollingDoorZ KOOCHUWAHZ
BLADELESS_FANZWARM_AIR_BLOWERZZIGBEE_SINGLE_SWITCHZZIGBEE_TEMPERATURE_SENSORZZIGBEE_LIGHT)=rír…r ròÈÈÈaÈrMrÈÈÈ
ÈrTÈÈÈÈÈÈÈÈÈÈeÈÈrÈÈ È!È"È#È$È&È(È)È
È+È,È-È.È1È3È4È5È7È8È9È;reÈ=È>ÈBÈCÈDiÈiÎiËiÍiËZuiid)⁄keys)rIr™Zname_to_outletsZuiid_to_namer#r#r$⁄get_outletsès¶zSonoff.get_outletsr3cCsÿ|jo"|jjjdÉo"|jjjddÉêrPt|jÉsFtajdÉ|jj dÉt
j|É}t|t
Éêr¯xöt|ÉD]é\}}xd+D]}||jÉkrt||=qtWx&d,D]}||djÉkrî|d|=qîWd|jÉkêrÏtjÉ}a|aj|djdÉÉ|ajÉ|d<|||<qfWt
j|ddd ç}|j|É}t
jt
j|ÉÉ}d!tjÉjd"Édd-Ö||f}|jj |ÉnÑ|jêr‘t|jÉêr‘|jjjdÉêr‘|jjjdd$Éêr‘tajd%É|jj d&Éd’d(Ñ|jDÉ|_|jjjejtd)j|jÉdÉd*Ég|_dS).Nzswitch.sonoff_debugrézinit sonoff debug data capturez…
--------------COPY-FROM-HERE--------------

r⁄sharedTo⁄settings⁄group⁄groups⁄ deviceUrl⁄deviceStatus⁄location⁄ showBrand⁄brandLogoUrl⁄__v⁄_id⁄iprå⁄ createdAt⁄ devicekeyrg⁄
partnerApikey⁄tags⁄staMac⁄ bindInfos⁄rssi⁄timersrîzutf-8r…T)⁄indent⁄ sort_keysz%s [%s] %s

z%Y-%m-%d %H:%M:%S.%fr rèzend of sonoff debug logz±--------------END-OF-COPY----------------
cSsg|]}|jdÉëqS)zutf-8)rq)rQ⁄xr#r#r$rSsz&Sonoff.write_debug..ÛzSonoff debug)rrrrrrrrrrrrrrårrergrr)rrr r!rÈ˝ˇˇˇ)r?r5r¿r)⁄is_state⁄lenr@r&r⁄appendrar∂r¢⁄listr®rrs⁄md5rrq⁄ hexdigestrr⁄
clean_datar⁄now⁄strftime⁄
components⁄persistent_notification⁄async_createrNrk)rIrrür4rπ⁄d⁄k⁄mr#r#r$rGÌsB&






zSonoff.write_debugcCs<tjdd|É}tjdd|É}tjdd|É}tjdad|É}|S) Nz"phoneNumber": “.“z"phoneNumber”: “[hidden]”,z“ip”: ".”,z"ip": “[hidden]”,z%"\w{2}:\w{2}:\w{2}:\w{2}:\w{2}:\w{2}"z"xx:xx:xx:xx:xx:xx"z "\w{8}-\w{4}-\w{4}-\w{4}-\w{12}"z&“xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx”)rn⁄sub)rIrr#r#r$r-es
zSonoff.clean_data)N)F)r3F)⁄__name__⁄
__module__⁄_qualname__rJr(rKrHrÄr.rÉr≠rÆrªr∑r%r∆r§r«r¶r†r*r r
rGr-r#r#r#r$r’Ps,U
F

^
.r’c@s0eZdZdddÑZddÑZddaÑZdd d
ÑZdS)
r±NcCsN||tjj|Étjj|dj|jjaÉÉ|j|||j dçd|
tjÉ|
dS)Nzwss://{}:8080/api/ws)⁄aon_openrÆr≠⁄on_closeF)
⁄a_sonoffrÅrÇrJ⁄ websocket⁄WebSocketAppr|r*r:r;r°rj⁄last_update)rIrr≠rÆr#r#r$rJ’s
zWebsocketListener.__init__cGs~d|_tjÉ|_ddddjddaÑtdÉDÉÉd d
|jjÉ|jjaÉtt tjÉÉÉddttjÉÉj
d
dÉdú}|jtj
|ÉÉdS)NTZ
userOnlinerïrfir3cSsg|]}ttjddÉÉëqS)rrM)rNrOrP)rQrRr#r#r$rS<sz-WebsocketListener.on_open..rTz1.8⁄iosz
iPhone10,6z11.1.2rñ)rôrörVrXZ
apkVesrionrZrergrWr[r\rõ)r°rjr?rkrlr<r«r¶rNrir•rßrarr)rIr∏r´r#r#r$r:4s
zWebsocketListener.on_opencGstjdÉd|_dS)Nzwebsocket closedF)r&rr°)rIr∏r#r#r$r;Is
zWebsocketListener.on_closercaCstjj|||||dçdS)N)⁄asockopt⁄ssloptr∞⁄ping_timeout)r=r>r≤)rIrArBr∞rCr#r#r$r≤Ms
zWebsocketListener.run_forever)NN)NNrN)ar7r8r9rJr:r;r≤r#r#r#r$r±&s

r±c@sheZdZdZddÑZddÑZddaÑZdd ÑZaed
dÑÉZ edd
ÑÉZ
eddÑÉZddÑZeddÑÉZ
dS)⁄SonoffDevicez!Representation of a Sonoff devicecCs<d|_d|_d|_||_|d|_|d|_d|ji|_dS)zInitialize the device.Nrå⁄onlineZ device_id)a⁄a_outletZa_sensor⁄_stater5⁄ _deviceid⁄
_available⁄_attributes)rIr"r™r#r#r$rJWs

zSonoffDevice.__init__cCs8x2|jjtjÉD]}d|kr|d|jkr|SqWdS)Nrå)r5rrr∆rH)rIr™r#r#r$r§fszSonoffDevice.get_devicecCs*|jÉ}d|dkr&|dd|jd<d|dkrD|dd|jd<d|dkrb|dd|jd<d|dkrê|dddkrê|dd|jda<d|dkræ|dddkræ|dd|jd <d
|dkr‹|dd
|jd
<|jdk êr|êr|dd|jdd
kSdS|êr"|ddd
kSdSdS)N⁄powerrî⁄acurrent⁄avoltageZcurrentHumidity⁄unavailable⁄humidityZcurrentTemperature⁄temperaturer rìrréF)r§rJrF)rIr™r#r#r$⁄ get_statems $zSonoffDevice.get_statecCs|jÉ}|r|dSdS)NrEF)r§)rIr™r#r#r$⁄
get_availableäszSonoffDevice.get_availablecCsdS)zReturn the polling state.Tr#)rIr#r#r$⁄should_pollèszSonoffDevice.should_pollcCs|jS)zReturn the name of the switch.)⁄_name)rIr#r#r$rëîszSonoffDevice.namecCs|jÉS)z Return true if device is online.)rR)rIr#r#r$⁄ availableôszSonoffDevice.availablecCsdS)zUpdate device state.Nr#)rIr#r#r$rüszSonoffDevice.updatecCs|jS)z(Return device specific state attributes.)rJ)rIr#r#r$⁄device_state_attributesßsz$SonoffDevice.device_state_attributesN)r7r8r9⁄a__doc__rJr§rQrR⁄propertyrSrërUrrVr#r#r#r$rDTsarD)=⁄aloggingrjrprsrOrvra⁄socketrzrnrÅ⁄
voluptuous⁄volrr⁄homeassistant.helpers.entityrZehomeassistant.helpers.eventrZhomeassistant.util.async_rZhomeassistant.helpersrar⁄cv⁄homeassistant.constr r
rrr
rrrrr8rr:r⁄REQUIREMENTSr=⁄ getLoggerr7r&⁄Schema⁄ Exclusive⁄string⁄Required⁄Optional⁄time_period⁄positive_int⁄aboolean⁄ALLOW_EXTRA⁄
CONFIG_SCHEMAr2r’rÇr>r±rDr#r#r#r$⁄sH`,


Y.

Two quick questions.

Do you have any other custom components running with no errors?

Is your network working like it should? I can get configuration errors on eg. sonoff, Tuya and Alexa Media player components (configuration not valid) when I take down one of my two DHCP/DNS servers for maintains and HassOS is using just that DNS server.

I have dual DHCP and DNS servers in my network and it looks like HassOS don’t switch to the DNS 2 when DNS 1 is down. (or taking its time to do the switch or if I have missed something in the network configuration)

hi Plonkis sorry for the late reply,

no I haven’t, there is only 1 dhcp , I haven’t any others devices in Hass this is the only one device attached ( I should have to connect 9 others sonoff)…

no problems!

are you using 32 or 64 bit version of HA ?
(if you are using 64 bit, test the 32 bit version of HA)

l’ultima versione compatibile è la 94.4 di Home hassistant, dalla 095 in poi a me fa lo stesso tuo problema, ho downgradato appunto alla 0.94.4

English please.

Esegui anche HA su un QNAP?
corri 32 o 64 bit?

Do you also run HA on a QNAP?
are you running 32 or 64 bit?

thank you Plonkis for the reply, I have a qnap ts251 with celeron j1900 CPU I checked in intel website and I think I have a 64 bit system… I’ll try the 32bit version although I have to understand how to install external installation os.

Thank you redbul, a little question did you tryed with a qnap system?

Same over here, updated from 0.94 to 0.96.5 and it stopped working.

1 Like

Not working here too after update. Is there any solution avaliable?

I updated the component, restarted HomeAssistant and presto.

The switches created by this component have a new name tho, they used to be named something like switch.10a72838c (some random alphanumeric). Now they have a suffix switch.*sonoff_*randomalphanumericnumber

there’s a toggle option to restore that behavior, check entity_prefix

for those who complain about the latest updates not working, please provide more details, logs anything. i cannot debug (or fix, but ain’t the case now) on simply not working-s (i don’t have access to sonoff devices and it’s purely theoretical from now on for me). the component still works with the latest update… for me anyway :upside_down_face:

1 Like

for me it’s still working too, I’m on latest hassio build and I never updated the component since first install, around May 10th

If I understand right this is only related to HA (64bit) + Sonoff installed on QNAP?

On Raspberry with 32bit HA etc. everything works for me too.

come hai messo HA in 32Bit? io uso HASSBian
how did you put HA in 32Bit? I use HASSBian

Hi Peter!

I’ve some good and bad news since I’ve updated Sonoff firmware on my Sonoff devices to 3.3.0 release.

Good news: Sonoff switches are very reactive (when I update a switch manually, HA receives immediately change state event and when I use HA to change state of a switch, it commutes immediately)

Bad news: Regarding Sonoff temperature / humidity sensors (TH16) and Sonoff POW R2, HA doesn’t receive any state events changes (temperature, humidity, power, current, voltage): sometimes restarting HA, it reads new values just first time, no further values are tracked; often, restarting HA, it reads no new values, so undefined or “old” vales are shown both inside UI and sensors state page).

I check your HA Sonoff code, so I did on Sonoff debug notifications, but no error. It looks like websocket doesn’t receive state change events (for temperature, humidity, power, current, voltage).

Thank you! :slight_smile:

— INTEGRATION —
For more infos: a Sonoff POW with 2.6.1 firmware version works fine, so problems seems to be limited to my other Sonoff sensors: POW R2 and TH16 with 3.3.0 firmware version.

what you’re saying makes it weirdly interesting :thinking:
clearly they changed something but I strongly believe the data is still sent over websocket otherwise a device with a fw 3.3.0(+) will be incompatible with an older version of the mobile app (and that will be just really bad design).
also I think stuff changed on how the device send’s the temp/hum/etc. data to the server and then the normal update back to HA websocket instance.
i have POW R2 myself, but for summer reasons it’s unaccessible to me right now. also I’ll have to purchase a flasher to dump the current fw so I can test and find the differences between the firmwares.

i’m also waiting for further complains to see if anyone else has this problem.
ps: if i remember right there is already a polling fallback option that updates the HA just in case websocket crashes for whatever reason, so for better or worse the details should still change (just like when you restart HA) just … slower.

Thanks a lot, Peter! :grinning:
Yeah! I agree with you that Sonoff doesn’t changed the data structure, otherwise data never be retrieved.

I just noticed some new strange things:
a) Inside Sonoff (eWeLink app), refresh rate of POW R2 sensors are very slow compared previous firmware and app versions (yes, eWeLink app release, too) and now voltage, current and power has a refresh rate slower that 10 seconds…
b) I find out that new eWelink app has a kind of “background login” and it’s necessary to do an explicit logout to avoid Sonoff login conflict with HA
c) Often, new eWeLink app switch automatically in LAN mode despite my internet connection is stable and fast

So… may be Sonoff messed up something…

Well, I’ll wait some days to see if new firmware version will be released or something changes on Sonoff AWS service or new eWelink app, or…

Thanks a lot again and feel free to ask me more details as you need!

— INTEGRATION (again) —

  1. Because it’s ill-judged be logged in Sonoff from eWeLink app and HA at the same time, I checked all I wrote before after doing an explicit logout from eWeLink app: I can confirm each assertion I did.
  2. I rarely see randomly single value updated (temperature, humidity, voltage, current power) from Sonoff sensors inside HA
  3. As I wrote, eWeLink app often auto switch in LAN mode and I’m able to see sensors change state on app UI during app LAN mode; seems to me that in “internet” mode app doesn’t receive any state change event

Considering what I stated above (points 2) and 3)), do you think it’s possible that new firmware release / eWeLink app loses connection with Sonoff AWS services? This would explain why HA was unable to receive sensor status updates! :roll_eyes:

(P.S.: I’ve checked correct eu-AWS Sonoff URL resolution: each client in my network resolves it correctly)