hier mal eine C3 Binary mit den neuesten Änderungen und ein erstes Testscript um das Prinzip zu zeigen.
>D 100
; nach änderungen in der Sektion >ah muss Tasmota neu getstartet werden.
IP=192.168.188.143
res=0
str=""
tstr=""
>B
=>sensor53 r
>ah
; http rpc handler
res=won(1 "/rpc/*")
; http status
res=won(2 "/status")
; udp rpc handler auf port 1010
res=udp(0 1010)
; starte mdns für Shelly
res=mdns("shellypro3em-" "-" "Shelly")
>on1
print here comes http rpc request
str=warg
res=ins(str "EM.GetStatus")
if res>=0 {
wcs so(4)
wcs HTTP/1.1 200 OK\r\n
wcs Content-type: application/json\r\n\r\n
wcs {"total_act_power": %sml[3]%}
wcf
break
}
res=ins(str "Shelly.GetDeviceInfo")
if res>=0 {
wcs so(4)
wcs HTTP/1.1 200 OK\r\n
wcs Content-type: application/json\r\n\r\n
tstr="shellypro3em-"+maca
wcs {"name":"%tstr%",
wcs "id":"%tstr%",
wcs "mac":"%maca%",
wcs "slot":1,
wcs "model":"SPEM-003CEBEU",
wcs "gen":2,
wcs "fw_id":"20241011-114455/1.4.4-g6d2a586",
wcs "ver":"1.4.4",
wcs "app":"Pro3EM",
wcs "auth_en": 0,
wcs "profile":"triphase"}
wcf
break
}
print unknown request: %str%
;"EMData.GetStatus"
;"EM.GetConfig"
>on2
print here comes the status request
wcs so(4)
wcs HTTP/1.1 200 OK\r\n
wcs Content-type: application/json\r\n\r\n
wcs {"Power": %sml[3]%,"E_in":%sml[1]%,"E_out":%sml[2]%}
wcf
>S
str=udp(1)
if str!="" {
print udp rpc payload=%str%
}
>M 1
+1,5,o,16,9600,eBZ,4
1,1-0:1.8.0*255(@1,Verbrauch,kWh,E_in,3
1,1-0:2.8.0*255(@1,Einspeisung,kWh,E_out,3
1,1-0:16.7.0*255(@1,akt. Leistung,W,Power,0
1,1-0:36.7.0*255(@1,Leistung L1,W,36_7_0,0
1,1-0:56.7.0*255(@1,Leistung L2,W,56_7_0,0
1,1-0:76.7.0*255(@1,Leistung L3,W,76_7_0,0
1,1-0:32.7.0*255(@1,Spannung L1,V,32_7_0,1
1,1-0:52.7.0*255(@1,Spannung L2,V,52_7_0,1
1,1-0:72.7.0*255(@1,Spannung L3,V,72_7_0,1
1,1-0:96.1.0*255(@#),Identifikation,,96_1_0,0
#
Alles anzeigen