Page 4 of 6

Re: Energy Dashboard - Template

Posted: Monday 03 June 2024 18:07
by McMelloW
gizmocuz wrote: Monday 03 June 2024 15:37 @McMelloW , If you have a battery at home, you need to charge/discharge it. You do this via a Setpoint device, like a thermostat setpoint.
You set it to 300, and it will charge with 300 Watt. Setting it to -300 it will discharge with 300 Watt
SOC (State of Charge) is a device that tells you how full a battery is, 0=empty, 100=100% full
@gizmocuz Thanks for the explanation. I was thinking of making the Vitual Solar Battery visual. See this topic https://www.domoticz.com/forum/viewtopi ... al+battery But this does not have a fixed charge /discharge value.

Re: Energy Dashboard - Template

Posted: Monday 03 June 2024 18:20
by Sjonnie2017
McMelloW wrote: Wednesday 29 May 2024 11:29
Sjonnie2017 wrote: Wednesday 29 May 2024 6:09 That's the device I use (339) which gives me this result. Will investigate further later on this day.

Tx foor your reply!
Hi Sjonnie, my SolarEdge is connected to Domoticz with the SolarEdge Modbus TCP hardware. The values in Domoticz are directly from the inverter and change every 10 sec. The values in the app are from the SolarEdge website and change every 15 min. So the is some difference between Domoticz and the app.

The only thing I did is changed the index number for idP1Meter; idGas; idSolar. And works like a charm. Much succes in getting it working OK.
So I finally got the time to check my issue. As it turns out I had made changes to my network some time ago and as a result the SolarEdge got a new IP which I forgot to modify in Domoticz. Never noticed it because I use the values of my Youless on my dashboard :oops:

All working fine now.

Re: Energy Dashboard - Template

Posted: Monday 03 June 2024 19:04
by Tuk90
Nice functionality!

Will this be included as default functionality in a next release? If not is it possible for the owner/maintainer of this code to create a git for it?

Re: Energy Dashboard - Template

Posted: Monday 03 June 2024 23:43
by andreo
gizmocuz wrote: Monday 03 June 2024 14:34 @Kedi, thanks, missed that one, updated above file
Has the modified code been included in the above file?
The fDayHomeUsage value is still zero.

The water and gas meter values ​​still occasionally go to zero and then display the correct value again. (same as HansieNL)

Re: Energy Dashboard - Template

Posted: Tuesday 04 June 2024 8:11
by gizmocuz
New file with correct 'fDayHomeUsage '

The previous patch from @kedi was not 100% correct as he did some more and it needed only the 'fDayHomeUsage' calculation

Some answers below:

@HansieNL, best to debug the code. If you run Domoticz with the parameter -nocache nothing is cached and you can add some debug lines (like console.log(somevalue); or alert(somevalue)
Else clear your browser cache each time you make a change

@kedi, I think this was caused by your changes. Try the version in this post

There are now options to specify if your water meter reports in 'm3' or already in 'liters', and if it is m3, there is an option to convert it to 'liters' (*1000)

@HvdW, yes everything is cached, when making a change, see my answer to @HansieNL above

@Jan Jansen, It should now be possible to use a Custom Sensor for both Gas and Water values

@McMelloW, I think this is all virtual and not a real battery system? If it was a real battery you would need to charge/discharge it, so there would be s setpoint device

@Tuk90, maybe... But remember this @MeneerKlaas his work... Best if he also has a look at the changes I made

@andreo, Yes, but you need to clear your browser cache when there is a change made to this file (see reply to @HansieNL)
No idea why the gas goes to zero... maybe it's solved now (don't experience this here), but otherwise please do some debugging. It is javascript not rocket science. Everything is also cleaned up and should be easy to understand

Energy_Dashboard.zip
(6.42 KiB) Downloaded 64 times

Re: Energy Dashboard - Template

Posted: Tuesday 04 June 2024 8:35
by Kedi
Sorry, in a hurry I just copied the code from previous source. Did not check at that moment the real values.
It works almost perfect now. somethimes the rounding is not done. I work with a Raspberry Pi 4b

Re: Energy Dashboard - Template

Posted: Tuesday 04 June 2024 9:07
by gizmocuz
@kedi, I just noticed this myself, here a new version (Also updated post above)

Updated 4/6/2024, Added option to disable Watermeter, making sure 'rest' grid goes to solar
Energy_Dashboard.zip
(6.76 KiB) Downloaded 46 times

Re: Energy Dashboard - Template

Posted: Tuesday 04 June 2024 13:04
by McMelloW
@gizmocuz
Tried out you latest dashboard upload. I just noticed you removed the sLocales = 'nl-NL';

Further I see the odd situation have a negative usage (156 watt) going from my home towards the grid. How is this possible?
Grid = -1085 Watt, Solar = 929 Watt (no battery used)

Edit: (By GizMoCuz) Don't just post an image if there is no need for it... It is flooding my forum disk usage !.... :geek:

Re: Energy Dashboard - Template

