kamaradclimber / heishamon-homeassistant

An integration for heatpumps handled by heishamon
Apache License 2.0
41 stars 22 forks source link

Consumption data is "unknown" #182

Closed Safs closed 2 months ago

Safs commented 7 months ago

Core 2024.1.2 Supervisor 2023.12.0 Operating System 11.3 Frontend 20240104.0

This integration version: 1.5.1

Why consumption data is "unknown"?

image

Bucky2k commented 7 months ago

Had the same, but already 2-3 weeks ago. I needed to completely reinstall Heishamon integration (incl. deletion of entities), as my entities still contained "energy" rather than "power" in their naming. Only the name tag was corrected, not the entity name itself

Safs commented 7 months ago

Yes, the situation has been there for some time.

Bucky2k commented 7 months ago

Not sure of this breaking change can be easily catched. On Heishamon all names have changed to power - so the entities need to be renamed in HA. Can this be automated?

Safs commented 7 months ago

So, what I need to do? I need rename those entities?

Bucky2k commented 7 months ago

I uninstalled the integration from HACS, manually deleted remaining associated entities manually (I think there were some) and then reinstalled after a fresh HA restart. However, counters are reset to 0

On the dashboards, I only needed to updated entities that changed and were not found anymore

kamaradclimber commented 7 months ago

In theory, counters should have been upgraded when moving from heishamon 3.0 to 3.2+. However in case of issue, indeed, reinstallation of this integration helps (or even better: clean of mqtt messages in your broker).

I'm trying to have backward compatible code but lack of testing of this integration leads to bugs indeed, sorry! I'd be happy to solve it. Can you provide:

Safs commented 7 months ago

heishamon version 3.2.3

How to see relevant mqtt topics?

kamaradclimber commented 7 months ago

You have to use a software such as "MQTT Explorer" which allows to explore the content of your MQTT broker.

Safs commented 7 months ago

What data do You need?

image

Bucky2k commented 7 months ago

I would like to help, but I don't know what you are up to Safs...

In the past the mqtt stack contained the words "power" I side the relevant topics. Equally, also the HA entity names were named accordingly.

Now it the names changed to "power" on the MQTT topics and it might be good to identify and clear the old topics. Those resulted into double counting and wrong COP/Power readings for a while, but I thought this error is now catched by the integration automatically.

But the issue at hand is different. The entity names in HA never changed - they were still containing "energy" in the name and therefore COP calculation and the counters for kWh did not work anymore. For this you have to delete and reinstall the Heishamon integration from HA - that's it

Bucky2k commented 7 months ago

E.g. what is the name of your entity: Aquarea Heat Power Produced ?

It should be "sensor.panasonic_heat_pump_main_heat_power_production"

It might be still "sensor.panasonic_heat_pump_main_heat_energy_production" (or similar). In that case you need to re-install and the counters start working again

Safs commented 7 months ago

Yes, it is "sensor.panasonic_heat_pump_main_heat_energy_consumption" But if I re-install hesiamon, then I will lost all my history data?

Bucky2k commented 7 months ago

