Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

4CH Pro Unavailable channels (but not all) in Home Assistant #24

Closed
Kalma-House opened this issue Feb 19, 2020 · 12 comments
Closed

4CH Pro Unavailable channels (but not all) in Home Assistant #24

Kalma-House opened this issue Feb 19, 2020 · 12 comments
Assignees

Comments

@Kalma-House
Copy link

HA Version: 105.2
Component: Latest version (1.1.3) (It did not happen in 1.1.1)
Devices: 4CH Pro (2 of them)
Firmware: 3.3.0

switch:
  - platform: sonoff_lan_mode_r3
    name: sonoff_4chr2_XXXXXXXXXX_0
    device_id: XXXXXXXXXX
    api_key: xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx
    icon: mdi:lightbulb
    outlet: 0
  - platform: sonoff_lan_mode_r3
    name: sonoff_4chr2_XXXXXXXXXX_1
    device_id: XXXXXXXXXX
    api_key: xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx
    icon: mdi:lightbulb
    outlet: 1
  - platform: sonoff_lan_mode_r3
    name: sonoff_4chr2_XXXXXXXXXX_2
    device_id: XXXXXXXXXX
    api_key: xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx
    icon: mdi:lightbulb
    outlet: 2
  - platform: sonoff_lan_mode_r3
    name: sonoff_4chr2_XXXXXXXXXX_3
    device_id: XXXXXXXXXX
    api_key: xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx
    icon: mdi:lightbulb
    outlet: 3
  - platform: sonoff_lan_mode_r3
    name: sonoff_4chr2_YYYYYYYYYY_1
    device_id: YYYYYYYYYY
    api_key: yyyyyyyy-yyyy-yyyy-yyyy-yyyyyyyyyyyy
    icon: mdi:lightbulb
    outlet: 1
  - platform: sonoff_lan_mode_r3
    name: sonoff_4chr2_YYYYYYYYYY_0
    device_id: YYYYYYYYYY
    api_key: yyyyyyyy-yyyy-yyyy-yyyy-yyyyyyyyyyyy
    icon: mdi:lightbulb
    outlet: 0
  - platform: sonoff_lan_mode_r3
    name: sonoff_4chr2_YYYYYYYYYY_2
    device_id: YYYYYYYYYY
    api_key: yyyyyyyy-yyyy-yyyy-yyyy-yyyyyyyyyyyy
    icon: mdi:lightbulb
    outlet: 2
  - platform: sonoff_lan_mode_r3
    name: sonoff_4chr2_YYYYYYYYYY_3
    device_id: YYYYYYYYYY
    api_key: yyyyyyyy-yyyy-yyyy-yyyy-yyyyyyyyyyyy
    icon: mdi:lightbulb
    outlet: 3

The 4CH Pro are multichannel devices. About once a day, most (but not all) the channels in each device become unavailable in HA. That seems weird to me. If the devices were really unavailable all the channels should be marked as such (besides,the devices are available in ewelink app). Moreover, as soon as I toggle one of the available channels in HA, the rest of the channels in the device instantly become available. All of this leads me to believe it is a bug in the component, and not a problem in the network.

This is a link to the debug trace, if you are interested:
https://pastebin.com/NrYCkse6

The relevant parts are at times 2020-02-18 23:26:54 (when the devices become unavailable) and 2020-02-18 23:44:31 (when I toggle one of the channels and the rest become available).

Let me know if I can be of further assistance.
Regards.
Javier

@mattsaxon
Copy link
Owner

Interesting behaviour if this did not happen with 1.1.1! I suggest you go to previous version then whilst I look at this!

For your information, the problem you describe is exactly as I had with 1.1.1, 1.1.3 was designed to fix this problem.

The reason that some device may be seen offline is because the for a 4 channel device the component runs 4 times and each may get different behaviour in a network problem.

Also eWeLink does some specific retries so you can get different behaviour.

All issue that I have had like this were ultimately a network issue, with broadcast packets getting lost.

