Git Product home page Git Product logo

merossiot's People

Contributors

adrigonzalvez avatar albertogeniola avatar andym avatar consori avatar danonekid avatar davidb24v avatar davidepastore avatar dependabot[bot] avatar dhocker avatar impulsio avatar jerome-labidurie avatar matteodamico avatar ping-localhost avatar rhasselbaum avatar robertodormepoco avatar simonbeau avatar snowsky avatar soberstadt avatar tdippon avatar worxfr avatar wsmoses avatar yoannrigolle avatar yraghu avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

merossiot's Issues

question: Quick Power-Consumption query?

Hello,

i know it is very unusual, but do you know any way to get power consumption of one device via Meross protocol?

i used php and followed your wiki entries on http API, and now i have my device listed. But i just want to get the power consumption of it, nothing else or fancy. do you know if that is possible? how does the meross app does it? uses MQTT with the meross broker or do they have a simplified http-interface?

thank you!
best regards
Sebastian

MSS560 Dimmer Support....

Found your code referencing the control of MEROSS devices. I picked up a dimmer from amazon [hoping it was Tasmota compatible - alas no].
https://smile.amazon.com/gp/product/B07KM4P4Z1/ref=ppx_yo_dt_b_asin_title_o05_s00?ie=UTF8&psc=1

I ran your test code on the device and it did turn on and off. This is also a dimmer and seems to have a 'luminance': 60 parameter. Any chance of a small change to add a DIM ability to the device?

Here is my output from the device info....

Listing online devices...
- Kitchen Table (mss560m, 1 channels, HW 3.0.0, FW 3.1.5): Master=Off,

-------------------------------
Playing with device: Kitchen Table (mss560m, 1 channels, HW 3.0.0, FW 3.1.5): Master=Off,
-------------------------------

Getting system data...
{'all': {'digest': {'triggerx': [], 'togglex': [{'channel': 0, 'lmTime': 1555016413, 'onoff': 0}], 'timerx': [], 'light': {'luminance': 60, 'channel': 0, 'temperature': -1, 'rgb': -1, 'capacity': 4}}, 'system': {'hardware': {'uuid': '1812144891717229088234298f196791', 'chipType': 'mt7682', 'type': 'mss560m', 'version': '3.0.0', 'subType': 'us', 'macAddress': 'xx:xx:xx:xx:xx:xx'}, 'firmware': {'port': 2001, 'version': '3.1.5', 'server': 'iot.meross.com', 'compileTime': '2019/03/19 17:22:32 GMT +08:00', 'wifiMac': '60:38:e0:b5:5a:5b', 'userId': 200021, 'innerIp': '192.168.x.xxx'}, 'time': {'timestamp': 1555016654, 'timezone': 'America/New_York', 'timeRule': [[1552201200, -14400, 1], [1572760800, -18000, 0], [1583650800, -14400, 1], [1604210400, -18000, 0], [1615705200, -14400, 1], [1636264800, -18000, 0], [1647154800, -14400, 1], [1667714400, -18000, 0], [1678604400, -14400, 1], [1699164000, -18000, 0], [1710054000, -14400, 1], [1730613600, -18000, 0], [1741503600, -14400, 1], [1762063200, -18000, 0], [1772953200, -14400, 1], [1793512800, -18000, 0], [1805007600, -14400, 1], [1825567200, -18000, 0], [1836457200, -14400, 1], [1857016800, -18000, 0]]}, 'online': {'status': 1}}}}
The device supports 1 channels

Turning channel 0 on...
Unknown/Unsupported namespace/command: Appliance.Control.Light

Turning channel 0 off...

Thanks!

BTW - really looking forward to direct MQTT support...
-Stan

Making MerossIot work in Windows XP, support for Python 3.4

Hello.

First, thank you for the project, it has been useful to me :)
I don't know Python very well, but I needed your project to work on Windows XP, and the latest Python that works in XP is 3.4.

I just made this little change:
self._mqtt_client.tls_set(ca_certs=self._ca_cert, certfile=None, keyfile=None, cert_reqs=ssl.CERT_REQUIRED, tls_version=ssl.PROTOCOL_TLS, ciphers=None)
To this:
self._mqtt_client.tls_set(ca_certs=self._ca_cert, certfile=None, keyfile=None, cert_reqs=ssl.CERT_REQUIRED, ciphers=None)

