Are Meross switches compatible with any existing components?

Hi,
this is just to add my two cents to the discussion.

I created a Home Assistant custom-component for Meross devices, based
on the work done by Alberto Geniola and Chris Hurst.

You can find it here: https://github.com/vincenzosuraci/hassio_meross_sensor_switch

This custom-component has both sensor and switch capabilities. It means that you can control the switch (on/off) but also monitor its sensors, if it equipped with sensors. For example, mss210 can only switch, while mss310 can switch on and off, but also provides current, voltage and power measurements. With this component you can handle both.

I tested it only with my Meross mss310 and mss210 v2.0.0, but any help to extend it to other Meross devices is more than welcome.

Have fun with it.

Regards,
Vincenzo

1 Like

Hi, just installed your component, seems to work fine. I have one meross plug with energy monitor MSS310HIT.

But which are the mqtt commands for switch on/off and energy monitor? Below I see in log the topic created

homeassistant/switch/18112xxx_0/state.
homeassistant/switch/18112xxx_0/config.
homeassistant/switch/18112xxx_0/.
homeassistant/sensor/18112xxx_0_current/config.
homeassistant/sensor/18112xxx_0_voltage/config.
homeassistant/sensor/18112xxx_0_power/config.

Hi, I tried your component, installed it, put the correct credentials, but no switch is created, and nothing in log!

Hi Klagio,
take into account that the hass component relies on the python meross iot library created by albertogeniola, so if you have a Meross device that is not supported by that library, also the hass component will not work. First of all, I suggest to you to check the compatibility list (link).

I tested the home assistant component on with my Meross devices (mss310 and mss210 version 2.0.0). When I started developing the hass component, my Meross devices were not working with the meross iot library created by Alberto Geniola. I get in contact with him and we discovered that I had a new version of the Meross devices (version 2.0.0 instead of 1.0.0) so, studying the python code of the meross iot library, I found that my Meross devices had a different get_status() function output. So, I provided this output to Alberto Geniola, and he developed a new version of the meross iot library.

So, in case your device is not supported and if you are familiar with python, I still suggest you to try to use the meross iot library, collect the get_status() function output and open a new issue here.

Regards,
Vincenzo

How can I configure your addon with auto discovery in configuration/integration

To change manually the state of a switch, you have to publish on topic homeassistant/switch/18112xxx_0/command the message 1 to turn on, or 0 to turn off.

1 Like

On HASSIO, go to configuration, integrations, and select MQTT.
Or if you prefer, in your configuration.yml file, add
mqtt:
discovery: true
discovery_prefix: homeassistant

let me know if it works for you :wink:

I have no test on this kind of hardware.

If you ship one to me, I develop the feature and send the switch back to you.
It’s complicate for me developer new part of code without the hardward :frowning:

Thanks a lot, will try it.
And to have a sensor with the power?

For the switch command is this correct? Is there any availability_topic?

  - platform: mqtt
    name: meross1
    state_topic: "homeassistant/switch/181126xxx_0/state"
    command_topic: "homeassistant/switch/181126xxx_0/command"
  #  availability_topic: "homeassistant/switch/181126xxx_0/LWT"
    qos: 1
    payload_on: "1"
    payload_off: "0"
    payload_available: "Online"
    payload_not_available: "Offline"
    retain: true

EDIT, no like the above the switch is not working (turning on but not off)

I see that this below is the payload of the topic

homeassistant/sensor/1811262xxx_0_power/state

{“name”:“Lampada da salotto - Sensor power”,“state”:“0”,“device”:{“name”:“Lampada da salotto”,“sw_version”:“2.1.5”,“identifiers”:[“1811262xxx”]}}

I guess I need to extract the “state”, but don’t know how to

EDIT like this?

sensor:
  - platform: mqtt
    state_topic: "homeassistant/sensor/181126xxx_0_power/state"
    name: meross1 power
    unit_of_measurement: W
    value_template: "{{ value_json.state }}"

Ty. It works for meross MSS425E

1 Like

Dear Klagio,
I’m updating the custom-component, adding compatibility with other Meross devices. Have a look and, in case it still does not work, open an issue providing as much as information you can (e.g. log errors).

Regards,
Vincenzo

1 Like

Thanks vincenzo.suraci, I can confirm perfectly acknowledge the status of the following devices:

Home Assistant 0.91.2
HassOS 2.11

Devices (UE)
MSS310
MSS425E
MSS425F

It would simply be necessary to turn them on and off, when executing this action it presents the following results.

‘GenericPlug’ object has no attribute ‘device’

22:05 custom_components/meross/switch.py (ERROR) - message first occured at 22:05 and shows up 10 times

