sebbegg / vicare-exporter

Prometheus metrics exporter for viessmann installations
2 stars 3 forks source link

Add full list of modes and programs #9

Closed sebbegg closed 5 months ago

Kali- commented 5 months ago

heating.dhw.operating.modes.off is missing (i have added "off" in one of my commit) and i'm not sure about heating.dhw.operating.modes.balanced as Vicare for my gas boiler only allow me to set Comfort, Eco and Off

maybe we can add dwh enum and merge w/o duplicates

sebbegg commented 5 months ago

Hm, but those values actually belong to a different enum set.

The two I implemented were only tested/intended for

The code only looks at the "operating.modes.active" suffix, so I guess that's why in your case those two get mixed up. The DHW features would probably need a distinct set of enum values, since dhw & heating circuits have different sets string values. In get_metric_for_name we'd have to add another if/else branch to pick the proper enum labels for the dhw operating modes.

Given the relatively large number of enum values, I wonder whether it would be sensible (and a little more "future proof") to use prometheus Info metrics, rather than enums...

github-actions[bot] commented 5 months ago

Test Results

5 tests   5 :white_check_mark:  0s :stopwatch: 1 suites  0 :zzz: 1 files    0 :x:

Results for commit bcb3f7ad.

:recycle: This comment has been updated with latest results.

sebbegg commented 5 months ago

Hi @Kali- I've made quite a few changes. For the dhw operating modes there's now a separate enum.

There's also a script in tests that fetches all data once from the Viessmann API and writes them (anonymized) to the test data folder. If you like, feel free to run this and it - so the tests in the future can cover more variants.

Kali- commented 5 months ago

built, installed and switched off (dhw), set holiday and other mode everything looks fine

sebbegg commented 5 months ago

Again looking into the data... it appears that for every enum value of e.g. the heating circuits there is one dedicated metric, e.g. there in https://github.com/sebbegg/vicare-exporter/blob/add-modes-and-programs/tests/data/z62kZQ_device_2.json

heating.circuits.0.operating.programs.active
heating.circuits.0.operating.programs.comfort
heating.circuits.0.operating.programs.eco
heating.circuits.0.operating.programs.external
heating.circuits.0.operating.programs.holiday
heating.circuits.0.operating.programs.normal
heating.circuits.0.operating.programs.reduced
heating.circuits.0.operating.programs.standby

Would you be able to check what that list looks like in your case? That might be a way to fetch the enum values dynamically upon start - and matching them to the individual installation, so that only those modes/programs are part of the enum that the local setup supports.

Kali- commented 5 months ago

grep heating.circuits.0.operating.programs data/3yXA7A_device_1.json | awk -F\" '{ print $4}'

heating.circuits.0.operating.programs.noDemand heating.circuits.0.operating.programs.summerEco heating.circuits.0.operating.programs.active heating.circuits.0.operating.programs.comfort heating.circuits.0.operating.programs.comfortEnergySaving heating.circuits.0.operating.programs.forcedLastFromSchedule heating.circuits.0.operating.programs.normal heating.circuits.0.operating.programs.normalEnergySaving heating.circuits.0.operating.programs.reduced heating.circuits.0.operating.programs.reducedEnergySaving heating.circuits.0.operating.programs.standby

sebbegg commented 5 months ago

Thanks - I'll merge this as-is, but will have a look to make this more flexible.