However that doesn’t mean the component can be improved to adjust for it somewhat.

@mattsaxon
Copy link
Owner

Note I haven’t tested with HA 0.105 yet so may be related somehow. I’ll try at some point, but am probably not going to be able to look for a number of weeks

@mattsaxon
Copy link
Owner

mattsaxon commented Feb 19, 2020

Looking through the trace I can see what the issue is. The mDNS message has timed out (likely due to a dropped packed on the network). This happens for all the devices simultaneously. Then each of the 4 components sends a check. Some of these fail because the 4CH device can’t handle the 4 concurrent connection attempts. That is why some are marked unavailable and others aren’t.

I would have thought it would retry, but perhaps not with the specific ‘connection aborted’ error.

So I can fix with a retry or some code to ensure I don’t send at same time. First option is perhaps easiest. Not sure at this point.

As mentioned above, I probably won’t be able to fix for some weeks to come.

@Kalma-House
Copy link
Author

Just so you are aware of the issue. Fix it whenever you have the time. Thank you for all your work. It is very much appreciated.

A few comments:

  1. Perhaps the logical way to fix it would be to send only one retry check for each device and not for each channel (but it is your code and you know better, so forgive me if I am being rude);

  2. Somehow the network issues I seemed to be having with your component (I mean the mDNS message timeouts) apparently ceased after I updated another custom component not related to yours. Sonoff devices no longer become unavailable. Was it chance, or do you have a possible explanation for it? (Although now I have network issues with that other custom component!!)

Regards,

Javier

@mattsaxon
Copy link
Owner

On point 1, that is easier said that done, but I’ll consider it when I get a chance.

On point 2, what component did you update?

@Kalma-House
Copy link
Author

Point 1: I understand. Forgive if I was out of line.

Point 2: https://github.com/albertogeniola/meross-homeassistant

@mattsaxon
Copy link
Owner

Thanks.

Point 1, not out of line, don't sweat it!

Point 2. I can't see why adding this component would change the behaviour of mine. I checked the dependency tree here https://libraries.io/pypi/meross-iot/0.3.1.10/tree to see if there was any upgrades it had done.

I'll work on the retry logic when I have a chance.

@mattsaxon mattsaxon self-assigned this Mar 8, 2020
@mikebargauan
Copy link

I have similar experience with AlexxIT /SonoffLAN - here my issue:

I have installed HA(0.107.1) + SonoffLan + floorplan with n 3 sonoff and 3 coolkit 4ch devices - work fine! - no internet and no other devices.
But if HA (raspberry3+) reboots, all devices are unavailable.
I need to turn on some android with eWeLink app, let the app refresh and all devices work again.
Or power cycle (power off/on) all devices after HA is ready, but usually we do have same power source for all.

Any suggestion?
I can setup VPN/remote connection or send config directory if needed.

Thanks
Mike

@mattsaxon
Copy link
Owner

I've just released v1.1.4 which has some improvements in it to reties.

I don't necessarily expect it to fix the issue, but it would be good to know if the problem still remains.

1.1.4 requires HA 0.107 btw

@Kalma-House
Copy link
Author

Thanks. I will install it right and I will let you know how it goes. I am already on 0107.7, so no problem.

Regards,
Javier

@Kalma-House
Copy link
Author

Hi,

Very good news. In the last 9 days since I installed the latest version I haven´t got a single ocassion in which any of the channels became unavailable. So either I 've got very lucky or (more likely) you have solved the problem.

I wish to thank you for your effort and determination in solving this issue. You have my gratitude.

Regards,
Javier

Note:
In case it is any of use to you, I attach the log of a recent event in which I believe before the channels would have become unvaliable and now everything continues as normal and working:
https://pastebin.com/6qi5yLVb

@mattsaxon
Copy link
Owner

mattsaxon commented Apr 25, 2020

Is this still working ok, I will close this issue now, but please reopen if there are issues

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants