meross#
Control Meross smart plugs over local HTTP API without cloud.
Overview#
This library provides local control of Meross smart plugs (MSS310, MSS315, etc.) via their HTTP API. No cloud account or internet connection required.
Features#
- Power control (on/off/toggle/reboot)
- Real-time electricity monitoring (voltage, current, power)
- Historical energy consumption
- Countdown timers
- Automation triggers
- LED control (Do Not Disturb mode)
- WiFi signal monitoring
- Matter pairing support
- Device discovery/scanning
Installation#
Install with opam:
$ opam install meross
If opam cannot find the package, it may not yet be released in the public
opam-repository. Add the overlay repository, then install it:
$ opam repo add samoht https://tangled.org/gazagnaire.org/opam-overlay.git
$ opam update
$ opam install meross
Usage#
let run ~http ~sw ip =
(match Meross.info ~http ~sw ip with
| Ok info -> Fmt.pr "%a@." Meross.pp_info info
| Error (`Msg e) -> Fmt.epr "Error: %s@." e);
let _ = Meross.turn_on ~http ~sw ip in
let _ = Meross.turn_off ~http ~sw ip in
match Meross.electricity ~http ~sw ip with
| Ok e -> Fmt.pr "Power: %.1f W@." e.Meross.Electricity.power
| Error _ -> ()
Modules#
Meross.Protocol- HTTP protocol and authenticationMeross.Device- Device info and power controlMeross.Electricity- Real-time power monitoringMeross.Consumption- Historical energy usageMeross.Timers- Countdown timersMeross.Triggers- Automation rulesMeross.Dnd- LED controlMeross.Runtime- WiFi signal and statsMeross.Abilities- Feature discoveryMeross.Commissioning- Matter pairing
Supported Devices#
Tested with:
- MSS310 (Smart Plug with Energy Monitor)
- MSS315 (Smart Plug with Energy Monitor, Matter)
Should work with other Meross plugs that support local HTTP API.
Related Work#
- meross-iot - Python library (cloud-based)
- meross-cloud - Home Assistant integration
This library focuses on local control without cloud dependencies.
Licence#
MIT License. See LICENSE.md for details.