Device “Electric (Instant+Counter)”gives Negativ value kWh at midnight

Please use template to report bugs and problems. Post here your questions when not sure where else to post
Only for bugs in the Domoticz application! other problems go in different subforums!

Moderators: leecollings, remb0

Forum rules
Before posting here, make sure you are on the latest Beta or Stable version.
If you have problems related to the web gui, clear your browser cache + appcache first.

Use the following template when posting here:

Version: xxxx
Platform: xxxx
Plugin/Hardware: xxxx
Description:
.....

If you are having problems with scripts/blockly, always post the script (in a spoiler or code tag) or screenshots of your blockly

If you are replying, please do not quote images/code from the first post

Please mark your topic as Solved when the problem is solved.
Post Reply
jpmd
Posts: 10
Joined: Tuesday 25 April 2023 19:46
Target OS: Raspberry Pi / ODroid
Domoticz version:
Location: Netherlands
Contact:

Device “Electric (Instant+Counter)”gives Negativ value kWh at midnight

Post by jpmd »

I have created a virtual device “Electric (Instant+Counter)” (with idx 5551)
I have connected a hardware-part "ShineWiFi" to my Growatt" solar-inverter and provided it with my own software that sends inverter-info to Domoticz over MQTT with JSON info : {"idx":5551,"nvalue":0,"svalue":"77;7300"} .

This works fine, however...
At midnight (00:00) the device log shows a negative value as kWh. This is not sent from the inverter because the inverter is automatically switched off at night. After sunrise, the kWh is still negative but becomes less negative as energy is generated.

Am I doing something wrong or is this a bug?

I’m using:
Domoticz Version: 2023 1 on Raspberry-pi
Attachments
1.jpg
1.jpg (14.02 KiB) Viewed 756 times
2.jpg
2.jpg (27.19 KiB) Viewed 756 times
3.jpg
3.jpg (34.44 KiB) Viewed 756 times
simat
Posts: 33
Joined: Thursday 04 November 2021 21:17
Target OS: Raspberry Pi / ODroid
Domoticz version: 2023.1
Location: UK
Contact:

Re: Device “Electric (Instant+Counter)”gives Negativ value kWh at midnight

Post by simat »

On my Sunny Boy read using SBFspot the Type = Usage, not sure if I had something strange like this years ago.
Raspberry Pi4, Sunny Boy 4000TL, Victron Multiplus II 10kw ESS, 44kWh LiFEPO4, Batrium BMS, NodeRED on Cerbo GX
gniazdoj
Posts: 7
Joined: Monday 13 January 2020 21:16
Target OS: Linux
Domoticz version: 2023.1
Location: Poland
Contact:

Re: Device “Electric (Instant+Counter)”gives Negativ value kWh at midnight

Post by gniazdoj »

I have same issue after last domoticz update. I workaround that with changing value from previous day to positive directly in database but it has one day of delay and it's annoying. I have tried to change Type from return to usage but it's same, it's only this one energy counter where inverter store values.
at maintenance time he takes sum of Energy Used from all day and invert it to negative.



Platform: Debian
Plugin/Hardware: https://github.com/ayasystems/froniusHttp
Version: 2023.1
Compile Date: 2023-02-14 15:06:40
dzVents Version: 3.1.8
Python Version: 3.7.3 (default, Oct 31 2022, 14:04:00) [GCC 8.3.0]
jpmd
Posts: 10
Joined: Tuesday 25 April 2023 19:46
Target OS: Raspberry Pi / ODroid
Domoticz version:
Location: Netherlands
Contact:

Re: Device “Electric (Instant+Counter)”gives Negativ value kWh at midnight

Post by jpmd »

I found the cause. :)

I sent to Domoticz over MQTT the JSON message: {"idx":5551,"nvalue":0,"svalue":"77;7300"} .
The 7300 was de "total Day" energy (wH). But the Domoticz virtual device “Electric (Instant+Counter)” needs the "total overall"!

Since I put the "total overall" in the JSON message the virtual device “Electric (Instant+Counter)” works fine. No negative values anymore :D
gniazdoj
Posts: 7
Joined: Monday 13 January 2020 21:16
Target OS: Linux
Domoticz version: 2023.1
Location: Poland
Contact:

Re: Device “Electric (Instant+Counter)”gives Negativ value kWh at midnight

Post by gniazdoj »

I've changed line in plugin to switch to Total Overall and will see what will happen tomorrow.
Thank you for info
Jakub
User avatar
waltervl
Posts: 5148
Joined: Monday 28 January 2019 18:48
Target OS: Linux
Domoticz version: 2024.7
Location: NL
Contact:

