krahabb / meross_lan

Home Assistant integration for Meross devices
MIT License
424 stars 47 forks source link

"Add device" initiates only "Meross LAN MQTT Hub" dialog #225

Closed Mart11 closed 1 year ago

Mart11 commented 1 year ago

Version of the custom_component

Configuration


Add your logs here.

Describe the bug

I'm on latest version of Meross LAN on fresh HA installation. I manualy added first smart plug without any issue, but when I try to add another smart plug with "+Add device" the dialog shows only "Meross LAN MQTT Hub". Am I missing somenthing?

The reason why I use manual adding of device is because my smart plugs are in second network (to which HA is connected over Wifi). Main eth0 NIC is conected to my main LAN network. For some reason auto-discovery works only on eth0, and not also on wlan0. Even HA has second IP address in second Wifi network and everything else works fine.

Debug log


Add your logs here.
krahabb commented 1 year ago

Sorry for that @Mart11, This is a somwhat dumb configuration flow behaviour I've decided to implement for the integration and it is working as expected. After adding the 'MQTT Hub' (and keeping that entry - you could even disable that but you have to have it) you can start adding devices configuration entries by simpling adding the integration again (for each device) Somewhere in the documentation this is explained but I agree it is a bit counterintuitive

sdugoten commented 1 year ago

I have the same problem. I install a brand new installation of Meross LAN. After the integration is added from HACS, I restarted the Home assistant server. The server comes back on, I checked there is no new device found in integration page. According to the setup guide "Meross devices should be automatically discovered by the 'dhcp' integration ", it didn't happen.

So, I click on the "Add integration" button on bottom right, and I see this popup

20221116_005657

And then shortly after is this menu

20221116_004927

I have like 20+ light switches, so I add the first one which happen to have a fix IP address. It works no problem.

However, the auto discovery don't seems to work after I added the first light switches, and I can't add the rest of the light switches because all are dynamic IP...

So, I wonder how to get the auto discovery works?

Version | core-2022.11.2 Host Operating System | Home Assistant OS 9.3 Supervisor Version | supervisor-2022.10.2 Operating System Version | 5.15.74

Mart11 commented 1 year ago

Thank you @krahabb for a reply.

@sdugoten

I have the same problem. I install a brand new installation of Meross LAN. After the integration is added from HACS, I restarted the Home assistant server. The server comes back on, I checked there is no new device found in integration page. According to the setup guide "Meross devices should be automatically discovered by the 'dhcp' integration ", it didn't happen.

I have found a solution for that - if you are using two network adapters for connections to two networks. Basically you need to configure which network adapters integrations will use. Default is eth0, and in the GUI there is no way to change it (you can check it in the: Settings > System > Network). Every network adapter (NIC) can have a priority assigned in OS. Default is -1 (not configured), and therefor a wired NIC is preferred over a Wi-Fi NIC. To change that use a Terminal/SSH and set eth0 interface metric higher over wlan0 (ie. Eeth0 to 2000 and wlan0 to 1000. Lower nr. means higher priority):

nmcli
nmcli connection show
nmcli connection edit <Connection_you_want_to_deprioritize> 
§ nmcli> set ipv4.route-metric 2000
§ nmcli> save
§ nmcli> quit

Then restart HA, and even the whole OS (Raspberry PI ie.) - Settings > Hardware > … > Reboot system

After that the discovery process for Meross LAN works on Wi-Fi network adapter. It has only one drawback if you are using external access to HA (over VPN or NAT) in combination with dedicated IoT Wi-Fi router in your LAN. It will stop working due to routing changes. You can make it work again but you have to use a NAT rule on IoT Wi-Fi router to redirect 8123 port from LAN IP of that router to HA IP in IoT network. And for external access use the LAN IP of IoT router (adjust external WAN NAT rule, and/or use IoT router LAN IP over VPN).

sdugoten commented 1 year ago

Thank you @krahabb for a reply.

@sdugoten

I have the same problem. I install a brand new installation of Meross LAN. After the integration is added from HACS, I restarted the Home assistant server. The server comes back on, I checked there is no new device found in integration page. According to the setup guide "Meross devices should be automatically discovered by the 'dhcp' integration ", it didn't happen.

I have found a solution for that - if you are using two network adapters for connections to two networks. Basically you need to configure which network adapters integrations will use. Default is eth0, and in the GUI there is no way to change it (you can check it in the: Settings > System > Network). Every network adapter (NIC) can have a priority assigned in OS. Default is -1 (not configured), and therefor a wired NIC is preferred over a Wi-Fi NIC. To change that use a Terminal/SSH and set eth0 interface metric higher over wlan0 (ie. Eeth0 to 2000 and wlan0 to 1000. Lower nr. means higher priority):

nmcli
nmcli connection show
nmcli connection edit <Connection_you_want_to_deprioritize> 
§ nmcli> set ipv4.route-metric 2000
§ nmcli> save
§ nmcli> quit

Then restart HA, and even the whole OS (Raspberry PI ie.) - Settings > Hardware > … > Reboot system

After that the discovery process for Meross LAN works on Wi-Fi network adapter. It has only one drawback if you are using external access to HA (over VPN or NAT) in combination with dedicated IoT Wi-Fi router in your LAN. It will stop working due to routing changes. You can make it work again but you have to use a NAT rule on IoT Wi-Fi router to redirect 8123 port from LAN IP of that router to HA IP in IoT network. And for external access use the LAN IP of IoT router (adjust external WAN NAT rule, and/or use IoT router LAN IP over VPN).

I only have 1 NIC on the Home assistant. So it seems that is not the case....

20221116_100425

20221116_100529

krahabb commented 1 year ago

@sdugoten , I'm sorry to not being able to help you out of this issue, I'm guessing the problem lies 'somewhere' in the DHCP configuration of your setup...or...your devices mac addresses (meross_lan recognize official Meross devices by masking the mac address for well-known patterns) belong to a new set of hw macs which are not recognized by th eolder masks.

Supposing your HA instance is correctly receiving the DHCP traffic (but it should since I guess you're using a basic HassOS setup)

I'll try to investigate online if Meross was allocated some new address ranges for their devices.

krahabb commented 1 year ago

also this https://community.home-assistant.io/t/meross-plugs-mss210-mac-address/329945 could explain the missing discovery...

sdugoten commented 1 year ago

also this https://community.home-assistant.io/t/meross-plugs-mss210-mac-address/329945 could explain the missing discovery...

I am not using a TP-Link RE650 wifi extender. So, i doubt it is "Mac proxy" issue. My home setup is pretty simple, just a basic HassOS setup with almost no plugin on it except meross, Govee and homekit. Every single IOT devices and computer are on the same subnet which is 10.0.1.0/24. There is no firewall in between and one single router connect to the Internet.

DavidSack commented 1 year ago

I was having the same issue re-adding on of my 510x's. I rebooted and then it showed up automatically. Just an FYI.