Sorry for delay. I wrote this script in Rules:
Code: Select all
On SDM120_Goodwe#All Do // Receives 4 arguments, 1st one is already sent to the controller, so can be ignored
Publish,domoticz/in,'{"command":"udevice","idx":2515,"nvalue":0,"svalue":"%eventvalue2%"}' // Current ESP32
Publish,domoticz/in,'{"command":"udevice","idx":2521,"nvalue":0,"svalue":"%eventvalue3%"}' //Power ESP32
Let,1,[SDM120_Goodwe#W]
Let,2,([SDM120_Goodwe#Total_kWh]*1000)
Publish,domoticz/in,'{"command":"udevice","idx":2520,"nvalue":0,"svalue":"[var#2];[var#1]"}' //Total kWh; Power
Endon
On SDM120_Goodwe#All do
Publish,"energy/goodwe/V",%eventvalue1%
Publish,"energy/goodwe/A",%eventvalue2%
Publish,"energy/goodwe/W",%eventvalue3%
Publish,"energy/goodwe/Total_kWh",%eventvalue4%
//Publish,energy/goodwe,'{"command":"udevice","idx":2509,"nvalue":0,"svalue":"%eventvalue4%"}'
logentry,'{"%eventvalue3%"}'
Endon
The first part of this Rule to Domoticz works. As long as in the Tab Controllers Protocol MQTT is enabled. Then it updates the sensors in the dashboard. As soon as I uncheck the line with Enabled the data is registered in the log of ESPeasy but not send to Domoticz..

The sensors are not updated...
Code: Select all
944490736: EVENT: SDM120_Goodwe#All=230.50,2.25,510.70,410.24
944490745: ACT : Publish,domoticz/in,'{'command':'udevice','idx':2515,'nvalue':0,'svalue':'2.25'}'
944490750: ACT : Publish,domoticz/in,'{'command':'udevice','idx':2521,'nvalue':0,'svalue':'510.70'}'
944490757: ACT : Let,1,510.70
944490764: ACT : Let,2,(410.24*1000)
944490771: ACT : Publish,domoticz/in,'{'command':'udevice','idx':2520,'nvalue':0,'svalue':'410240;510.7'}'
944493721: WD : Uptime 15742 ConnectFailures 0 FreeMem 201720 EthSpeedState Link Up Full Duplex 100Mbps ETH status: Conn. IP Init
I had in mind that there is no need to configure and enable a protocol in the Controller tab.
And my second question:
When I use Rules it should be possible to send to
different Topics at once. As I did in the above script. But up till now I did not succeed. Maybe somebody can help me out?
At the moment I am able to send the data to Domoticz and that application sends the data to Node-Red. That is a long way around and a single point of failure.. On top of that the values of sensors are converted from number to string..

Not a real problem but not necessary.