Open novembre62 opened 6 months ago
Hi,
What output exactly your command ?
your 0 should not be quoted
in reqsdm.php
......
} elseif ($argv[1] == 'pow3oggi') { $url = 'http://192.168.1.42/cm?cmnd=Status%2010'; $pagina = file_get_contents($url); $json_output = json_decode($pagina, true); $val = $json_output['StatusSNS']['ENERGY']['Today']; $outstr = ("10($val*w)\n");
.......
http://192.168.1.42/cm?cmnd=Status%2010
returns
{"StatusSNS":{"Time":"2024-03-08T08:39:42","ENERGY":{"TotalStartTime":"2023-03-17T00:00:00","Total":1367.148,"Yesterday":0.000,"Today":0.000,"Power":0,"ApparentPower":0,"ReactivePower":0,"Factor":0.00,"Voltage":230,"Current":0.000}}}
"Today":0.000
Therefore in metern indicators Command = reqsdm pow3oggi
the value is "empty" only when the Today value is 0, while it is displayed correctly when the value is greater than 0
this also happens with other indicators
What returns reqsdm pow3oggi from CLI ? Maybe change reqsdm with $outstr = utf8_decode($outstr); echo "$outstr";
returns reqsdm pow3oggi from CLI:
10(0*w)
and what returns metern/programs/programindicator.php ?
returns metern/programs/programindicator.php :
{"Tensione1":"234.15","Temp CPU2":"53.45","Distacco lavanderia3":"OFF<\/font>","Distacco clima4":"OFF<\/font>","Acqua giorno5":"105","Clima nuovi oggi6":"empty"}
and this : Clima nuovi oggi6":"empty"
I think this happened with the new version of metern...but I'm not sure
i don't have such issue.. What show "more /dev/shm/mN_ILIVEMEMORY.json" ?
/dev/shm/mN_ILIVEMEMORY.json :
{"Tensione1":"238.09","Temp CPU2":"52.9","Distacco lavanderia3":"OFF<\/font>","Distacco clima4":"OFF<\/font>","Acqua giorno5":"133","Clima nuovi oggi6":"empty"}
Try using latest https://github.com/jeanmarc77/meterN/blob/main/scripts/metern.php and restart
should I replace my metern.php with the one indicated in the link?
yup
done...but nothing changes
...I add that by replacing metern.php, even some meters, which at this moment have a value of 0, "empty" is displayed
dunno, it work here but it's been a while.. i somehow remember i have changed that behavior.. Maybe change also https://github.com/jeanmarc77/meterN/blob/main/index.php
replaced index.php, but no change
however, the system works well....the values are correctly displayed and counted when they are different from 0 It was just to not see "empty" when the value is 0 Thank you very much for your availability
[jeanmarc@zbox ~]$ houseenergy -frq 1_F(0*Hz)
programindicator.php returns {"Volt1":"230.7","Freq2":"0","Cos3":"0.7","Main4":"14920","peak5":"4851.5","low6":"6"}
and my index show 0
Sorry i don't code much theses days
Thanks again
Good morning I solved it like this:
added to metern.php after line 314
if ($val === 'empty') { // Check if the value is 'empty' $val = 0; // Set the value to 0 if it is 'empty' }
Now when the value of an indicator is 0, 0 is displayed
Well, if you it mean your com app return 'empty' in cli
HI I have an energy meter that measures today's energy which is reported in the indicators When the meter value is "0", the indicator value is "Empty" It is possible to display "0"
Use with Metern 1.2.4.1 Raspberry PI5 with bookworm
Thank you