Giter Site home page Giter Site logo

Comments (5)

albertogeniola avatar albertogeniola commented on July 25, 2024

Hi Stan,
That device is unfortunately not tested against the library, but it does not seem to be so complicated. As soon as I get my hands on one of those, I will implement the dimmer function. It's just a matter of time.

In the meanwhile, would you please post the output of the following script?

from meross_iot.api import MerossHttpClient
from meross_iot.supported_devices.power_plugs import set_debug_level
from logging import DEBUG
import csv, io

EMAIL = 'YOUR_EMAIL'
PASSWORD = 'YOUR_PASSWORD'

client = MerossHttpClient(email=EMAIL, password=PASSWORD)
devices = client.list_supported_devices()


def sanitize_personal_info(d):
    if isinstance(d, dict):
        for key, value in d.items():
            k = key.lower()

            if isinstance(value, dict):
                sanitize_personal_info(value)
            elif isinstance(value, str) and (k == 'uuid' or k=='macaddress' or k == 'wifimac' or k == 'userid' or k=='bssid' or k =='ssid'):
                d[key] = 'X'
    elif isinstance(d, list):
        for k in d:
            sanitize_personal_info(k)

    return d


if __name__ == '__main__':
    set_debug_level(DEBUG)
    output = io.StringIO()
    writer = csv.writer(output, delimiter=';')

    for d in devices:
        r = []
        r.append(d._type)
        r.append(d._hwversion)
        r.append(d._fwversion)
        r.append(sanitize_personal_info(d.get_sys_data()))
        r.append(sanitize_personal_info(d.get_channels()))

        abilities = d.get_abilities()
        r.append(sanitize_personal_info(abilities))
        r.append(sanitize_personal_info(d.get_channels()))

        writer.writerow(r)

    print("\n\n---------------------------------------")
    print(str(output.getvalue()))

Be aware that you need to update the library to the latest version (0.2.0.1) and to fill in your EMAIL and PASSWORD in the relative script variables. Also, before posting the output of the script, make sure you clean any MAC address/User-Id/Signature.

from merossiot.

shodge12 avatar shodge12 commented on July 25, 2024

Sorry, I was out for a few days... I am tempted to try to reflect this to my mosquito server as I have seen a few others try....
Here is the output of the above:

