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.

meross: fix README — ~net→~http, get_info→info, get_electricity→electricity

+5 -5
+5 -5
README.md
··· 32 32 let net = Eio.Stdenv.net env in 33 33 34 34 (* Get device info *) 35 - match Meross.get_info ~net ~sw "192.168.0.6" with 35 + match Meross.info ~http ~sw "192.168.0.6" with 36 36 | Ok info -> Fmt.pr "%a@." Meross.pp_info info 37 37 | Error (`Msg e) -> Fmt.epr "Error: %s@." e 38 38 39 39 (* Control power *) 40 - let _ = Meross.turn_on ~net ~sw "192.168.0.6" in 41 - let _ = Meross.turn_off ~net ~sw "192.168.0.6" in 40 + let _ = Meross.turn_on ~http ~sw "192.168.0.6" in 41 + let _ = Meross.turn_off ~http ~sw "192.168.0.6" in 42 42 43 43 (* Get electricity reading *) 44 - match Meross.get_electricity ~net ~sw "192.168.0.6" with 45 - | Ok e -> Fmt.pr "Power: %.1f W@." (Meross.Electricity.power e) 44 + match Meross.electricity ~http ~sw "192.168.0.6" with 45 + | Ok e -> Fmt.pr "Power: %.1f W@." e.Meross.Electricity.power 46 46 | Error _ -> () 47 47 ``` 48 48