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#
opam install meross
Usage#
Eio_main.run @@ fun env ->
Eio.Switch.run @@ fun sw ->
let net = Eio.Stdenv.net env in
(* Get device info *)
match Meross.get_info ~net ~sw "192.168.0.6" with
| Ok info -> Fmt.pr "%a@." Meross.pp_info info
| Error (`Msg e) -> Fmt.epr "Error: %s@." e
(* Control power *)
let _ = Meross.turn_on ~net ~sw "192.168.0.6" in
let _ = Meross.turn_off ~net ~sw "192.168.0.6" in
(* Get electricity reading *)
match Meross.get_electricity ~net ~sw "192.168.0.6" with
| Ok e -> Fmt.pr "Power: %.1f W@." (Meross.Electricity.power e)
| 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.