Code Monkey home page Code Monkey logo

merossiot's Introduction

Meross IoT library

A pure-python based library providing API for controlling Meross IoT devices over the internet. At the moment there is only support for the Meross Mss310 smart plug. Hopefully, more Meross hardware will be supported in the future.

This library is still work in progress, therefore use it with caution.

Installation

Due to the popularity of the library, I've decided to list it publicly on the Pipy index. So, the installation is as simple as typing the following command:

pip install meross_iot --upgrade

Usage

The following script demonstrates how to use this library.

import time
import sys
from meross_iot.api import MerossHttpClient

if __name__=='__main__':
    httpHandler = MerossHttpClient(email="YOUR_MEROSS_CLOUD_EMAIL", password="YOUR_PASSWORD")

    # Retrieves the list of supported devices
    devices = httpHandler.list_supported_devices()

    # Returns most of the info about the power plug
    data = devices[0].get_sys_data()

    # Turns the power-plug on
    devices[0].turn_off()

    # Turns the power-plug off
    devices[0].turn_on()

    # Reads the historical device consumption
    consumption = devices[0].get_power_consumptionX()

    # Returns the list of WIFI Network available for the plug
    # (Note. this takes some time to complete)
    wifi_list = devices[0].get_wifi_list()

    # Info about the device
    trace = devices[0].get_trace()
    debug = devices[0].get_debug()

    # Returns the capabilities of this device
    abilities = devices[0].get_abilities()

    # I still have to figure this out :S
    report = devices[0].get_report()

    # Returns the current power consumption and voltage from the plug
    # (Note: this is not really realtime, but close enough)
    electricity = devices[0].get_electricity()

    current_status = devices[0].get_electricity()
    print(current_status)

Protocol details

This library was implemented by reverse-engineering the network communications between the plug and the meross network. Anyone can do the same by simply installing a Man-In-The-Middle proxy and routing the ssl traffic of an Android emulator through the sniffer.

If you want to understand how the Meross protocol works, have a look at the Wiki. Be aware: this is still work in progress, so some pages of the wiki might still be blank/under construction.

Donate!

I like reverse engineering and protocol inspection, I think it keeps your mind trained and healthy. However, if you liked or appreciated by work, why don't you buy me a beer? It would really motivate me to continue working on this repository to improve documentation, code and extend the supported meross devices.

Buy me a beer

merossiot's People

Contributors

albertogeniola avatar

Watchers

James Cloos avatar nat avatar

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.