I guess you don't have the costs available in Domoticz? In that case you can indeed make a calculation like the out commented code in your example.jompie wrote:Hi,
I also use the frontpage. I was able to add the current and total electricity usage and Gas meter usage from my smart meter. However, I also want to add the costs to the frontpage. How can I do this? I already used and changed the vdata for adding kWH or Watt. ?
I used this part of code:Hope someone can help.Code: Select all
if(item.idx == '83'){ // Adds Watt after current electricity usage //vdata=new String(vdata).replace( vdata,vdata + "%"); if (vdata == vtotal) { //vdata = Math.round(cur_elec_cost / 100* vdata); vdata = vdata+"<sup style=\'font-size:50%;vertical-align:top;position:relative;bottom:-0.2em;\'> kWh</sup>"; } else { vdata = vdata+"<sup style=\'font-size:50%;vertical-align:top;position:relative;bottom:-0.2em;\'> Watt</sup>"; }}
Just use a second cell with the idx 83 in put your calculation for vdata in the code.