AlexxIT / SonoffLAN

Control Sonoff Devices with eWeLink (original) firmware over LAN and/or Cloud from Home Assistant
https://github.com/AlexxIT/Blog
MIT License
2.58k stars 405 forks source link

TX Ultimate - Touch Sensor activating every minute #1373

Closed NullScope closed 2 months ago

NullScope commented 3 months ago

I've added a TX Ultimate 1 Switch (T5-1C-86) into my house, and used SonoffLAN to add it to home assistant, however for some reason, the Touch sensor it adds, keeps swapping to "Touch" every minute. I've checked the eWeLink app and this isn't registered on the logs, nor do the lights turn on/off or flicker, so it seems it might be an issue with the integration. This makes it impossible to automate using the sensor

image

image

Here are all the logs: home-assistant_sonoff_2024-03-28T16-05-58.666Z.log sonoff-b22067f983846bf70d4ec053712eb710-Bathroom Wall Switch-9487f15a23fad64008a7d7e80740df1f.json

NullScope commented 3 months ago

Seems if I set the integration to Cloud/Auto the spamming stops, however no "touch" event gets fired, only slide_1 and slide_2

NullScope commented 3 months ago

Upon further investigation, it seems that in Auto there is in fact a "touch" event, however the issue still happens, but only every hour. I looked into the code and saw that it is pinging the switch which causes the switch to then reply with this message:

2024-04-03 16:29:54 [D] 100208fab3 <= Local3 | 192.168.1.18:8081 | {'percentageControl': 0, 'calibState': False, 'triggerType': 2, 'fwVersion': '1.3.1', 'rssi': -79} | 317

The code then interprets this as a "touch" event, however a true touch event has a switches array in the message like so:

2024-04-03 13:55:44 [D] 100208fab3 <= Local3 | 192.168.1.18:8081 | {'switches': [{'switch': 'on', 'outlet': 0}], 'percentageControl': 0, 'calibState': False, 'triggerType': 2, 'fwVersion': '1.3.1', 'rssi': -91} | 282

I will make a PR to fix this issue

GONOD commented 4 weeks ago

I comment here because I still have the issue. I have more than 10 T5 1/2/3/4 switches and I have a switches array in the response:

2024-06-04 14:57:47.942 DEBUG (MainThread) [custom_components.sonoff.core.ewelink] 1001f11217 <= Local3 | xxx.xxx.x.xxx:8081 | {'switches': [{'switch': 'off', 'outlet': 0}, {'switch': 'off', 'outlet': 1}, {'switch': 'off', 'outlet': 2}], 'electromotor': 1, 'percentageControl': 0, 'calibState': False, 'triggerType': 2, 'lightSwitch': 'off', 'lightMode': 0, 'shock': 1, 'doNotDisturb': 1, 'doNotDisturbTime': {'from': '22:00', 'to': '07:00'}, 'sledOnline': 'on', 'fwVersion': '1.4.0', ...} | 11382

So I guess the fix is only for T5 with 1 switch

NullScope commented 4 weeks ago

@GONOD what version do you have currently installed? I ask because my fix just looks for the presence of the switches array, which you have.

Do you have the switch in eletromotor mode? Given the presence of 'electromotor': 1 which is maybe making it go into another component in SonoffLAN

GONOD commented 4 weeks ago

@NullScope I have the 3.7.3 (the latest) that include your fix (already checked on the code). And I guess the presence of the switches array depends on the type of switch 1 or more buttons. One button, no array, and if there are more than one buttons it will send the array with the state of each switches.

I'm not in electromotor mode. (Not on the ewelink app...it's switch mode). Screenshot_20240604-164948

NullScope commented 4 weeks ago

One button, no array, and if there are more than one buttons it will send the array with the state of each switches.

This is odd as I only have 1 TX Ultimate and its one switch / gang, which was sending the array, unless something has changed on the recent firmware update, but I also have that updated to the latest version