I am trying to create a tasmota script to read MODBUS KWh meter using tasmota sonoff device then publish the results on MQTT.
According numerous post I have read on the subject I can now listen the meter successfully according to following script:
>D
V1=0
>B
=>sensor53 r
>M 1
+1,3,M,1,9600,PAC,1,5,08040000,08040008,0C040008,0b040008,08040012,0C040012,0b040012
1,080404ffffffff@i0:1,L1 Voltage,V,Voltage_L1,2
1,080404ffffffff@i1:1,L1 Current,A,Current_L1,2
1,0C0404ffffffff@i2:1,L2 Current,A,Current_L2,2
1,0b0404ffffffff@i3:1,L3 Current,A,Current_L3,2
1,080404ffffffff@i4:1,L1 Power,W,Power_L1,2
1,0C0404ffffffff@i5:1,L2 Power,W,Power_L2,2
1,0b0404ffffffff@i6:1,L3 Power,W,Power_L3,2
1,=h=============
1,=m 2+3+4 @100,Current total,A,Current_tot,2
1,=m 5+6+7 @100,Power total,W,Power_tot,2
>T
V1=sml(1 1)
=>Publish emoncms/PAC/volt_L1 %V1%
#
Of course I recompile tasmota using following flag:
USE_SCRIPT USE_SML_M USE_RULES USE_RULES
I can read
every teleperiod time the status 10 with all measurement but now I would like
to publish the measurement only on a specific mqtt topic ex.
Topic: emoncms/PAC/power_L1
But noway to pass the variable from “Smart Meter” bloc to MQTT
Hint are welcome
>J
The lines in this section are published via MQTT in a JSON payload on TelePeriod. Requires compiling with #define USE_SCRIPT_JSON_EXPORT.
Sent from Mail for Windows 10
--
You received this message because you are subscribed to the Google Groups "TasmotaUsers" group.
To unsubscribe from this group and stop receiving emails from it, send an email to sonoffusers...@googlegroups.com.
To view this discussion on the web, visit https://groups.google.com/d/msgid/sonoffusers/c51282c2-f08c-4139-8706-c5ae9ae85c86n%40googlegroups.com.
There is also a section in the Alexa Controlled MCP230xx I2C GPIO Expander on the Scripting page where they publish over MQTT
=#pub
; publish routine
#pub
=>publish stat/%topic%/RESULT {"MCP23XX":{"p1":%0p1%,"p2":%0p2%,"p3":%0p3%,"p4":%0p4%}}
svars
To view this discussion on the web, visit https://groups.google.com/d/msgid/sonoffusers/dfd9ff44-c6ca-4fa8-9720-949190f6020bn%40googlegroups.com.
1,080404ffffffff@i0:1,L1 Voltage,V,Voltage_L1,2
1,080404ffffffff@i1:1,L1 Current,A,Current_L1,2
1,0C0404ffffffff@i2:1,L2 Current,A,Current_L2,2
1,0b0404ffffffff@i3:1,L3 Current,A,Current_L3,2
1,080404ffffffff@i4:1,L1 Power,W,Power_L1,2
1,0C0404ffffffff@i5:1,L2 Power,W,Power_L2,2
1,0b0404ffffffff@i6:1,L3 Power,W,Power_L3,2