I don't know what exactly does it affect. As I read in paho-mqtt documentation, seems that it will use the best TLS/SSL method available by default, so I think it will be ok like this.

Anyway, this makes it work with good old-fashioned Windows XP, and it comes in handy for a siren we are using to tell people to remember to punch in and out of work :)

Kind regards.
Pablo

Support event-based notification

It would be very useful to support callbacks/handlers when certain events occur. For instance, a developer might need to be notified when a device goes offline or when a particular switch is turned on/off.

Install on a raspberry

Hello,
I am very interested in this python script. How can I install it on raspberry?
I would like to read the power readings of the mss310 and pass it via python to my home control system.

thanks for your help in advance

Thomas

Meross MSS425E with Model Number sp425ew

Hello! I'm coming over here from the TerrariumPi github. I bought what was advertised to me as a Meross MSS425E but we couldn't seem to get it working. Come to find out the model reported is sp425ew. It looks and acts exactly like the MSS425E. Theyosh, the owner of TerrariumPi, did some looking into it. So I have some info to share here. I'm hoping you can get this supported?

https://user-images.githubusercontent.com/17450475/52535934-d11b9e00-2d5c-11e9-9305-3f5fcb44f037.png

{
"reservedDomain": "us-smart.meross.com",
"channels": [
{},
{
"type": "Switch",
"devIconId": "device001",
"devName": "Switch 1"
},
{
"type": "Switch",
"devIconId": "device001",
"devName": "Mistking"
},
{
"type": "Switch",
"devIconId": "device001",
"devName": "Lights"
},
{
"type": "USB",
"devIconId": "device001",
"devName": "USB"
}
],
"uuid": "1811133407490729086134298f1d4717",
"bindTime": 1552245253,
"onlineStatus": 1,
"skillNumber": "",
"fmwareVersion": "2.1.2",
"hdwareVersion": "2.0.0",
"domain": "us-iot.meross.com",
"region": "us",
"userDevIcon": "",
"deviceType": "sp425ew",
"iconType": 1,
"devIconId": "device020_us",
"subType": "us",
"devName": "Tokay Tank"
}
]

I know you don't have the device so I don't mind sharing my credentials for the device if you'd like to test on it.

MTS100H planned?

Hey, I just found the WLAN thermostat and this repository and your work is already very awesome! Thanks for that!

Do you plan to support the MTS100H, too?

typo in the doc?

The pip package name seems to be meross-iot and not meross_iot

CommandTimeoutException in 0.3.X.X version

Version 3 of your api does not work for me. When I am trying to use version 3 of your api , The following error occurs when trying to command or get the status of any device I own.
The devices I own are mss110 and the dimmer switch (MSS560).

Unknown event!
Unknown event!
Unknown event!
Device online status changed: Family Lights went online
Device online status changed: Living Lights went online
Device online status changed: V2 Extra 2 went online
Device online status changed: V1 Extra 1 went online
Device online status changed: Bedroom Lamp went online
Device online status changed: UV Light went online
Traceback (most recent call last):
  File "./test.py", line 54, in <module>
    bed.get_status()
  File "~/git/MerossIot/meross_iot/cloud/devices/power_plugs.py", line 117, in get_status
    self._state = self._get_status_impl()
  File "~/git/MerossIot/meross_iot/cloud/devices/power_plugs.py", line 78, in _get_status_impl
    data = self.get_sys_data()['all']
  File "~/git/MerossIot/meross_iot/cloud/device.py", line 129, in get_sys_data
    return self.execute_command("GET", ALL, {})
  File "~/git/MerossIot/meross_iot/cloud/device.py", line 126, in execute_command
    return self.__cloud_client.execute_cmd(self.uuid, command, namespace, payload, callback=callback, timeout=timeout)
  File "~/git/MerossIot/meross_iot/cloud/client.py", line 300, in execute_cmd
    raise CommandTimeoutException("A timeout occurred while waiting fot the ACK: %d" % timeout)
meross_iot.cloud.exceptions.CommandTimeoutException.CommandTimeoutException: A timeout occurred while waiting fot the ACK: 10

I'm not sure why this is happening as version 2 seems to be working fine (Although for me, version 2 stops working after a day of running which is why I want to test version 3)

The test script is essentially doing this:

