Build Hash: 13cb08fcd
Compile Date: 2025-03-18 21:51:10
dzVents Version: 3.1.8
Python Version: 3.11.2 (main, Nov 30 2024, 21:22:50) [GCC 12.2.0]
Active User: admin
arm64 debian on a orangepie 5plus also riscv64 spacemit bpi-f3 they both had the newest domoticz installed and both have the same behavior
hi there for some reason graphs are not updating for virtual-device (energy counter). I used this method for years but it does not seam to work in the newer versions domoticz .
perl script that takes a live MQTT feed and publishes it to domoticz
what the code does it take a MQTT live feed from an energy monitor. , sample it then averages it over a certtian period then publishes it to domoticz and a second mqtt stream that an mqtt connected lcd screen displaying current data
Code: Select all
#!/usr/bin/perl -w
my $MQTT2=0;
sleep(15);
open(SUB, "/usr/bin/mosquitto_sub -h 192.168.168.150 -t /solar |");
my $cnt=0;
while ($MQTT = <SUB>) {
$cnt++;
$MQTT2=($MQTT2+$MQTT);
print "$MQTT";
if ($cnt >15){
$MQTT2=($MQTT2/$cnt);
$MQTT2=int($MQTT2);
$cnt=0;
print " average = $MQTT2\n";
system("mosquitto_pub -t /energy/solar -m '$MQTT2'");
system("curl -s 'http://127.0.0.1:8080/json.htm?type=command¶m=udevice&idx=2&nvalue=0&svalue=$MQTT2;0' ");
$MQTT2=0;
}
}

it displays live data

but not the historical data

I have zigbee outlet switch with energy capabilities it displays historical energy usage