ha-emporia-vue icon indicating copy to clipboard operation
ha-emporia-vue copied to clipboard

Utility Connect sensors have incorrect state_class

Open powdahound opened this issue 2 years ago • 4 comments

Came across the following warning in my home-assistant.log. Only device in use is the Utility Connect, and the value is negative because solar generation exceeded local usage.

2021-12-07 15:00:10 WARNING (Recorder) [homeassistant.components.sensor.recorder] Entity sensor.grid_123_1d from integration emporia_vue has state class total_increasing, but its state is negative. Triggered by state -1.243 with last_updated set to 2021-12-07T19:54:59.999999+00:00. Please report it to the custom component author.

Seems like the class should be measurement if the values are going to be reported as they come in from the device since they are not "a monotonically increasing total" per the doc.

Another option would be to ignore negative values and treat the sensor as a measurement of "energy pulled from grid today". Negative numbers could be converted to absolute values and summed for a "energy sent to grid today" metric.

In relation to #81, I don't think this device actually provides values that are of use on the energy dashboard, as there's no way to know how much energy was used or generated, unless I'm missing something.

powdahound avatar Dec 07 '21 21:12 powdahound

With a normal Vue there are two readings, MainsFromGrid and MainsToGrid that are both positive and monotonically increasing. I haven't used the utility connect and don't have solar (and unfortunately can't net meter anyway) so I'm not familiar with what channels are exposed.

Is it just the one "Grid" channel, not split into import and export? The Home Assistant dashboard usually expects separate grid import and generation sensors and might not behave correctly with a single sensor. Either way I may need to treat this one channel as a specialty case like I do for a number of other channels because the Emporia app makes different assumptions than Home Assistant with regards to signs.

magico13 avatar Dec 07 '21 21:12 magico13

Thanks for the quick response, that all makes sense. Here's a better explanation of what I'm seeing on my end:

Here's what the Emporia Energy dashboard shows for a Utility Connect: Emporia Energy Screenshot Blue = consumption, green = return to grid (reported as a negative value)

In the configuration screen for the integration the following sensors appear: Integration Configuration

Here's what the last ~10h of the "Grid Usage 1 Day" sensor look like Grid Usage 1 Day

Given that this is just the net metering data I don't think it has utility for the HA Energy Dashboard in its current form. Maybe these sensors should be of measurement class and be named differently? I'm not currently familiar with what data is coming from Emporia, nor the HA Energy Dashboard, so am not sure what the best option would be here.

powdahound avatar Dec 08 '21 01:12 powdahound

I too am getting this odd error and when it happens my energy graph data complete goes screweee

image image image

oziee avatar Jan 18 '22 07:01 oziee

A temporary solution to this is to create your own sensors instead: https://github.com/magico13/ha-emporia-vue/issues/101#issuecomment-1164437752

powdahound avatar Jun 23 '22 14:06 powdahound