krahabb / meross_lan

Home Assistant integration for Meross devices
MIT License
387 stars 46 forks source link
hacs homeassistant meross meross-devices meross-homeassistant meross-lan

hacs GitHub last commit GitHub Workflow Status GitHub

Meross LAN

This homeassistant integration allows you to control your Meross devices in a very flexible way. Despite it's name (at the origin this was a project to only support local LAN connectivity) it now supports these communication layers:

These are the two main use cases:

HAVE FUN! 😎

Installation

HACS

In your HA frontend go to HACS -> Integrations, search for 'Meross LAN' and hit 'Install' You'll have to restart HA to let it recognize the new integration.

Manual installation

Download and copy the custom_components/meross_lan directory into the custom_components folder on your homeassistant installation.

Depending on the type of HA installation you might have to follow specific instructions.

This is working for a standard 'core' installation but should work for any other flavour: remember to set the appropriate ownership and access rights on your copied files so the homeassistant user running your instance is able to read and execute the integration code.

Restart HA to let it play.

Setup

Once installed and restarted, your Meross devices should be automatically discovered by the HA dhcp integration and will then pop-up in your integrations panel ready to be configured.

ℹ️ If device(s) are not automatically discovered, try powering them off for 10s and then powering them back on. A notification that new devices have been discovered should appear in notifications.

ℹ️ To manually add your devices or Meross cloud account go to HA->Settings->Devices & Services->Add Integration->Meross LAN Here, choose what's appropriate and follow up

Depending on how your devices are configured you should proceed as follows:

You can also manually add your device by adding a new integration entry and providing the host address and device key (repeat this for every device to add).

When manually configuring a device entry you'll have the option to set:

These other options are available once the device is setup the first time. To access them just access the integration configuration UI by hitting 'CONFIGURE' on the device entry from the meross_lan integration page and then 'Configure' (again) from the menu:

Supported hardware

Most of this software has been developed and tested on my owned Meross devices which, over the time, are slowly expanding. I have tried to make it the more optimistic and generalistic as possible based on the work from @albertogeniola and @bytespider so it should work with most of the hardware out there but I did not test anything other than mines. There are some user reports confirming it works with other devices and the 'official' complete list is here (keep in mind some firmware versions might work while other not: this is the 'hell' of hw & sw):

Features

See the wiki for some behavior/implementation details on specific devices

The component exposes the basic functionality of the underlying device (toggle on/off, dimm, report consumption through sensors) without any other effort. It should be able to detect if the device goes offline suddenly by using a periodic heartbeat. It also features an automatic protocol switching capability so, if you have your MQTT setup and your broker dies or whatever, the integration will try to fallback to HTTP communication and keep the device available returning automatically to MQTT mode as soon as the MQTT infrastructure returns online. The same works for HTTP mode: when the device is not reachable it will try to use MQTT (provided it is available!). This feature is enabled by default for every new configuration entry and you can control it by setting the 'Protocol' field in the configration panel of the integration: setting 'AUTO' (or empty) will do the automatic switch. Setting any fixed protocol 'MQTT' or 'HTTP' will force the use of that option (useful if you're in trouble and want to isolate or investigate inconsistent behaviours). I'd say: leave it empty or 'AUTO' it works good in my tests.

If you have the MSH300 Hub working with this integration, every new subdevice (thermostat or sensor) can be automatically discovered once the subdevice is paired with the hub. When the hub is configured in this integration you don't need to switch back and forth to/from the Meross app in order to 'bind' new devices: just pair the thermostat or sensor to the hub by using the subdevice pairing procedure (fast double press on the hub).

In general, many device configuration options available in Meross app are not supported in meross_lan though some are. As an example, the thermostats preset temperatures (for heat, cool, eco/away) are accessible in HA/meross_lan exactly as if you were to set them manually on the device or via the app. These, and any other supported configuration options, are available as configuration entities (so they're not added to the default lovelace dashboard) and you can access them by going to the relevant device page in HA Configuration -> Devices

Service

There is a service called meross_lan.request exposed to simplify communication with the device and play with it a bit. It basically requires the needed informations to setup a command request and send it over MQTT or HTTP without the hassle of signatures and timestamps computations. You can check it in the 'Developer Tools' of the HA instance, everything should be enough self-explanatory there. Since version 4.4.0 the service allows you to receive the 'original' device response through the new HA service response feature

Troubleshooting

Check the wiki for detailed informations on how to gather diagnostics data for meross_lan devices

References

This integration has been made possible only with the contribution of the awesome work done by:

Have a look at their repositories to better understand how the Meross line of devices is working through MQTT. I really thank them for the inspiration and the knowledge that made it possible for me to develop this integration.

Special mention also for:

who greatly helped me fixing issues or developing nice enhancements to the component