question

gawan avatar image
gawan asked

Question regarding MQTT topics - How do I get Total Daily Consumption?

Hi,

I would like to get the "Total Consumption" value from my Victron Setup.

Today it is approximately 20 kWh, but can find this value nowhere in the huge list of MQTT topics.

I found vebus/261/Energy/AcIn1ToAcOut and it has a value of 47 ... increasing a bit every minutes, but I have no idea what it could mean.

Could you please help me ?

BR

Gawan

MQTT
2 |3000

Up to 8 attachments (including images) can be used with a maximum of 190.8 MiB each and 286.6 MiB total.

3 Answers
jbt77 avatar image
jbt77 answered ·

Hello,

I have a similar question, i think this is the good value to obtain the daily consumption but the problem here is that there is no reset of this value each day.

If you restart the Venux GX à 00:00 it will be OK but i search a way to to this automatically.

https://community.victronenergy.com/questions/65203/reset-log-daily-in-venus-gx.html

Tell me if you find the way to do that.

2 |3000

Up to 8 attachments (including images) can be used with a maximum of 190.8 MiB each and 286.6 MiB total.

jbt77 avatar image
jbt77 answered ·

I found a way (but not really clean) to have the counters at 0 each day.

I just add a line to the Venus GX crontab to reboot at midnight.


#reboot everay day at 00:00
00 22 * * * root /data/rebootatmidnight.sh

Here is the content of the rebootatmidnight.sh file :

root@beaglebone:/data# cat rebootatmidnight.sh
#!/bin/bash


cd /sbin
reboot

There is 2 hours of lag due to the time zone of the Venus GX here it's 22 p.m for midnight in my home location.

I still waiting for a better solution, for example just restart a service or reset a log file to do the same thing.

I saw the log reset is possible for the generator option. Maybe it will be the same for the main consumption logs.

2 |3000

Up to 8 attachments (including images) can be used with a maximum of 190.8 MiB each and 286.6 MiB total.

Peter avatar image
Peter answered ·

Daily kWh consumption is extremely useful in HA (Home Assistant), I searched the available Victron Modbus registers and couldn't find one that contained the information required, only total consumption. After some creative thinking I figured out how to use two HA Helpers and two Automations to store "sensor.discharged_energy" in a variable at midnight (input_number.discharged_energy_at_midnight), then using that variable to calculate a second variable (input_number.ac_today) that represents the daily discharged energy "AC Today" at 10 second intervals .

1627269298354.png

Automation 1 - store "sensor.discharged_energy" into Helper entity/variable "input_number.discharged_energy_at_midnight " at midnight .

  1. service: input_number.set_value
  2. data:
  3. value: '{ { states(''sensor.discharged_energy'') |float |round(1) }}'
  4. target:
  5. entity_id: input_number.discharged_energy_at_midnight


Automation 2 - calculate "input_number.ac_today " alias (AC Today) entity/variable.

  1. service: input_number.set_value
  2. data:
  3. value: >-
  4. { { ((states('sensor.discharged_energy') |float -
  5. states('input_number.discharged_energy_at_midnight') |float ) | round(1)) }}
  6. target:
  7. entity_id: input_number.ac_today

Maybe someone can improve on this approach, suggestions are welcome :)




1627269298354.png (73.8 KiB)
2 |3000

Up to 8 attachments (including images) can be used with a maximum of 190.8 MiB each and 286.6 MiB total.

Related Resources