# Initiates the Meross Cloud Manager. This is in charge of handling the communication with the remote endpoint
    manager = MerossManager(meross_email=username, meross_password=password)

    # Register event handlers for the manager...
    manager.register_event_handler(event_handler)

    # Starts the manager
    manager.start()

    # You can retrieve the device you are looking for in various ways:
    # By kind
    devs = manager.get_supported_devices()
    devs[0].get_status()

It happens on the .get_status(), .turn_on(), .turn_off() commands.

Power/current/voltage value

Hi,

FIrst of all really nice API! :) I just have 2 questions:

1 - If P=V*I why is the multiplication of the voltage and current not the power value?
2 - How many queries can i make per minute? Is there a refresh delay between each querie?

Thanks

Add support for mss425e

Ciao,

will it be possible to add support for MSS425e (power stripe?) (3 channels plus 1 for USB)
I can see mine in the httpHandler.list_devices() but not in the .list_supported_devices(), so it could not be possible to switches

the list_devices() returns:

[{'uuid': 'XXXXXXXXXXXXXX', 'onlineStatus': 1, 'devName': 'TV Camera', 'devIconId': 'device020_eu', 'bindTime': 1543002236, 'deviceType': 'mss425e', 'subType': 'eu', 'channels': [{}, {'type': 'Switch', 'devName': 'Switch 1', 'devIconId': 'device001'}, {'type': 'Switch', 'devName': 'Switch 2', 'devIconId': 'device001'}, {'type': 'Switch', 'devName': 'Switch 3', 'devIconId': 'device001'}, {'type': 'USB', 'devName': 'USB', 'devIconId': 'device001'}], 'region': 'eu', 'fmwareVersion': '2.1.3', 'hdwareVersion': '2.0.0', 'userDevIcon': '', 'iconType': 1, 'domain': 'eu-iot.meross.com', 'reservedDomain': 'eu-smart.meross.com'}]
Thanks
ciao
M

ERROR trying to Use

Could you Help Please?

import os
import time
import unittest
from meross_iot.manager import MerossManager

EMAIL = os.environ.get('MEROSS_EMAIL')
PASSWORD = os.environ.get('MEROSS_PASSWORD')

class TestMSS210Test(unittest.TestCase):
def setUp(self):
self.manager = MerossManager(meross_email=EMAIL, meross_password=PASSWORD)
self.manager.start()

    # Retrieves the list of supported devices
    devices = self.manager.get_devices_by_type('mss210')
    if len(devices) > 0:
        self.device = devices[0]
    else:
        raise Exception("Could not find device ms210")

And I get:

from meross_iot.manager import MerossManager
ImportError: No module named meross_iot.manager

Maybe i have to install in a specific folder ??
Thanks

Disconnecting and reconnecting a physical device

Dear Alberto,
during some tests, if I try to disconnect a physical device from the power plug and then, after several minutes, riconnect it, I get the following log:

Current client connection status is: ClientStatus.CONNECTION_DROPPED
The client needs to connect to the MQTT broker. Attempting it now...
Initializing the MQTT connection...
Unknown/Unsupported namespace/command: Appliance.System.Online
2019-04-27 09:58:52 ERROR (Thread-10) [meross_protocol] Unknown/Unsupported namespace/command: Appliance.System.Online
Unknown/Unsupported namespace/command: Appliance.System.Report
2019-04-27 09:58:52 ERROR (Thread-10) [meross_protocol] Unknown/Unsupported namespace/command: Appliance.System.Report

After these errors, the whole system stop working (I need to investigate better where it get stacked). I'm trying to make the custom-component resilient to a variety of possibile situations (included the possibility that a power plug is removed and then inserted again).

I opened a new issue, but it is up to you to decide where to move it.

VS

Features request: "list_supported_device_info()" and "get_device(device_info)"

Dear Alberto,
I'm using your priceless library to interact with the Meross devices in a 24/7 fashion. Right now the rationale is:

  1. every X minutes I call the list_supported_devices() method of MerossHttpClient class to see if new Meross devices are online of if some (previously discovered) Meross devices went offline;
  2. every Y seconds I call the get_channel_status(channel) and supports_electricity_reading() methods of GenericPlug class to check the switch status and (if availlable) the electricity sensors values.

Calling periodically the list_supported_devices() method, makes disconnect all the previously created devices (that are instances of GenericPlug class).

