Closed waldner closed 2 weeks ago
I'm assuming you've got the app, so I will explain where those calls are used by the app and that might explain a bit of the behavior. The Get Devices call is used in the settings, when you're modifying how things are nested and setting names and multipliers and all that. It will always return all known devices and channels, where channels are just the different CT clamps.
Get Device List Usage is the call made when you're on the home page of the app, with all of the devices nested and displaying their most recent data. You can change units, time scales, and the time you're looking at. Notable changes are that channels that are not set up or not working will generally not show up there, and "virtual" or "computed" channels are generated off of the other sensors, ie Balance and TotalUsage. For a single Vue with other devices and channels nested under it, Balance is Main minus all other sensors, in other words it's just whatever isn't being directly monitored at the circuit level. TotalUsage should match main but that might be different when you've got solar feeding back into the grid, I can't easily test that. My setup without solar doesn't have a TotalUsage channel, everything is nested under my Main (actually called Home with my setup) instead.
Because TotalUsage and Balance are computed from the other sensors, there isn't a way to query them directly via Get Chart Usage. There is also not a way to view them that way in the app. If you want historical data for them, you either have to track that yourself by periodically requesting it (eg what Home Assistant does, getting the 1 minute timescale once a minute) or by requesting the device list usage data for different times. Be wary of not going too wild with how often you query, they'd prefer we keep it under 2,000 requests a day.
So it looks like I was not really understanding the values correctly. get_device_list_usage
and get_chart_usage
contain basically (in my case, at least) the same data, which can be confirmed by calling get_device_list_usage
passing the instant
argument to request the values at a given time, and checking that the returned values match those in the chart usage series at the same timestamp (they do).
As for the computed values (eg TotalUsage
) that only appear in the output of get_device_list_usage
, they can be calculated using other values that do appear in the chart usage, so new (calculated) series can be built that contain the values that would be returned by a hypothetical call to get_chart_usage
for that channel. For example, in my case TotalUsage
can be computed by summing the value of the Main/1,2,3
channel and the values of the inverter channels.
In short, it looks like I don't really need get_device_list_usage
, but your explanation helped my understanding. Thanks!
The biggest difference is if you need all the channels at once or if you need the history for a single channel. If you've got a bunch of devices/channels, for instance I have about 30, I'm generally using the call to get all of them at one instant, rather than looping through all of them. If you're just really watching one or two channels then the history might be more useful.
Well, the history call gives me the data for all channels (ie contains multiple series), so it seems I'm getting the best of both worlds with that (because as I said I can compute other values out of these). However I only have 2-4 channels, I don't know what happens if you have 30.
Ok the history call does NOT give me data for all channels, only for the one specified in the arguments; what I meant is that I can call the history method for each channel I'm interested in.
For my device (solar plant), if I dump
device.channels
data I get a list of names/channel number as follows:However, the result of the call to
get_device_list_usage
contains a rather different set of channels:So why are these sets different? (it looks like
TotalUsage
usage always equals the sum ofMain
,1
and2
, whileBalance
usage usually equalsTotalUsage
).Also, how can I call
get_chart_usage()
on theTotalUsage
andBalance
channels to get a timeseries, if that is possible at all?