OCaml library for controlling Meross smart plugs via local HTTP API
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

OCaml 96.9%
Dune 0.8%
Other 2.3%
52 1 0

Clone this repository

https://tangled.org/gazagnaire.org/ocaml-meross https://tangled.org/did:plc:jhift2vwcxhou52p3sewcrpx/ocaml-meross
git@git.recoil.org:gazagnaire.org/ocaml-meross git@git.recoil.org:did:plc:jhift2vwcxhou52p3sewcrpx/ocaml-meross

For self-hosted knots, clone URLs may differ based on your setup.

Download tar.gz
README.md

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 authentication
  • Meross.Device - Device info and power control
  • Meross.Electricity - Real-time power monitoring
  • Meross.Consumption - Historical energy usage
  • Meross.Timers - Countdown timers
  • Meross.Triggers - Automation rules
  • Meross.Dnd - LED control
  • Meross.Runtime - WiFi signal and stats
  • Meross.Abilities - Feature discovery
  • Meross.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.

This library focuses on local control without cloud dependencies.

Licence#

MIT License. See LICENSE.md for details.