Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Missing several household metrics like energy.e_load_total #27

Open
poggenpower opened this issue Sep 12, 2022 · 6 comments
Open

Missing several household metrics like energy.e_load_total #27

poggenpower opened this issue Sep 12, 2022 · 6 comments

Comments

@poggenpower
Copy link
Contributor

Hello,

rctmon is running as expected accept of some missing metrics regrading "household".
The only metrics I receive is:

# HELP rctmon_household_load Household load (sum over phases)
# TYPE rctmon_household_load gauge
rctmon_household_load{inverter="solar01"} 241.02685546875
# HELP rctmon_household_load_phase Household load by phase
# TYPE rctmon_household_load_phase gauge
rctmon_household_load_phase{inverter="solar01",phase="l1"} 42.8297119140625
rctmon_household_load_phase{inverter="solar01",phase="l2"} 139.6209716796875
rctmon_household_load_phase{inverter="solar01",phase="l3"} 49.4603271484375

But I am looking for:
Something like: energy.e_load_total or any of the other metrics that reports Wh instead of current W.

Here some infos about my rctmon:

# HELP rctmon_info Information about the application
# TYPE rctmon_info gauge
rctmon_info{version="0.0.1",version_major="0",version_minor="0",version_patch="1"} 1.0
# HELP rctmon_inventory Shows attached components
# TYPE rctmon_inventory gauge
rctmon_inventory{component="generator_a",inverter="solar01"} 1.0
rctmon_inventory{component="generator_b",inverter="solar01"} 1.0
rctmon_inventory{component="power_switch",inverter="solar01"} 0.0

# HELP rctmon_inverter_info Information about the inverter
# TYPE rctmon_inverter_info gauge
rctmon_inverter_info{control_software_version="2.3.5615",inverter="solar01",parameter_file="DE_ARN4105_1811_200326",serial_number="0065*********"} 1.0
# HELP rctmon_inverter_status Status of the inverter
# TYPE rctmon_inverter_status gauge
rctmon_inverter_status{inverter="solar01"} 13.0
# HELP rctmon_inverter_grid_separated Status of the island mode
# TYPE rctmon_inverter_grid_separated gauge
rctmon_inverter_grid_separated{inverter="solar01"} 2.0
# HELP rctmon_inverter_faults Fault registers
# TYPE rctmon_inverter_faults gauge
rctmon_inverter_faults{inverter="solar01",register="0"} 0.0
rctmon_inverter_faults{inverter="solar01",register="1"} 0.0
rctmon_inverter_faults{inverter="solar01",register="2"} 0.0
rctmon_inverter_faults{inverter="solar01",register="3"} 0.0

In the log I see that some unkown OIDs are received:

2022-09-12 07:29:54,734 - rctmon.device_manager - WARNING - _cb_grid: unhandled oid 0x63476DBE2022-09-12T07:29:54.734987191Z
2022-09-12 07:29:54,735 - rctmon.device_manager - WARNING - _cb_grid: unhandled oid 0x485AD7492022-09-12T07:29:54.735355414Z
2022-09-12 07:29:54,735 - rctmon.device_manager - WARNING - _cb_grid: unhandled oid 0xF25C339B2022-09-12T07:29:54.735624947Z 
2022-09-12 07:29:54,735 - rctmon.device_manager - WARNING - _cb_grid: unhandled oid 0x1C4A665F2022-09-12T07:29:54.736002418Z

In the RCT-App I am able to see the household Wh reading per day and month.

@sfudeus
Copy link
Collaborator

sfudeus commented Sep 12, 2022

When using a recent version (i.e. after May 10), there should be rctmon_energy_* metrics, which show household, generator, grid_feed/grid_load energy.

@poggenpower
Copy link
Contributor Author

poggenpower commented Sep 12, 2022 via email

@poggenpower
Copy link
Contributor Author

Ok did an upgrade to the latest code and got:

# HELP rctmon_energy_household_sum Total household energy in Wh
# TYPE rctmon_energy_household_sum gauge
rctmon_energy_household_sum{inverter="solar01"} 1.137361125e+06

as an additional metric. I wonder that it is of type gauge, should this be an every increasing counter?
If it is a Gauge then it the reporting gets wrong if rctmon_energy_household_sum is resetted, because of an reset of the powerswitch.

It would be really useful if the package version gets a bump, if new features or changes get merged. Then tracking updates is far easier.

Thanks
Thomas

@poggenpower
Copy link
Contributor Author

From another project I know that Counter from the prometheus_client package has an inc() function only (allow increase only, but update to a new/absolute value), therefor I have created another calss: https://github.com/fhemberger/mqtt_exporter/blob/master/utils/prometheus_additions.py that implements a set() function. With that it is easy to create a Counter metric from an absolute reading.

Unfortunately flipping from Gauge to Counter will be a breaking change, because Prometheus handle these both as different metrics.
I am happy to work on a change to move to counters for all the metrics sum/total metrics, but only if you would accept such breaking change.

@svalouch
Copy link
Owner

svalouch commented Oct 3, 2023

I've tagged the latest code as of this morning and increased the version number after merging some PRs, that should make it easier to reason. I'll tag another one soon after some testing.


Counter vs. Gauge: As per the Metric types documentation:

The Prometheus server does not yet make use of the type information and flattens all data into untyped time series. This may change in the future.

According to that, Prometheus doesn't care and it's more of an informational value for the user (for Prometheus, that is; other TSDBs may actually use the type information!).

Stuff like the inc() method are not relevant here: rctmon yields MetricFamily types in the collect() function(s), see Custom Collectors. These do not mangle names (IIRC, have to check) and are just for piping the most recent value through. The next call to collect() yields entirely new ones, so there wouldn't be something there to call inc() on in the first place.
In contrast, if we were to use Metric types such as Gauge, we would be restricted in naming and usage. Actually, using them would be bad: I recall that the python client does not allow one to read the value from these Metrics. So we would have to store values twice, once for working with them and another time just for Prometheus exposition.

@rayb67
Copy link

rayb67 commented Oct 27, 2023

Hi togeher,
i have also some metrics I am missing. I thought this is the right place for that ;-)

I download the source code and compare some metric. In the device_manager.py I found some metrics which I found in the MQTT Explorer.
1AC87AA0 g_sync.p_ac_load_sum_lp Load household - external Power
91617C58 g_sync.p_ac_grid_sum_lp Total grid power

But because I have no experience with python, make more sense for me to request it.

Missing:
Values per Day:

BD55905F energy.e_ac_day Day energy
2F3C1D7D energy.e_load_day Household day energy
867DEF7D energy.e_grid_load_day Day energy grid load
3C87C4F5 energy.e_grid_feed_day Day energy grid feed-in
B9A026F9 energy.e_ext_day External day energy

and perhaps from a the „PowerSwitch“
6002891F g_sync.p_ac_sc_sum Grid power (ext. sensors)

Can you add this too

Best regards
Ralf

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants