Anyone already tried to implement the Shelly 4PM measurment functionality? The HTTP API is very easy accessable, bit how do I get the current, apower, aenergy for each channel?
(switching the channels is no big deal)
After commanding...
require('socket.http')
socket.http.TIMEOUT = 5
data = socket.http.request('http://xxxx.xxx.xxx.xxx/rpc/Shelly.GetStatus')
if data then
log(data)
... the result is:
string: {"ble":{},"cloud":{"connected":false},"eth":{"ip":"xxx.xxx.xxx.xxx"},"input:0":{"id":0,"state":false},"input:1":{"id":1,"state":false},"input:2":{"id":2,"state":false},"input:3":{"id":3,"state":false},"mqtt":{"connected":true},"switch:0":{"id":0, "source":"init", "output":false, "apower":0.0, "voltage":225.2, "freq":50.0, "current":0.000, "pf":0.00, "aenergy":{"total":0.000,"by_minute":[0.000,0.000,0.000],"minute_ts":1701113490}, "ret_aenergy":{"total":0.000,"by_minute":[0.000,0.000,0.000],"minute_ts":1701113490},"temperature":{"tC":20.8, "tF":69.5}},"switch:1":{"id":1, "source":"init", "output":false, "apower":0.0, "voltage":225.2, "freq":50.0, "current":0.000, "pf":0.00, "aenergy":{"total":0.000,"by_minute":[0.000,0.000,0.000],"minute_ts":1701113490}, "ret_aenergy":{"total":0.000,"by_minute":[0.000,0.000,0.000],"minute_ts":1701113490},"temperature":{"tC":20.8, "tF":69.5}},"switch:2":{"id":2, "source":"init", "output":false, "apower":0.0, "voltage":225.4, "freq":50.0, "current":0.000, "pf":0.00, "aenergy":{"total":0.000,"by_minute":[0.000,0.000,0.000],"minute_ts":1701113490}, "ret_aenergy":{"total":0.000,"by_minute":[0.000,0.000,0.000],"minute_ts":1701113490},"temperature":{"tC":20.8, "tF":69.5}},"switch:3":{"id":3, "source":"init", "output":false, "apower":0.0, "voltage":225.4, "freq":50.0, "current":0.000, "pf":0.00, "aenergy":{"total":0.000,"by_minute":[0.000,0.000,0.000],"minute_ts":1701113490}, "ret_aenergy":{"total":0.000,"by_minute":[0.000,0.000,0.000],"minute_ts":1701113490},"temperature":{"tC":20.8, "tF":69.5}},"sys":{"mac":"xxxxxxxx","restart_required":false,"time":"20:31","unixtime":1701113491,"uptime":11903,"ram_size":241544,"ram_free":127636,"fs_size":524288,"fs_free":196608,"cfg_rev":16,"kvs_rev":0,"schedule_rev":0,"webhook_rev":0,"available_updates":{"stable":{"version":"1.0.8"}}},"ui":{},"wifi":{"sta_ip":null,"status":"disconnected","ssid":null,"rssi":0},"ws":{"connected":false}}