Yes, that happened to me and I have not found a way to reset the counters to the old value again (will always be overwritten again after a short time :(

Safs commented 7 months ago

Then that is not solution for me. I do not want to lose 2 years data. As I understand, problem is at my side, and that is not an plugin isusse.

kamaradclimber commented 7 months ago

What data do You need?

image

You should open the main section and delete everything containing "energy" (those are deprecated topics and are not published anymore) In case of doubt this is quite safe to delete all topics, they should be recreated by heishamon on next change (or at worst every 5 minutes).

I think it should fix the unknown you face. Otherwise, please look at your integration logs, maybe there are errors.

Bucky2k commented 7 months ago

But @kamaradclimber, now I am curious: The change on MQTT topics is clear, but did you ever adapt the integration, to actively and retrospectively change the entity naming in HA? I think not and the problem seems to be, that the counters of recent versions of your integration are posting "unknown" as they are looking for entities with the new name oder am I mistaken? Again, entity name, not MQTT topic name

Bucky2k commented 7 months ago

Then that is not solution for me. I do not want to lose 2 years data. As I understand, problem is at my side, and that is not an plugin isusse.

Maybe try to rename the entities manually (after taking a backup)?

kamaradclimber commented 7 months ago

Are we talking about the same entities? For instance the "Pump total consumption" entities is not referring to other entities but directly to mqtt topics (source )

Bucky2k commented 7 months ago

Are we talking about the same entities? For instance the "Pump total consumption" entities is not referring to other entities but directly to mqtt topics (source )

Not sure to be honest, I am not exactly sure how the integration is creating the entity during first installation.

But before the changes on MQTT heishamon side, one of the riemann integral entities created in HA was named "sensor.aquarea_heat_energy_consumed_total". At some point after updates, the integration showed "unknown" for heat power consumed total and the other similar sensors. I guess the stock dashboard was looking for "sensor.aquarea_heat_power_consumed_total", but in HA the only entity name was still present. Deinstalling and reinstalling the integration set up the entity name following the same new name as the MQTT topics (e.g. sensor.aquarea_heat_power_consumed_total). Since then, I see the sensor values (current and totals) again

kamaradclimber commented 7 months ago

Indeed, you’re right, I forgot about riemann integrals (https://github.com/kamaradclimber/heishamon-homeassistant/blob/59ca622be4b9b0d13704e1d586ddb66117333f26/custom_components/aquarea/sensor.py#L184-L195).

To see the source, use developer tools: image

MEKadan commented 6 months ago
  1. I have the same problem

image

  1. I do not have any "energy" MQTT topics. They are all like this

image

In the sensor section there are e.g. image

...which take the entity name in HA in a form like this: sensor.panasonic_aquarea_main_heat_energy_consumption and sensor.panasonic_aquarea_main_heat_energy_production (That panasonic_aquarea -prefix comes from my Heisha Monitor original setting of my Mqtt topic base)

I actually did not even notice this change of behaviour earlier, because I have not used these provided Riemann integrals (which do not work currently). Instead of that, I have used these 'energy' entities to create my own Riemann integrals (and utility meters based on those, if that matters). I also calculate the COP based on these.

Still, it is not clear to me what is the outcome of all the discussion above?

What do I need to do? Or is there an update coming up sometimes in the future because of these "forgotten Riemann integrals"?

Actually, I probably don't even need these currently non-working sensors, so I could be fine like this, but it is a somewhat trivial solution just to leave it be...

Bucky2k commented 6 months ago

If you don't care about the values of those integrals, just deinstall/reinstall Heishamon. Entities will change from having "energy" in the naming to "power" and everything works again

MEKadan commented 6 months ago

If you don't care about the values of those integrals, just deinstall/reinstall Heishamon. Entities will change from having "energy" in the naming to "power" and everything works again

Yes, I noticed from above that would be one possible way to do it, however, it is unclear to me, what as a whole will change (maybe some other entities as well, and which I might be using?) and lastly, do I loose some of my history data?

MEKadan commented 6 months ago

Entities will change from having "energy" in the naming to "power" and everything works again

If by this you mean my sensors like sensor.panasonic_aquarea_main_heat_energy_consumption and sensor.panasonic_aquarea_main_heat_energy_production will change, they are exactly the ones I use to calculate my Riemanns and utility meters which means I need to use a different source sensors for them. Won't this cause a loss of history data?

Some time again, when there was a change from these energyto power sensors, I think it was done so, that the old energy sensors and new powersensors were summed, and the resulting sensor was still the old energysensor and because of summing, could hold both old and new data?

Bucky2k commented 6 months ago

You need your Riemans to adopt the new source sensor. But their value remains (do backup for rollback before just in case)

kamaradclimber commented 6 months ago

Bucky2k is right: if you uninstall/reinstall the integration, your own riemann counters will not be impacted (you'll just need to change the source sensor).

MEKadan commented 6 months ago

How do I actually uninstall this ? I f I go to HACS - Heishamon and from 3 dots on the upper right corner 3 dots select Remove, I get this: image

If I select Navigate, it takes me to Settings-> Integrations page and selecting Heishamaon it gives

image

So, do I delete it from there first? And then from HACS?

Installation as per https://github.com/kamaradclimber/heishamon-homeassistant/ ?

Do I need to manually delete some entities etc.?

kamaradclimber commented 6 months ago

Yes indeed:

You should not have to delete any entity.

MEKadan commented 6 months ago

OK, thanks! All set now.

kamaradclimber commented 2 months ago

I'll close that issue but feel free to put a comment if there are any news

Bucky2k commented 2 months ago

@kamaradclimber Hmm, since ~ 10 days the Riemann integral sensors for the totals went unknown. After I did a HACS Heishamon reinstall, they also don't come back. Have they been removed from the integration?

Bucky2k commented 2 months ago

Screenshot_20240703_233947_Home Assistant

kamaradclimber commented 2 months ago

I think the issue is a bit different, it was reported in #222 and is due to a change in the constructor of Riemman Integral sensor in HA 2024.7. Fixed in 1.9.2. Please open a new issue if it is not fixed.