The only way to discover the list of available Meross devices, without affecting the already active ones, would be to call the list_devices() method, that returns a dictionary and allows to get the device_id from the uuid key. However, once I have the device_id, if it is a new Meross device, I still need to call the build_wrapper(self._token, self._key, self._userid, deviceType, dev) method.

From this need, I was wondering if the following methods could be added to the MerossHttpClient class:

  1. list_supported_device_info() method that output a dict with a list key-value pairs where key is the device_id (uuid) and the value is a dict with the device info (uuid, onLineStatus, devName, etc.);
  2. get_device(device_info) method that, given a device_info (a dict with uuid, onLineStatus, devName, etc.), builds an instance of GenericPlug class.

The suggested code could be something like this:

    def list_supported_devices_info(self, online_only=True):
    supported_devices_info = {}
    for dev in self.list_devices():
        device_id = dev['uuid']
        online = dev['onlineStatus']

        if online_only and online != 1:
            # The device is not online, so we skip it.
            continue
        else:
            supported_devices_info[device_id] = dev
    return supported_devices_info

    def get_device(self, device_info):
        deviceType = device_info['deviceType']
        online = device_info['onlineStatus']
        if online_only and online != 1:
            return None
        return build_wrapper(self._token, self._key, self._userid, deviceType, device_info)

ImportError: cannot import name 'auto'

