turbokongen / hass-AMS

Custom component reading AMS through MBus adapter into HomeAssistant
42 stars 10 forks source link

Unknown unit #58

Closed oeriksen closed 2 years ago

oeriksen commented 2 years ago

I know this is really the wrong place but I'm curious if I'm the only one getting the messages below. I've searched and I can't find anyone else reporting this. Had to lookup kVAr, never heard about that before (neither reactive energy).

WARNING (Recorder) [homeassistant.components.sensor.recorder] sensor.ams_reactive_energy_export_57**42 has unknown unit kVAr

WARNING (Recorder) [homeassistant.components.sensor.recorder] sensor.ams_reactive_energy_import_57**42 has unknown unit kVAr

turbokongen commented 2 years ago

Thanks for reporting. A fix is available in v1.7.2 branch Please test 💯

oeriksen commented 2 years ago

I switched to the v1.7.2 branch. I'm still getting the warning messages. But I don't get any other (new) errors so the branch is stable/safe and that's something :smiley: As far as I can understand from the changes you did you limited total increasing state class to the active energy sensors (which removes it from the reactive sensors). So I might have to remove the integration and add it back again for that change to be in effect? Or edit some of the files in storage when HA isn't running. I also checked sensor.recorder and it reads from the database, when generating long term statistics, where also total increasing state class is stored. So I might need to edit that as well. A quick update query should fix that. If you agree to my thoughts I'll try to do this tomorrow night, it's getting to late now.

turbokongen commented 2 years ago

Yes, I had to remove integration, restart and reinstall for the messages to go away.

turbokongen commented 2 years ago

I have uploaded some more changes to the branch. please test. This should remove unknown state class None also.

oeriksen commented 2 years ago

Now I'm getting a new warning: Found unexpected state_class None for sensor.ams_active_energy_import_57**42

Update: I waited for a new hour to pass to get fresh data, forced a save of persistant states (homeassistant.save_persistent_states service), just to be sure, and restarted HA. No warnings this time.

oeriksen commented 2 years ago

By the way, I see you have a typo in the new (my) Kamstrup meter type. You have written 6851128 but it is 6841128.

turbokongen commented 2 years ago

I have changed the meter type, and uploaded the changes. Please re-download the https://github.com/turbokongen/hass-AMS/tree/v1.7.2 I also noticed that my new code would not run unless i stopped and then started homeassistant. A restart would only use the cache of python packages. The error you saw was corrected with the latest code I uploaded yesterday.

oeriksen commented 2 years ago

Looking good now :+1: