Page 1 of 2
HomeWizard Battery plugin
Posted: Thursday 20 March 2025 0:48
by mvdp
I've just created a python plugin for the HomeWizard Battery at
https://github.com/etmmvdp/HomeWizard-B ... /tree/main.
See the readme for details how to create a token which is required to run the plugin.
Let me know in case of questions and improvements.
Re: HomeWizard Battery plugin
Posted: Thursday 20 March 2025 10:17
by hbennis
great work
Re: HomeWizard Battery plugin
Posted: Thursday 20 March 2025 17:13
by assp22
thanks, but the totals in the overview are missing
Re: HomeWizard Battery plugin
Posted: Thursday 20 March 2025 22:45
by mvdp
assp22 wrote: ↑Thursday 20 March 2025 17:13
thanks, but the totals in the overview are missing
Thanks for the feedback.
Which totals are you referring too? Which counter do you recommend?
Re: HomeWizard Battery plugin
Posted: Friday 21 March 2025 9:24
by gizmocuz
Why did you use a P1 smart meter? This is a battery device
You should use generic kWh meters for the totals
Re: HomeWizard Battery plugin
Posted: Friday 21 March 2025 10:02
by mvdp
gizmocuz wrote: ↑Friday 21 March 2025 9:24
Why did you use a P1 smart meter? This is a battery device
You should use generic kWh meters for the totals
Yeah, I know the P1 might be seen as a strange design choice. However, the generic kWh meter does not show import and export as separate values, while the P1 meter does.
Re: HomeWizard Battery plugin
Posted: Friday 21 March 2025 10:07
by mvdp
gizmocuz wrote: ↑Friday 21 March 2025 9:24
Why did you use a P1 smart meter? This is a battery device
You should use generic kWh meters for the totals
I fixed a bug, the totals were not showing as they were added as kWh values instead of Wh values.
The counter documentation for device 243, subtype 29 is imho incorrect in that regard. See
https://wiki.domoticz.com/Developing_a_ ... in#Devices
Re: HomeWizard Battery plugin
Posted: Friday 21 March 2025 10:24
by gizmocuz
I think our documentation is pretty accurate as many are using it, but you could be right, but what is wrong with it?
You can create (or actually should) two kWh sensors and use these for the totals of the imported/exported enery/power
This way, you can also use them on the Energy Dashboard
Of course, you can create a dzVents script if you like to still make a P1 meter, but I don't think this should be the default, because... well it just is not a P1 meter
You could make it an option the user can turn on/off maybe? (Simulate a P1 Smart Meter)
But still use two kWh sensors for the totals
Re: HomeWizard Battery plugin
Posted: Friday 21 March 2025 10:37
by mvdp
gizmocuz wrote: ↑Friday 21 March 2025 10:24
I think our documentation is pretty accurate as many are using it, but you could be right, but what is wrong with it?
Let's focus on the documentation first, I'll address the P1 meter in a separate answer.
The comment on device type 243, subtype 33 says: "The first number is the actual power in Watt, the second number is actual energy in kWh"
But the second number should be in Wh. This is documented on the P1 meter correctly, a bit further down on the the page.
Re: HomeWizard Battery plugin
Posted: Friday 21 March 2025 10:40
by gizmocuz
Hmm strange as I read
for instance "123456;78", 123456 being the absolute counter value, 78 being the usage (Wh).
Re: HomeWizard Battery plugin
Posted: Friday 21 March 2025 10:41
by mvdp
gizmocuz wrote: ↑Friday 21 March 2025 10:24
...
You can create (or actually should) two kWh sensors and use these for the totals of the imported/exported enery/power
This way, you can also use them on the Energy Dashboard
Of course, you can create a dzVents script if you like to still make a P1 meter, but I don't think this should be the default, because... well it just is not a P1 meter
You could make it an option the user can turn on/off maybe? (Simulate a P1 Smart Meter)
But still use two kWh sensors for the totals
The kWh meter "Active Power" is showing the netted import and export energy usage, as wel as it's current power consumption.
I'll like the simulated P1 meter option so I'll make that change.
Re: HomeWizard Battery plugin
Posted: Friday 21 March 2025 10:44
by mvdp
gizmocuz wrote: ↑Friday 21 March 2025 10:40
Hmm strange as I read
for instance "123456;78", 123456 being the absolute counter value, 78 being the usage (Wh).
.
With close reading I can now see that I should have interpreted the first kWh mentioned as Wh.
Re: HomeWizard Battery plugin
Posted: Friday 21 March 2025 10:48
by gizmocuz
For almost all (counter) sensors, the first value is the counter, and the second is the usage
So, the documentation is OK? (I did not create the documentation, but it looks OK to me programming wise

)
Re: HomeWizard Battery plugin
Posted: Friday 21 March 2025 10:50
by mvdp
gizmocuz wrote: ↑Friday 21 March 2025 10:48
So, the documentation is OK? (I did not create the documentation, but it looks OK to me programming wise

)
I think it would be even better when the kWh unit in the text is rephrased to Wh.
Re: HomeWizard Battery plugin
Posted: Friday 21 March 2025 20:38
by tiga
just preordered a battery coming in juli and this is what i was looking for!!
great work!!thank you!
Re: HomeWizard Battery plugin
Posted: Saturday 22 March 2025 20:19
by JanJaap
Gizmocuz I wonder about the comments. I am maintaining the plugin for the Sessy battery and created both Energy and P1 meter. The energy indeed for the energy dashboard but I like the overview on the P1 meter better:

