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-meross: enable MDX on lib/meross.mli

Run mdx on lib/meross.mli so the {[ ... ]} odoc block now type-checks.
The example used unqualified `Protocol.http` (lives at
`Meross.Protocol.http`) and ran the live HTTP request to a smart plug
at the toplevel. Wrapped in `let run () = ...` and qualified the
Protocol path so the toploop resolves it through the `meross`
package.

+14 -8
+4
lib/dune
··· 11 11 requests 12 12 ptime 13 13 ptime.clock.os)) 14 + 15 + (mdx 16 + (files meross.mli) 17 + (libraries meross fmt eio eio.core eio.unix eio_main))
+10 -8
lib/meross.mli
··· 18 18 {2 Example} 19 19 20 20 {[ 21 - Eio_main.run @@ fun env -> 22 - Eio.Switch.run @@ fun sw -> 23 - let http = 24 - Protocol.http ~clock:(Eio.Stdenv.clock env) ~net:(Eio.Stdenv.net env) 25 - in 26 - match Meross.info ~http ~sw "192.168.0.6" with 27 - | Ok info -> Fmt.pr "%a" Meross.pp_info info 28 - | Error (`Msg e) -> Fmt.epr "Error: %s@." e 21 + let run () = 22 + Eio_main.run @@ fun env -> 23 + Eio.Switch.run @@ fun sw -> 24 + let http = 25 + Meross.Protocol.http ~clock:(Eio.Stdenv.clock env) 26 + ~net:(Eio.Stdenv.net env) 27 + in 28 + match Meross.info ~http ~sw "192.168.0.6" with 29 + | Ok info -> Fmt.pr "%a@." Meross.pp_info info 30 + | Error (`Msg e) -> Fmt.epr "Error: %s@." e 29 31 ]} *) 30 32 31 33 (** {1:modules Submodules} *)