Re: Device “Electric (Instant+Counter)”gives Negativ value kWh at midnight

Post by waltervl »

gniazdoj wrote: Friday 05 May 2023 12:35 I've changed line in plugin to switch to Total Overall and will see what will happen tomorrow.
Thank you for info
Jakub
Then you were not on the latest version as the current version looks OK

Code: Select all

acumuladoKwhFV       = self.E_Total#accumulated
....
UpdateDevice("FV_POWER",      0, instantaneoFV+";"+acumuladoKwhFV)
Domoticz running on Udoo X86 (on Ubuntu)
Devices/plugins: ZigbeeforDomoticz (with Xiaomi, Ikea, Tuya devices), Nefit Easy, Midea Airco, Omnik Solar, Goodwe Solar
gniazdoj
Posts: 7
Joined: Monday 13 January 2020 21:16
Target OS: Linux
Domoticz version: 2023.1
Location: Poland
Contact:

Re: Device “Electric (Instant+Counter)”gives Negativ value kWh at midnight

Post by gniazdoj »

Thank you, I can see somebody has requested issue with negative values some time ago, I have modified this plugin to support more devices so I stopped watching author page. Looks like I did change that for some reason and it cause and issue. my bad

have a good day.
Jakub
ilex
Posts: 12
Joined: Friday 26 June 2020 23:14
Target OS: NAS (Synology & others)
Domoticz version:
Contact:

Re: Device “Electric (Instant+Counter)”gives Negativ value kWh at midnight

Post by ilex »

Hi,

I still have this issue running:

Version: 2024.1 (build 15792)
Build Hash: 36a973a7e
Compile Date: 2024-01-01 16:29:36
dzVents Version: 3.1.8
Python Version: 3.9.2 (default, Feb 28 2021, 17:03:44) [GCC 10.2.1 20210110]

Device definition:

{
"ActTime" : 1709115224,
"AstrTwilightEnd" : "19:10",
"AstrTwilightStart" : "04:39",
"CivTwilightEnd" : "17:52",
"CivTwilightStart" : "05:57",
"DayLength" : "10:48",
"NautTwilightEnd" : "18:31",
"NautTwilightStart" : "05:18",
"ServerTime" : "2024-02-28 11:13:44",
"SunAtSouth" : "11:54",
"Sunrise" : "06:30",
"Sunset" : "17:18",
"app_version" : "2024.1 (build 15792)",
"result" :
[
{
"AddjMulti" : 1.0,
"AddjMulti2" : 1.0,
"AddjValue" : 0.0,
"AddjValue2" : 0.0,
"BatteryLevel" : 255,
"CounterToday" : "0.000 kWh",
"CustomImage" : 0,
"Data" : "23.171 kWh",
"Description" : "",
"EnergyMeterMode" : "0",
"Favorite" : 0,
"HardwareDisabled" : false,
"HardwareID" : 25,
"HardwareName" : "Virtual",
"HardwareType" : "Dummy (Does nothing, use for virtual switches only)",
"HardwareTypeVal" : 15,
"HaveTimeout" : false,
"ID" : "00082612",
"LastUpdate" : "2024-02-28 11:13:16",
"Name" : "PV test",
"Notifications" : "false",
"PlanID" : "14",
"PlanIDs" :
[
14
],
"Protected" : false,
"ShowNotifications" : true,
"SignalLevel" : "-",
"SubType" : "kWh",
"SwitchTypeVal" : 4,
"Timers" : "false",
"Type" : "General",
"TypeImg" : "current",
"Unit" : 1,
"Usage" : "870 Watt",
"Used" : 1,
"XOffset" : "0",
"YOffset" : "0",
"idx" : "612"
}
],
"status" : "OK",
"title" : "Devices"
}

I send data from Node Red. Sample as below:

{"command":"udevice","idx":612,"nvalue":0,"svalue":"790;23171"}

and I still get negative values from time to time :/

What do I do wrong ?
User avatar
waltervl
Posts: 5148
Joined: Monday 28 January 2019 18:48
Target OS: Linux
Domoticz version: 2024.7
Location: NL
Contact:

Re: Device “Electric (Instant+Counter)”gives Negativ value kWh at midnight

Post by waltervl »

{"command":"udevice","idx":612,"nvalue":0,"svalue":"790;23171"}
23171 should be a rolling Total counter.
Domoticz running on Udoo X86 (on Ubuntu)
Devices/plugins: ZigbeeforDomoticz (with Xiaomi, Ikea, Tuya devices), Nefit Easy, Midea Airco, Omnik Solar, Goodwe Solar
Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest