[RELEASE] Watchtower long-term metrics app

Anubis, Great God and Watchful One, I ask for your permission to access Watchtower. Please hear my voice (text), and if it is your will, grant me the wisdom and protection and access I seek. I bring you this offering in gratitude for your presence.

It worked this time! :bowing_man:t4:

(the dashboard wasn't working with manual install, it now works after HPM install, too).

1 Like

I made a long, complicated post but deleted it because I determined a simple cause of the problem, which is still outstanding.

In Watchtower 4.1 I have a single-attribute panel with two switches. I have userscript that modifies the data thus

$config.data.datasets[0].data.forEach(pt => pt.y = pt.y > 50 ? 1 : 0);

along with some other stuff modifying the scales and tooltip to present as binary on/off like I want. It works and looks as expected when I update the tile.

However, when a refresh occurs and new data is read in, the userscript doesn't get executed, so the data no longer fits the rest of the setup and it's borked.

I assume there is some hook or setting that I've missed, or this sort of manipulation by userscript would never work on an ongoing basis. Help?

1 Like

I believe you found a bug, I'll take a look when I get a bit of time. Thank you for putting effort in pinpointing this issue.

2 Likes

Bug report with beta version 2.4.4.124 on a C-8 Pro: A dashboard that just outputs all available hub parameters (stock choice in WT) now generates this error: "can't access property "status", e is null". The dashboard worked with beta 2.4.4.123, and still works on a C-8 with 2.4.3.177.

1 Like

I would probably wait until the classic dashboard bug is fixed before posting here about it. This is a beta issue that has been a well reported on the beta forum

2 Likes

Hmmm …. Not sure we’re talking about the same “dashboard“. I’m not talking about Hubitat dashboards, I’m talking about Watchtower dashboards.

1 Like

It's the same bug; it affected more than just the HE dashboards - it seems to be fixed in beta .125

2 Likes

Nope — I just updated to .125 and ran my formerly working Watchtower hub information dashboard and got this:

“null is not an object (evaluating 'e.status')“

1 Like

I updated my C-7 to .125 and the Hub Information WT tile works fine. Is this maybe a C-8 Pro only issue that I cannot reproduce?

1 Like

I recreated the entire hub information dashboard that I was using, and all is OK. So there must’ve been some corruption somewhere.

2 Likes

Released version 4.1.1 with the following small fix:

Fixed

  • Execute chart user script on data refresh - @ed15

Changed

  • Update dependencies: chart.js (4.4.1 -> 4.5.1), lit (3.1.4 -> 3.3.2)

Have fun!

9 Likes

Thanks for the update! Solves the refresh issue.

After updating one of my existing tiles refused to load. I cannot prove the update caused the issue, but it did not exist before. It's a single-device tile for an Aeotec Energy Monitor, showing both energy (KwH) and Power (W). When I went into config, it showed neither attribute. I removed the tile and attempted to recreate, but instead of allowing me to chart both attributes it only allowed one-- which won't load either. Reloaded page, no improvement, just says "no data yet" even after forced refreshes of the device. The other four panels seem fine. (Multi-device, single-attribute, two single-device.) A regular Hubitat dashboard shows the device power normally.

Could this have broken somehow? Or do I have a mysterious problem?

1 Like

Check the csv file in File Manager, make sure the data is all right for that specific device.

Can you create single-device tiles for other devices?

1 Like

First, my apologies to everyone for an excessive number of posts as I worked through this. More difficult to figure out than the initial setup, because "it was working."

Now. I determined that the reason the csv file wasn't getting data was because the attributes Watchtower offered at device config and was looking for (power, energy) are not served by the device. I fixed it by adding

    // Aeotec HEM-8
    'energy-Endpoint-5': [min:0, unit:'kWh', minMax:false, probe: { device, app, events, begin, end -> calc5minAverage(device, app, 'energy-Endpoint-5', events, begin, true) }],
    'energy-Endpoint-6': [min:0, unit:'kWh', minMax:false, probe: { device, app, events, begin, end -> calc5minAverage(device, app, 'energy-Endpoint-6', events, begin, true) }],
    'energy-Endpoint-7': [min:0, unit:'kWh', minMax:false, probe: { device, app, events, begin, end -> calc5minAverage(device, app, 'energy-Endpoint-7', events, begin, true) }],
    'power-Endpoint-5': [min:0, unit:'W', minMax:true, probe: { device, app, events, begin, end -> calc5minAverage(device, app, 'power-Endpoint-5', events, begin, true) }],
    'power-Endpoint-6': [min:0, unit:'W', minMax:true, probe: { device, app, events, begin, end -> calc5minAverage(device, app, 'power-Endpoint-6', events, begin, true) }],
    'power-Endpoint-7': [min:0, unit:'W', minMax:true, probe: { device, app, events, begin, end -> calc5minAverage(device, app, 'power-Endpoint-7', events, begin, true) }],

to SUPPORTED_ATTRIBUTES in watchtower.groovy. I must have also done this when I first got device working, and then forgotten. Which of course the update overwrote. Note to self, unless you wish to add these to the code yourself, Dan. (Endpoints 5 are power/energy imported, endpoints 6 power/energy exported, and 7 = 5+6. I only use the 5s, but listed all three for thoroughness. The HEM-8 offers many other endpoints, but let's be practical here.)

I also modified the generic 'energy' attribute to use calc5minAverage() instead of calc5minIncrease(), because I want the KWh graph to be cumulative. Is there a better way to make it cumulative, using increase? I don't see a way for chart.js to support deltas.

2 Likes

A (probably ridiculous) request.

First the reason. I use this app to track the memory usage on my spare hub, doing nothing but this app and the brilliant HPM. I would like to be able to 'mark' a moment in time and label it with something like "Rebooted" and "Updated to Beta Version xxx". Of course, having more than one 'marker' is important. Is this at all possible?

1 Like

after latest update had trouble with watchtower 504 errors on the graph pages.

brought up another error i removred it totally and reinstalled but there is no way to remove the devices.. no remove option on the device page..

when i reinstallled source and the driver the old device was still there.
i did eventually get it working again. but we need a remove for the device and stats files as well as automatically doing it when uninstalling the app.

1 Like

I'd like the same thing, as my Energy data isn't MI (NEM/Solar), with the Device values representing the net-consumption and/or generation at each sample throughout a day.

My energy (and power) values come from my Smart-Meter, using a Rainforest Eagle [RELEASE] Rainforest Eagle

Seems like there are a few challenges with the use of calc5minIncrease for aggregations on energy values, and Average for most other things.... not clear on why this is different...

@dandanache was it intentional for WT to store delta-energy values, and/or can it be changed to be like [most of] the other average-attribute values?

Summary

Solar/NEM energy data gets unexpectedly altered in WT.

I've included the raw Energy values for my Device, and the resulting WT aggregated data (5m) and the corresponding graphs.... definitely a whacky visual for energy values that are already cumulative.

You can see the discontinuities happen at the transition points in the dataset (see RED bit, as a midday-example)

Original values from the Smartmeter Device, changing every 4m:

WT values aggregated, changing every 5m:

The unusual energy graph from the WT values:

1 Like

That is actually a very good feature request, I'll see what I can do.

The "energy" value is like what you'd see on an electrical or gas meter. It should only ever go up, unless the device gets factory‑reset back to zero. WT just records increase rate or the delta (e.g., 5 Wh consumed/produced in the last 5m, 1h, etc.)

Most of the other values in Hubitat are gauges, not counters. They go up and down, like temperature, humidity, brightness, etc.

Looks like the driver you're using is (mis)treating the "energy" value as the difference between produced and consumed energy, which is why you're seeing negative numbers. But that means it's not behaving like a counter, so the graphs end up looking odd.

1 Like

You're right: if you remove and reinstall the app, the old data files don’t get cleared from File Manager. I'm just really wary of automatically deleting files on someone else's hub :slight_smile:

Maybe the app should simply block you from adding a device on the WT "Devices" page if there's already a data file for that device in File Manager.

1 Like

With a consumption-only Electrical meter, that'd be correct.

With a NEM/Solar enabled Electrical meter, the meter can spin backwards :slight_smile:

For these meters the values are no longer MI, as power flows both ways with the totals going up-and-down depending upon how much is generated/consumed locally within a day.

I also have sub-panel metering, via a Brultech GEM, and the values can also go negative. It has separate feeds for energy, delta-energy, (etc), so I have a lot more control there

Looks like the driver you're using is (mis)treating the "energy" value as the difference between produced and consumed energy

Total energy (eg. for the day), yes. Not every physical metering device out there can differentiate between Produced and Consumed (esp the early ones, not built for the newer NEM Tariffs).

I can do it on my Brultech, as it has separate feeds for derivative values (like delta-energy), but I recall the HAN API (Rainforest Eagle) providing that natively.

It's been ~10yrs since I've coded against that device, so I'll double-check it.