--> {"payload": {}, "header": {"from": "/app/200021-57e25ec3ab97a7277eb2fe0068098228/subscribe", "sign": "XXXX", "messageId": "268ac24576575c8d74617ba9a9f9ffeb", "payloadVersion": 1, "namespace": "Appliance.System.All", "timestamp": 1555555720, "method": "GET"}}
/app/200021-57e25ec3ab97a7277eb2fe0068098228/subscribe --> b'{"header":{"messageId":"268ac24576575c8d74617ba9a9f9ffeb","namespace":"Appliance.System.All","method":"GETACK","payloadVersion":1,"from":"/appliance/1812144891717229088234298f196791/publish","timestamp":1555555719,"timestampMs":873,"sign":"XXXX"},"payload":{"all":{"system":{"hardware":{"type":"mss560m","subType":"us","version":"3.0.0","chipType":"mt7682","uuid":"1812144891717229088234298f196791","macAddress":"XXXX"},"firmware":{"version":"3.1.5","compileTime":"2019/03/19 17:22:32 GMT +08:00","wifiMac":"XXXX","innerIp":"192.168.0.0","server":"iot.meross.com","port":2001,"userId":200021},"time":{"timestamp":1555555719,"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}},"digest":{"togglex":[{"channel":0,"onoff":0,"lmTime":1555206805}],"triggerx":[],"timerx":[],"light":{"capacity":4,"channel":0,"rgb":-1,"temperature":-1,"luminance":60}}}}}'
The following message was unhandled: {'payload': {'all': {'digest': {'triggerx': [], 'timerx': [], 'light': {'rgb': -1, 'temperature': -1, 'channel': 0, 'luminance': 60, 'capacity': 4}, 'togglex': [{'onoff': 0, 'lmTime': 1555206805, 'channel': 0}]}, 'system': {'online': {'status': 1}, 'hardware': {'version': '3.0.0', 'subType': 'us', 'macAddress': 'XXXX', 'chipType': 'mt7682', 'type': 'mss560m', 'uuid': '1812144891717229088234298f196791'}, 'time': {'timestamp': 1555555719, '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]]}, 'firmware': {'version': '3.1.5', 'port': 2001, 'compileTime': '2019/03/19 17:22:32 GMT +08:00', 'server': 'iot.meross.com', 'userId': 200021, 'innerIp': '192.168.0.0', 'wifiMac': 'XXXX'}}}}, 'header': {'sign': 'XXXX', 'from': '/appliance/1812144891717229088234298f196791/publish', 'timestampMs': 873, 'messageId': '268ac24576575c8d74617ba9a9f9ffeb', 'payloadVersion': 1, 'namespace': 'Appliance.System.All', 'timestamp': 1555555719, 'method': 'GETACK'}}
--> {"payload": {}, "header": {"from": "/app/200021-57e25ec3ab97a7277eb2fe0068098228/subscribe", "sign": "XXXX", "messageId": "cb78cd695dae95a7a685d2ba6de61edb", "payloadVersion": 1, "namespace": "Appliance.System.Ability", "timestamp": 1555555721, "method": "GET"}}
/app/200021-57e25ec3ab97a7277eb2fe0068098228/subscribe --> b'{"header":{"messageId":"cb78cd695dae95a7a685d2ba6de61edb","namespace":"Appliance.System.Ability","method":"GETACK","payloadVersion":1,"from":"/appliance/1812144891717229088234298f196791/publish","timestamp":1555555720,"timestampMs":99,"sign":"XXXX"},"payload":{"payloadVersion":1,"ability":{"Appliance.Config.Key":{},"Appliance.Config.WifiList":{},"Appliance.Config.Wifi":{},"Appliance.Config.Trace":{},"Appliance.Config.Calibration":{},"Appliance.System.All":{},"Appliance.System.Hardware":{},"Appliance.System.Firmware":{},"Appliance.System.Debug":{},"Appliance.System.Online":{},"Appliance.System.Time":{},"Appliance.System.Ability":{},"Appliance.System.Runtime":{},"Appliance.System.Report":{},"Appliance.System.Position":{},"Appliance.Control.Multiple":{"maxCmdNum":5},"Appliance.Control.ToggleX":{},"Appliance.Control.TimerX":{"sunOffsetSupport":1},"Appliance.Control.TriggerX":{},"Appliance.Control.Bind":{},"Appliance.Control.Unbind":{},"Appliance.Control.Upgrade":{},"Appliance.Control.Light":{"capacity":4},"Appliance.Digest.TriggerX":{},"Appliance.Digest.TimerX":{}}}}'
The following message was unhandled: {'payload': {'payloadVersion': 1, 'ability': {'Appliance.Control.Bind': {}, 'Appliance.Control.TriggerX': {}, 'Appliance.System.Runtime': {}, 'Appliance.Control.Unbind': {}, 'Appliance.Config.Calibration': {}, 'Appliance.Config.Wifi': {}, 'Appliance.System.Online': {}, 'Appliance.Config.WifiList': {}, 'Appliance.System.Report': {}, 'Appliance.System.Ability': {}, 'Appliance.Control.TimerX': {'sunOffsetSupport': 1}, 'Appliance.Digest.TimerX': {}, 'Appliance.Digest.TriggerX': {}, 'Appliance.Control.Light': {'capacity': 4}, 'Appliance.Control.Multiple': {'maxCmdNum': 5}, 'Appliance.System.All': {}, 'Appliance.Config.Trace': {}, 'Appliance.System.Hardware': {}, 'Appliance.System.Time': {}, 'Appliance.System.Position': {}, 'Appliance.System.Firmware': {}, 'Appliance.System.Debug': {}, 'Appliance.Config.Key': {}, 'Appliance.Control.ToggleX': {}, 'Appliance.Control.Upgrade': {}}}, 'header': {'sign': 'XXXX', 'from': '/appliance/1812144891717229088234298f196791/publish', 'timestampMs': 99, 'messageId': 'cb78cd695dae95a7a685d2ba6de61edb', 'payloadVersion': 1, 'namespace': 'Appliance.System.Ability', 'timestamp': 1555555720, 'method': 'GETACK'}}


mss560m;3.0.0;3.1.5;{'all': {'digest': {'triggerx': [], 'timerx': [], 'light': {'rgb': -1, 'temperature': -1, 'channel': 0, 'luminance': 60, 'capacity': 4}, 'togglex': [{'onoff': 0, 'lmTime': 1555206805, 'channel': 0}]}, 'system': {'online': {'status': 1}, 'hardware': {'version': '3.0.0', 'subType': 'us', 'macAddress': 'X', 'chipType': 'mt7682', 'type': 'mss560m', 'uuid': 'X'}, 'time': {'timestamp': 1555555719, '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]]}, 'firmware': {'version': '3.1.5', 'port': 2001, 'compileTime': '2019/03/19 17:22:32 GMT +08:00', 'server': 'iot.meross.com', 'userId': 200021, 'innerIp': '192.168.0.0', 'wifiMac': 'X'}}}};[{}];{'Appliance.Control.Bind': {}, 'Appliance.Control.TriggerX': {}, 'Appliance.System.Runtime': {}, 'Appliance.Control.Unbind': {}, 'Appliance.Config.Calibration': {}, 'Appliance.Config.Wifi': {}, 'Appliance.System.Online': {}, 'Appliance.Config.WifiList': {}, 'Appliance.System.Report': {}, 'Appliance.System.Ability': {}, 'Appliance.Control.TimerX': {'sunOffsetSupport': 1}, 'Appliance.Digest.TimerX': {}, 'Appliance.Digest.TriggerX': {}, 'Appliance.Control.Light': {'capacity': 4}, 'Appliance.Control.Multiple': {'maxCmdNum': 5}, 'Appliance.System.All': {}, 'Appliance.Config.Trace': {}, 'Appliance.System.Hardware': {}, 'Appliance.System.Time': {}, 'Appliance.System.Position': {}, 'Appliance.System.Firmware': {}, 'Appliance.System.Debug': {}, 'Appliance.Config.Key': {}, 'Appliance.Control.ToggleX': {}, 'Appliance.Control.Upgrade': {}};[{}]

from merossiot.

shodge12 avatar shodge12 commented on July 25, 2024

OK,

Loaded your last update 0.2.2.1 and started playing.

  1. Your new example tool error's out with undefines for GenericBulb and GenericPlug. I added the following to the top of the example file to correct.

from meross_iot.supported_devices.power_plugs import GenericPlug
from meross_iot.supported_devices.light_bulbs import GenericBulb

  1. It turns out that the changes you made for the bulb support will work on the mss560 dimmer with minor changes. I changed device_factory.py to force my mss560 to be a GenericBulb.

    if device_type.startswith('mss560'):
    return GenericBulb(token, key, user_id, **device_specs)
    elif device_type.startswith('msl'):
    return GenericBulb(token, key, user_id, **device_specs)
    elif device_type.startswith('mss'):
    return GenericPlug(token, key, user_id, **device_specs)
    else:
    return GenericPlug(token, key, user_id, **device_specs)

The mss560 dimmer obviously does not support rgb, but the 'light' payload has it (the mss560 ignores the value). It initially failed with your default of capability=5 and this dimmer is a capability of 4 (This can be seen in the capability dumps above). Using your example code and modifying it to have a capability of 4 works! Here is modified line from my edited example...

        device.set_light_color(rgb=(255, 255, 255), luminance=80, capacity=4)

        input("\nPress the <ENTER> key to continue...\n")


        device.set_light_color(rgb=(255, 255, 255), luminance=60, capacity=4)

        input("\nPress the <ENTER> key to continue...\n")


        device.set_light_color(rgb=(255, 255, 255), luminance=40, capacity=4)

        input("\nPress the <ENTER> key to continue...\n")


        device.set_light_color(rgb=(255, 255, 255), luminance=20, capacity=4)

        input("\nPress the <ENTER> key to continue...\n")

The rgb values are a don't care as the ack response always returns a -1 (same for temperature). The ack which comes back shows the previous luminance value so it you want the current (new) value - you would have to ask for the status after it changed.

Bottom line - If you document it, and make the change to device_factory.py you can say you support the mss560. BTW - you might consider selecting which object to create based upon the existence of the 'Light' payload....

As a last comment, I like a few others would like to control this locally without the use of the meross server. I have gotten it to work to my local Mosquitto server and will moving this direction going forward.

Thanks for your great work...
-Stan

from merossiot.

albertogeniola avatar albertogeniola commented on July 25, 2024

Hi @shodge12 ,
Great job. I've uploaded the library in accordance with your information. Now the max capacity is fetched via get_abilities so that it should work with any bulb. The pipeline is now building and releasing the new version, hopefully it'll be available in 5 minutes as meross-iot==0.2.2.2. Try that one and let me know if it's working as you'd expect.

Regarding your comment about using the library locally, there already are people doing so. They simply did not document the way they achieved the goal, but the library should work fine. Anyways, I'm planning to document it, but I have some other tasks in the todo-list that come first (for instance I am currently re-writing the entire library to be more robust, async-ready and easier to use). So, keep in touch since I'll need the help of you people to make sure the new version of the library works as expected!

from merossiot.

shodge12 avatar shodge12 commented on July 25, 2024

I did a pull against 0.2.2.3 - just reporting that all is well with dimming using capacity=4.

-Stan

from merossiot.

Related Issues (20)

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.