- Schermafbeelding 2025-03-22 201823.png (25.41 KiB) Viewed 1750 times
As it states the consumed and provided energy per day.
Why do you recommend a separate meter for both consumed and provided energy?
Re: HomeWizard Battery plugin
Posted: Monday 24 March 2025 9:40
by gizmocuz
Well basically as it was not designed for this.
Let's say you have a normal (Dutch?) energy contract, with Piek/Dal tariffs, in the P1 meter report you can see this.
In your case, you don't want to see the two tariffs, you can set the P1 meter in simple mode in the settings.
But this also influences the real P1 meter device.
Maybe if we renamed the P1 smart meter to 'smart meter' and have the option to use 1 or 2 tariffs, it would make better sense
I understand the graphs are nicer and you get a better overview when you have a device that does consumption and delivery
Re: HomeWizard Battery plugin
Posted: Monday 24 March 2025 23:24
by mvdp
Instead of using the P1 device we should add a (Home) Battery device which is providing P1 device like features except for keeping costs and providing 1 set of import and export counters only.
Especially for the HomeWizard Battery there should be no cost involved as it only charges using solar power.
Re: HomeWizard Battery plugin
Posted: Friday 23 May 2025 11:47
by rini52
This is really great stuff. I just received 3 batteries and they work great as they were designed. However the p1-senseor is not selectable from the energy dashboard the "active power" sensor is. This sensor shows the Import-Export power of the battery. Since I had 3 batteries i had to sum them and put the result in a "usage electricity" sensor. Similar for the percentage(SOC) sensors. They can both be used in the Energy Dashboard"
Below the lua code for those that are interested:
-->
return {
on = {
timer = {
'every minute' -- causes the script to be called every minute
}
},
logging = {
level = domoticz.LOG_INFO,
marker = 'HWZ_plugin_total',
},
execute = function(domoticz, device, timer)
-- domoticz.log('Timer event was triggered by ' .. timer.trigger, domoticz.LOG_INFO)
local battery1Value = domoticz.devices(199).actualWatt
local battery2Value = domoticz.devices(207).actualWatt
local battery3Value = domoticz.devices(215).actualWatt
local battery1Percentage = domoticz.devices(203).percentage
local battery2Percentage = domoticz.devices(211).percentage
local battery3Percentage = domoticz.devices(219).percentage
-- local battery2Value = 22
-- domoticz.log('Device Precentage found ' .. battery1Percentage .. ' (%)' , domoticz.LOG_INFO)
local totalValue = battery1Value + battery2Value + battery3Value
local totalPercentage = domoticz.utils.round( (battery1Percentage + battery2Percentage + battery3Percentage) / 3 )
domoticz.log('Overal Precentage found ' .. totalPercentage .. ' (%)' , domoticz.LOG_INFO)
-- Set the value on a dummy sensor
-- local totalValue = 1
domoticz.devices('HWZ_PlugBat_Total').updateEnergy(totalValue)
domoticz.devices('HWZ_PlugBat_TSOC').updatePercentage(totalPercentage)
end
}
--<
Re: HomeWizard Battery plugin
Posted: Friday 23 May 2025 12:26
by JanJaap
Hey,
In my plugin for Sessy batteries I create an additional device that combines the data of the individual batteries (and also allows to set modes and power setpoints for the set). For the combined batteries to appear on the dashboard correctly it needs a device of type:
Type=243, Subtype=29
or:
type: General, Subtype: kWh