Posted: Tuesday 04 June 2024 13:44
by gizmocuz
@McMelloW, I have explained this before. Your Solar kWh sensor is not updating in the same interval as your Grid.
You can do the Math... 929 From Solar, Grid = -1085 ... we miss -156 .... has to come from somewhere

An option is to tweak the code:

a) If you have no battery, we must assume it comes from the Solar panels ..
b) If you have a battery, it could come from the battery, or from the Solar panels... Probably because of the battery setpoint, it's still from the Solar Panels

So, the option would be to add 156 to the Solar Panel value

Probably users are going to make comments on this as well, but it seems logical.

Re: Energy Dashboard - Template

Posted: Tuesday 04 June 2024 14:59
by McMelloW
@gizmocuz
Thanks for the explanation. The Solar kWh senor interval is definitely not in sync with the P1 Smart Meter. No battery is in use.

Re: Energy Dashboard - Template

Posted: Tuesday 04 June 2024 15:40
by gizmocuz
@McMelloW, I updated the dashboard in the post above, and now the 'rest' grid is added to the Solar
Yes, I removed the 'local' mombojumbo stuff, it is not used anywhere in Domoticz, it was also done on some none-number items

Re: Energy Dashboard - Template

Posted: Tuesday 04 June 2024 17:12
by McMelloW
gizmocuz wrote: Tuesday 04 June 2024 15:40 @McMelloW, I updated the dashboard in the post above, and now the 'rest' grid is added to the Solar
Yes, I removed the 'local' mombojumbo stuff, it is not used anywhere in Domoticz, it was also done on some none-number items
Thanks, loooks nice this way.

Re: Energy Dashboard - Template

Posted: Wednesday 05 June 2024 8:59
by gizmocuz
New template:

- Rebuild to AngularJS, needed later to add it as default in the system
- The template is now dynamically sized based on the sensors enabled
- It is now possible to disable Gas, enable Water, and the two will be swapped.
If you are not using a battery, the height of the template will still be small

Energy_Dashboard.zip
(7.21 KiB) Downloaded 48 times

Re: Energy Dashboard - Template

Posted: Wednesday 05 June 2024 10:36
by HvdW
Thank you for the new version.

There's an unintended drop of water in the view.

Re: Energy Dashboard - Template

Posted: Wednesday 05 June 2024 11:39
by gizmocuz
@HvdW, please do not post screenshots, as explained above this is polluting my forum disk size.
Should be fixed in the file above (just updated)
Also, the animation speed should be more consistent, so the dashed lines are not restarting by a small change in wattage.

It has no use to change the background yet... Do not modify it as there will be a dozen more updates until it is finalized.
If it is going to be added into Domoticz it needs to be styled in stylesheets and not in the SVG
Patiance... And nothing wrong with a white background for now

Re: Energy Dashboard - Template

Posted: Wednesday 05 June 2024 13:20
by HansieNL
@gizmocuz Values for gas are correct now :-)
The solar panel is shown now with 0 values but setting is -1. Should it be removed if setting is -1?

Re: Energy Dashboard - Template

Posted: Wednesday 05 June 2024 14:05
by gizmocuz
@HansieNL, great!

New version (1.5):
- Dynamic battery icon
- Keep animation consistent if speed does not change
- Added Text SVG object
- Now hiding all solar objects if idSolar equals -1

Energy_Dashboard.zip
(7.75 KiB) Downloaded 63 times

Re: Energy Dashboard - Template

Posted: Wednesday 05 June 2024 14:50
by eddieb
Just upgraded from 1.1 to 1.5 !
Looking fine

Re: Energy Dashboard - Template

Posted: Wednesday 05 June 2024 15:38
by McMelloW
Just upgraded to 1.5 The idTextObj works OK too. I use the status of my inverter to display this way.

Re: Energy Dashboard - Template

Posted: Wednesday 05 June 2024 22:14
by Xenomes
Very need!

Did made a script to add to the customstart.sh for the docker users.

Code: Select all

#link to version 1.10
wget https://www.domoticz.com/forum/download/file.php?id=32760 -O download.zip
unzip -o download.zip
rm download.zip
declare -A replacements=(
    ["idP1Meter"]=1
    ["idGas"]=2
    ["idWater"]=3
    ["bWaterMeterInM3"]=true
    ["convertWaterM3ToLiter"]=true
    ["idSolar"]=4
    ["idBattSetpoint"]=-1
    ["idBattSoc"]=-1
    ["idTextObj"]=-1
    ["lblCurrency"]="\"€"\"
    ["bEnableServerTime"]=true
    ["idItemH1"]=-1
    ["fieldH1"]="\"Usage"\"
    ["iconH1"]="\"car"\"
    ["idItemH2"]=-1
    ["fieldH2"]="\"Data"\"
    ["iconH2"]="\"heater"\"
    ["idItemH3"]=-1
    ["fieldH3"]="\"Data"\"
    ["iconH3"]="\"other"\"
)

for key in "${!replacements[@]}"; do
    value=${replacements[$key]}
    sed -i "s/\(\$scope\.$key = \).*\+;/\1$value;/" Energy_Dashboard.html
done