After install (pip3 install meross_iot --upgrade as pip install doesn't works) trying to use your script I receive always this error:

Traceback (most recent call last):
File "meross.py", line 3, in
from meross_iot.api import MerossHttpClient
File "/home/domoticz/.local/lib/python3.5/site-packages/meross_iot/api.py", line 8, in
from meross_iot.device_factory import build_wrapper
File "/home/domoticz/.local/lib/python3.5/site-packages/meross_iot/device_factory.py", line 1, in
from meross_iot.supported_devices.power_plugs import Mss310, Mss110, Mss425e
File "/home/domoticz/.local/lib/python3.5/site-packages/meross_iot/supported_devices/power_plugs.py", line 13, in
from enum import Enum, auto
ImportError: cannot import name 'auto'

Thank for your help

I`ve a problem with this

Traceback (most recent call last):
File "/home/pi/.local/lib/python3.7/site-packages/meross_iot/meross.py", line 36, in
manager = MerossManager(meross_email=EMAIL, meross_password=PASSWORD)
File "/home/pi/.local/lib/python3.7/site-packages/meross_iot/manager.py", line 36, in init
self._cloud_creds = self._http_client.get_cloud_credentials()
File "/home/pi/.local/lib/python3.7/site-packages/meross_iot/api.py", line 123, in get_cloud_credentials
raise UnauthorizedException()
meross_iot.api.UnauthorizedException

Docker Container to retrieve power stats from Meross and send to influxdb

Hey @albertogeniola ,

Using your work I created this docker image to retrieve the power values from Meross cloud and send those to InfluxDB database. I originally created it for personal usage but I have cleaned up the code and posted it here https://github.com/nebula-it/MerossToInfluxDB thinking there might be other looking for this.

See if you want to make a note of this somewhere so people are aware. And Thank you again for your awesome work on this library.

Update PIP entry?

Thanks for accepting my suggested changes! To have access to them via a dependency, a new version must be submitted to pip. Would you be able to do that?

Brightness functionality for MSL120

Dear, Albert

Thank you so much for this amazing library, I am a complete beginner to hacking and i had tried to packet sniff and figure out how to inject packets into the bulb for so long. '

Anyways, I was wondering if there is a way to lower brightness with the current library? I know that in the app you can lower brightness and I've seen other hacked bulbs that have brightness as another argument for the packet injection. Is that the case with yours?

Thank you for the library!

MSG100 not working

It does not appear the MSG100 (Meross Garage Door Opener) works with the library. Here is the output:

18120167058930261h0134298f13c495 failed to process message because: Unknown/Unsupported namespace/command: Appliance.System.Online
18120167058930261h0134298f13c495 failed to process message because: Unknown/Unsupported namespace/command: Appliance.System.Report
18120167058930261h0134298f13c495 failed to process message because: Unknown/Unsupported namespace/command: Appliance.GarageDoor.State

new other device planned

Hello albertogeniola,

Do you plan to support the following devices MSS510H and MSL420?

The work you already done help me a lot to understand how the API is working, even if the provider did not documented it.
I have those devices if i can help.

Make the library lightweight

The current implementation of the library works by establishing an MQTT connection to the Meross Cloud for each device that is reported "online" via the HTTP web-API. This is not optimal because
when the user has many devices, we are wasting a lot of resources. In fact, we could be using a single MQTT connection to the meross MQTT broker, listen for events on the devices and update their status accordingly.

Such refactor is needed in order to make the library more robust and lightweight, but it might possibly break current interface. Let's try to think a smart way to keep the current interface with the new implementation!

Sign check failed

This is the response iot.meross.com returns me when sending the login requests as you posted in the wiki:

{
"apiStatus": 1023,
"sysStatus": 0,
"info": "Sign check failed",
"timeStamp": "2019-01-06 19:32:05"
}

Adattamento a mss310h

Ciao.
Mi sto studiando il codice perchè voglio adattarlo a mss310h (che immagino non sia molto differente da un mss310).

Il reverse enginering che hai fatto è interessante.
Tuttavia visto che i pacchetti viaggiano in ssl io non riesco a replicarlo.

Ma veniamo al problema.
A me si blocca quando sulla request di poweron/off, mentre funziona la list device e get data.

Quello che succede è che la prima volta che il codice esegue _execute_cmd() con parametri GET,Appliance.System.All, questa funziona, si arriva fino a on_message() e la _execute_cmd() termina.

Quando lancia _execute_cmd() con parametri SET,Appliance.Control.Toggle invece il codice rimante appeso su self._waiting_message_ack_queue.wait() in attesa che il server mqtt risponda.

il netstat fa vedere che la connessione su porta 2001 è in established (mentre quella su 443 viene chiusa), e da tcpdump sembra che un po' di traffico c'è, tuttavia potrebbe essere anche un keepalive, visto che è in ssl

il messaggio mqtt inviato è questo
--> {"header": {"from": "/app/........./subscribe", "messageId": ".........", "method": "SET", "namespace": "Appliance.Control.Toggle", "payloadVersion": 1, "sign": ".......", "timestamp": 1539552062}, "payload": {"channel": 0, "toggle": {"onoff": 1}}}
e la presa non si accende

ora può essere che la mss310h non sia perfettamente compatibile con la mss310 (fisicamente differisce dalla connessione che è in formato italiano con i 3 buchi verticali invece che formato siemens).
Ma mi aspettavo almeno un fallimento, un messaggio di risposta che il codice potrebbe o meno interpretare, ma comunque una risposta.

Hai qualche suggerimento da darmi per il troubleshooting? (soprattutto relativamente al fatto che la connessione è in ssl e non credo che un men-in-the-middle funzioni a dovere, e quindi non credo sia la strada giusta).

grazie
Matteo

Error on get_status()

Hello,
when i call get_status() i have the following error:

File "/config/deps/lib/python3.6/site-packages/meross_iot/supported_devices/power_plugs.py", line 326, in get_status
self._status = self.get_sys_data()['all']['control']['toggle']['onoff'] == 1
KeyError: 'control'

Meross Password is special characters fails

Hi,

I was trying the test example to ensure that the lib was working, and I had to change my password because it had special characters that was returning meross_iot.api.UnauthorizedException error.

Password had $ | ! symbols, not sure which one was causing the issues.

Traceback (most recent call last):
  File "test.py", line 27, in <module>
    manager = MerossManager(meross_email=EMAIL, meross_password=PASSWORD)
  File "/usr/local/lib/python3.7/site-packages/meross_iot/manager.py", line 36, in __init__
    self._cloud_creds = self._http_client.get_cloud_credentials()
  File "/usr/local/lib/python3.7/site-packages/meross_iot/api.py", line 123, in get_cloud_credentials
    raise UnauthorizedException()
meross_iot.api.UnauthorizedException

Arduino MKR1010 Wifi with Smart Wifi Plug MSS210

Hello everyone, hello and thx @albertogeniola for your sharing,

I'm a beginner regarding Arduino and connected devices but in order to acquire new skill/knowledge I just challenged myself to make a communication between a connected device, the Smart Wifi Plug MSS210 from Meross and an Arduino Board, the MKR1010 Wifi.

My goal is just to switch off/on the connected device MSS210 using MKR1010 Arduino Board, using MQTT protocol.

Nowadays, what I know is that I need MQTT protocol to communicate with the MSS210 plug.

I am actually using the application on my smartphone. I apaired the plug to my wifi access point from my android smartphone. I tried to monitor every ethernet/tcp/ip frames coming through the network but I recorded NOTHING with wireshark. Then after some researchs, I finaly found that the plug was using MQTT protocol. So, what I know is that when I use my android app to switch on/off the plug, it sends, though my 4G+ connection, a MQTT frame through a "topic" to a "broker" that then sends an other frame to my plug, though my Wifi connection.

ANDROID ---4G+--->BROKER.MEROSS----WIFI.access.point---->PLUG

Wireshark is not enough to monitore MQTT frames so I am searching for a little program on windows10 to monitor the network and if I can capture some frame when i switch on/off the plug...

My idea is just to capture a frame and copy/past it and send it to the plug with the arduino...

Or using Arduino to connect to the MQTT server in order to send a frame with username/PSW (for auth) and... i don't know... im still working on it to find a solution...

But i'am open to proposals guys :) some idea to go forward... thx you in advance !!

PS: sorry for my bad english, i'm working on it too ><

  • isoSeL

Interested in PIP

I'm trying to integrate my Meross devices into Home Assistant and it would be sweet to have this in the pip registry. Either way, I was able to get this working with my 110, so you've already helped out a lot! Thanks for sharing this!

Keep manager open?

I'm trying to set up a server that will listen for status changes on my Meross devices. I had assumed that I could just use:

# Initiates the Meross Cloud Manager. This is in charge of handling the communication with the remote endpoint
    manager = MerossManager(meross_email=EMAIL, meross_password=PASSWORD)

    # Register event handlers for the manager...
    manager.register_event_handler(event_handler)

    # Starts the manager
    manager.start()

And that would keep the connection open, but when I run this script it exits. Sorry if this is a really dumb question, but what am I doing wrong?

Unable To Control MSS310

While I can control my MSS425e, I can't switch on or of my MSS310, it just hangs when sending the python script

#!/usr/local/bin/env python3.6
from sys import argv
from meross_iot.api import MerossHttpClient
mDev = int(argv[1])
mVal = int(argv[2]) # 0 = Off / 1 = On
print("parameter:" + argv[1] + " / " + argv[2])
mConnect = MerossHttpClient(email="myemail", password="myemail")
mDevices = mConnect.list_supported_devices()
print("Turn On")
mDevices[mDev].turn_on()

I'm passing the deviceID as argv1 and currently ignoring argv2

it works with MSS620

Smart Outdoor Plug (mss620, 3 channels, HW 2.0.0, FW 2.1.5): Master=Off, Switch=Off, Switch=Off,

'hardware': {'type': 'mss620', 'subType': 'us', 'version': '2.0.0', 'chipType': 'mt7682', 'uuid': '1901083627296529089534298f1bc394', 'macAddress': '34:29:8f:1b:c3:94'}

Can't turn on/off

Hello,

I've managed to get readings from the plugs but when turning on/off it indicates this :

{"channel": 0, "toggle": {"onoff": 0}}}
Disconnection detected. Reason: 1
Disconnection detected. Reason: 1
^CTraceback (most recent call last):
 File "mss310off.py", line 13, in <module>
   devices[0].turn_off()
 File "/usr/local/lib/python3.6/site-packages/meross_iot/supported_devices/power_plugs.py", line 274, in turn_off
   return self._execute_cmd("SET", "Appliance.Control.Toggle", payload)
 File "/usr/local/lib/python3.6/site-packages/meross_iot/supported_devices/power_plugs.py", line 255, in _execute_cmd
   self._waiting_message_ack_queue.wait()
 File "/usr/local/lib/python3.6/threading.py", line 295, in wait
   waiter.acquire()

Do you have any idea ?

Thanks for this lib !

[Firewall router rules] - Unable to reach my MSS310

Hello,
I have two Meross MSS310, and when I configure my router to use the internal firewall with medium security level, the Meross android app cannot locate those Smart Devices (also into the local wifi access).

This is the explanation of the medium security level:
The Firewall in the medium mode only allows the use of web browsing and e-mail. Input, the IPv4 connections are regulated by sections DMZ and Port Mapping, IPv6 connections are limited only to responses initiated services from within.

I've tried to use DMZ setting the local IP address of the MSS310 without success; I've tried to configured some port in the port mapping but nothing (ports 80 and 2001 in tcp and udp connection).

Anyone that know how setup my Meross product with the firewall rule enabled in the router ? I use Fastweb ITA with the last FASTGate modem.

Thanks a lot
Valerio

Installing on RPI

Just install python 3 and then issue the following command:

pip install meross-iot --upgrade

BR

Originally posted by @albertogeniola in #2 (comment)

This doesnt work, gives output

Could not find a version that satisfies the requirement meross-iot (from versions: )
No matching distribution found for meross-iot

I am using a RPI3B+ on raspbian. I have installed python 3.

Diconnect issue with test script

When i run your test script i get

Disconnection detected. Reason: 1

after it list th first device. The device is a mss425e with no other devices in the cloud.
short bevor i get a

UNKNOWN msg received by deviceID

Offline-ONLY support

Hi there,

as far as I can tell this just connects to the manufactures server. Is it possible to use this in an offline scenario?
I really dont want my plugs to talk to some foreign servers...

Thank you in advance!
~Spatium

_key for MD5 hash

Hey @albertogeniola ,

Thank you for the great work on this. I'm trying to make MSS310 work completely offline. I have it connected to local MQTT server (just using DNS entries for iot.meross.com and smart.meross.com to point to local MQTT). It is publishing the on/off event fine and also power usage couple seconds after initial power up. However I'm unable to publish to MQTT message and get it to turn off. Using the message that MSS310 publishes and from your code I was able to get this message pushed out
{"header":{"messageId":"88443c82123374189dd3e2ba0a9085ea","namespace":"Appliance.Control.Toggle","method":"PUSH","payloadVersion":1,"from":"/appliance/UUID/publish","timestamp":1556084917,"timestampMs":830,"sign":"xxx"},"payload":{"toggle":{"onoff":1,"lmTime":1556084916}}}

However I could not find a way to create the sign value, in your code it's coming from _key variable but I was not able to find any details on it. I'm not really a programmer so doing this in node-red. Can you please guide me on how to create the sign (what values are used for input of md5 hash). Also, if possible can you please review the above message and see if it seems to be the right one being published to the official app to Meross MQTT server e.g. is the method correct?
Thank you beforehand.

device.get_sys_data() hangs if the corresponding smartplug isn't connected

I have several smartplug (6), if I unplug one from the electric network, this plug is listed by
devices = httpHandler.list_supported_devices()

but the following command hangs without timeout :
data = device.get_sys_data()

Other commands like :
abilities = device.get_abilities()
trace = device.get_trace()
debug = device.get_debug()
hangs too.

Molto interessante (very interesting)

Grazie per il tuo lavoro. Sto sviluppando il mio sistema di smart home utilizzando Home Assistant quale software di controllo. Purtroppo non c'è nessun plugin che supporti le prese Meross (io ho sia le MSS310 che la MSS425E) e guardando un po' in giro ho trovato il tuo progetto. Purtroppo non sono molto ferrato in Python, pertanto mi chiedevo se avessi tu voglia di sviluppare un plugin per Home Assistant.

Thanks for your work. I'm developing my smart home with Home Assistant software. There is no plugin for Meross switches, but I've found your project in GitHub. I'm not a python programmer, so I wish you'd like to develop a Meross plugin for Home Assistant.

Error trying to use it on Python 2.7

Hello
got this error:

import time
import sys
from meross_cloud import MerossHttpClient
Traceback (most recent call last):
File "", line 1, in
File "meross_cloud.py", line 9, in
from device_factory import build_wrapper
File "device_factory.py", line 1, in
from supported_devices.power_plugs import Mss310

ImportError: No module named supported_devices.power_plugs

May you help?
thank you

Can't turn on/off my MSS310

I'm using the example code under "Usage" section in the README, but I'm not able to turn on/off my MSS310.
Script is looping as you can see in the image below:
a

SSL certificate verify failed

I used a subset of the small example script that you provided in the README.md.
But when executing (env variables are set properly), I get the following error:

Traceback (most recent call last):
  File "bin/test.py", line 19, in <module>
    manager.start()
  File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/meross_iot/manager.py", line 45, in start
    self._cloud_client.connect()
  File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/meross_iot/cloud/client.py", line 167, in connect
    self._mqtt_client.connect(self._domain, self._port, keepalive=30)
  File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/paho/mqtt/client.py", line 839, in connect
    return self.reconnect()
  File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/paho/mqtt/client.py", line 994, in reconnect
    sock.do_handshake()
  File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/ssl.py", line 1061, in do_handshake
    self._sslobj.do_handshake()
  File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/ssl.py", line 683, in do_handshake
    self._sslobj.do_handshake()
ssl.SSLError: [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed (_ssl.c:749)

Any ideas?

My script:

#!/usr/bin/env python3.6

from meross_iot.manager import MerossManager
from meross_iot.meross_event import MerossEventType
from meross_iot.cloud.devices.light_bulbs import GenericBulb
from meross_iot.cloud.devices.power_plugs import GenericPlug
from meross_iot.cloud.devices.door_openers import GenericGarageDoorOpener
import time
import os

EMAIL = os.environ.get('MEROSS_EMAIL') or "YOUR_MEROSS_CLOUD_EMAIL"
PASSWORD = os.environ.get('MEROSS_PASSWORD') or "YOUR_MEROSS_CLOUD_PASSWORD"

if __name__=='__main__':
    # Initiates the Meross Cloud Manager. This is in charge of handling the communication with the remote endpoint
    manager = MerossManager(meross_email=EMAIL, meross_password=PASSWORD)

    # Starts the manager
    manager.start()

    # You can retrieve the device you are looking for in various ways:
    # By kind
    bulbs = manager.get_devices_by_kind(GenericBulb)
    plugs = manager.get_devices_by_kind(GenericPlug)
    door_openers = manager.get_devices_by_kind(GenericGarageDoorOpener)
    all_devices = manager.get_supported_devices()

    # Print some basic specs about the discovered devices
    print("All the bulbs I found:")
    for b in bulbs:
        print(b)

    print("All the plugs I found:")
    for p in plugs:
        print(p)

    print("All the garage openers I found:")
    for g in door_openers:
        print(g)

    print("All the supported devices I found:")
    for d in all_devices:
        print(d)

    # At this point, we are all done playing with the library, so we gracefully disconnect and clean resources.
    print("We are done playing. Cleaning resources...")
    manager.stop()

    print("Bye bye!")

MSS310H is not supported?

Hi, I own a Meross MSS310H (hardware version 2) and was trying your library to get consumption data and switch on and off the plug from my Linux NAS.

I've tried on a Ubuntu VM to install Python 3 and your library but when I run the script on the README file I do not get any device:

user@ubuntu:~/meross$ python3 meross.py
Listing Devices...

So I tried to edit the /usr/local/lib/python3.4/dist-packages/meross_iot/api.py file to uncomment line 73 (instruction print(jsondata)) and this is the output I get:

user@ubuntu:~/meross$ python3 meross.py
Listing Devices...
{'info': 'Success', 'apiStatus': 0, 'data': {'userid': '170119', 'token': '**cut**', 'key': '**cut**', 'email': '**cut**'}, 'timeStamp': 1550308953, 'sysStatus': 0}
{'info': 'Success', 'apiStatus': 0, 'data': None, 'timeStamp': '2019-02-16 17:22:34', 'sysStatus': 0}
{'info': 'Success', 'apiStatus': 0, 'data': [{'channels': [{}], 'userDevIcon': '', 'devIconId': 'device031_it', 'deviceType': 'mss310h', 'hdwareVersion': '2.0.0', 'bindTime': 1549389138, 'region': 'eu', 'uuid': '2912265024316329086934298f186e3d', 'iconType': 1, 'domain': 'eu-iot.meross.com', 'subType': 'it', 'fmwareVersion': '2.1.6', 'skillNumber': '', 'reservedDomain': 'eu-smart.meross.com', 'onlineStatus': 1, 'devName': 'Socket'}], 'timeStamp': 1550308954, 'sysStatus': 0}

AFAIK this confirms that the data is correctly pulled from the Meross servers, just the library has to be adapted to support it. Do you think it will be possible?

Slow switch on/off events

I was quickly looking at the source code regarding the switch on/off events, and I guess this issue can't be fixed. However, I'm asking you about that, should you find any way.
Is there any way to speed up those events? They take roughly one second to be called back, and it's not good for some applications.
Thanks for the support and for having developed such a useful library

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.