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.
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.
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.
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
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).
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.
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.
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’`
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’