Tue Apr 09 2019 22:05:52 GMT+0200 (hora de verano de Europa central)
‘GenericPlug’ object has no attribute ‘device’
Traceback (most recent call last):
File “/usr/local/lib/python3.7/site-packages/homeassistant/components/websocket_api/commands.py”, line 122, in handle_call_service
connection.context(msg))
File “/usr/local/lib/python3.7/site-packages/homeassistant/core.py”, line 1138, in async_call
self._execute_service(handler, service_call))
File “/usr/local/lib/python3.7/site-packages/homeassistant/core.py”, line 1160, in _execute_service
await handler.func(service_call)
File “/usr/local/lib/python3.7/site-packages/homeassistant/helpers/entity_component.py”, line 188, in handle_service
self._platforms.values(), func, call, service_name
File “/usr/local/lib/python3.7/site-packages/homeassistant/helpers/service.py”, line 314, in entity_service_call
future.result() # pop exception if have
File “/usr/local/lib/python3.7/site-packages/homeassistant/helpers/service.py”, line 328, in _handle_service_platform_call
await getattr(entity, func)(**data)
File “/usr/local/lib/python3.7/concurrent/futures/thread.py”, line 57, in run
result = self.fn(*self.args, **self.kwargs)
File “/config/custom_components/meross/switch.py”, line 60, in turn_on
device.device.turn_on_channel(self.channel)
AttributeError: ‘GenericPlug’ object has no attribute ‘device’

I hope these data will be helpful and I am here for what you may need, thank you for sharing your work.

Hi csrp,
Many thanks for your log. It helps to improve the stability of the custom-component.
I warmly suggest you to keep updated here: https://github.com/vincenzosuraci/hassio_meross_sensor_switch

Download the files, upload them in Home Assistant (or Hassio), restart it and inform me in case of any error or issue. Best if you issue the problem directly on github, following the above provided link.

Regards,
Vincenzo

Thanks vincenzo.suraci,

I can confirm that everything works as it should with the modifications in hass 0.91.2 and 0.91.3

We will continue in contact, I will send you any incident, through the GitHub.

Good work! Working great for my MSS620!

1 Like
  • The meross_iot framework will be downloaded automatically.

Hi there,
when/how will the framework be downloaded? I´m getting an dependency Error when restarting Hassio, missing the meross_iot module:

Fri Apr 12 2019 21:15:40 GMT+0200 (Mitteleuropäische Sommerzeit)

Error loading custom_components.meross. Make sure all dependencies are installed

Traceback (most recent call last): File “/usr/local/lib/python3.7/site-packages/homeassistant/loader.py”, line 183, in _load_file module = importlib.import_module(path) File “/usr/local/lib/python3.7/importlib/init.py”, line 127, in import_module return _bootstrap._gcd_import(name[level:], package, level) File “<frozen importlib._bootstrap>”, line 1006, in _gcd_import File “<frozen importlib._bootstrap>”, line 983, in _find_and_load File “<frozen importlib._bootstrap>”, line 967, in _find_and_load_unlocked File “<frozen importlib._bootstrap>”, line 677, in _load_unlocked File “<frozen importlib._bootstrap_external>”, line 728, in exec_module File “<frozen importlib._bootstrap>”, line 219, in _call_with_frames_removed File “/config/custom_components/meross/init.py”, line 13, in <module> from meross_iot.supported_devices.exceptions.CommandTimeoutException import CommandTimeoutException ModuleNotFoundError: No module named ‘meross_iot’`

`

Hi all,

I have the similar issue that @AdmiralRaccoon, can anyone help…here are my log:

Log Details (ERROR)

Mon Apr 15 2019 10:56:08 GMT+0200 (hora de verano de Europa central)

Error loading custom_components.meross. Make sure all dependencies are installed

Traceback (most recent call last): File “/srv/homeassistant/lib/python3.5/site-packages/homeassistant/loader.py”, line 166, in _load_file module = importlib.import_module(path) File “/usr/lib/python3.5/importlib/init.py”, line 126, in import_module return _bootstrap._gcd_import(name[level:], package, level) File “<frozen importlib._bootstrap>”, line 986, in _gcd_import File “<frozen importlib._bootstrap>”, line 969, in _find_and_load File “<frozen importlib._bootstrap>”, line 958, in _find_and_load_unlocked File “<frozen importlib._bootstrap>”, line 673, in _load_unlocked File “<frozen importlib._bootstrap_external>”, line 673, in exec_module File “<frozen importlib._bootstrap>”, line 222, in _call_with_frames_removed File “/home/homeassistant/.homeassistant/custom_components/meross/init.py”, line 15, in <module> from meross_iot.api import MerossHttpClient ImportError: No module named ‘meross_iot’

Thanks in advance.

1 Like

I reply to myself…

I installed the meross_iot inside virtual environment because I have Hassbian with this command:

pip install meross_iot --upgrade

After that works perfect

Regards.

1 Like

I can confirm a new device that works MSS710

@vincenzo.suraci

Devices (UE)
MSS310
MSS425E
MSS425F
MSS710

1 Like