kamaradclimber / heishamon-homeassistant

An integration for heatpumps handled by heishamon
Apache License 2.0
50 stars 25 forks source link

problem with zones #72

Closed meavric closed 1 year ago

meavric commented 1 year ago

Hi, I use your code with my Aquarea 9kW series J. I have problems with zones. I don't know why HA change my settings from zone 1 + 2 to zone 1. This is big problem because one zone is off and is cold in home. Please check mayby is somthing wrong in code?

Your project is very good. Good job!

kamaradclimber commented 1 year ago

Hello thanks for your report. First if you house is cold because of automation, please deactivate HA integration until we clearly understand what's going on.

Please check mayby is somthing wrong in code?

Sadly, without more details I can't really dig in the code to try to understand what could be wrong. Could you describe what happens precisely please? Specifically:

For those questions, it might be relevant to look at what the heatpump display is showing, what heishamon web interface displays and what HA displays.

Finally, it might relevant to activate debug logs for this integration:

logger:
  logs:
    custom_components.aquarea: debug

and post result here (only the relevant lines if possible).

meavric commented 1 year ago

Hi again, After your advice, I found one dependency: when I turn off my raspberry PI with HA and turn it on again, the zone is set to 1, even though there was zone 1 + 2 before the restart

Changes occur automatically, e.g. tonight I did nothing in HA and in the morning the zone was set to 1.

At this moment in logs i don't see any errors.

BR

geduxas commented 1 year ago

@meavric do you still use heishamon manual mqtt configuration with heishamon.yaml file? Maybe those automations do nasty work after restart?

meavric commented 1 year ago

I have my heishamon.yaml with my counters, but i only count, no set values and stans. This is my config:

mqtt:
  sensor:
    #TOP11 - Compressor Operating Time
    - name: Aquarea Czas działania sprężarki
      object_id: Aquarea_Czas_dzialania_sprezarki
      state_topic: "panasonic_heat_pump/main/Operations_Hours"
      unit_of_measurement: "Hours"
      state_class: total
    #TOP12 - Compressor On/Off cycle number
    - name: Aquarea Ilość załączeń sprężarki
      object_id: Aquarea_Ilosc_zalaczen_sprezarki
      state_topic: "panasonic_heat_pump/main/Operations_Counter"
      state_class: total
    #TOP94 - Zones state (0 = zone1 active, 1 = zone2 active, 2 = zone1 and zone2 active)
    - name: Aquarea Obieg grzania
      object_id: Aquarea_obieg_grzania
      state_topic: "panasonic_heat_pump/main/Zones_State"
      value_template: >-
        {%- if value == "0" -%}
          Obieg 1
        {%- elif value == "1" -%}
          Obieg 2
        {%- elif value == "2" -%}
          Obieg 1 i 2
        {%- endif -%}

sensor:
  #### SENSORS BELOW ARE NOT IN FIRMWARE ####

  #Calculation Energy consumed (kWh) - DHW
  - platform: integration
    source: sensor.panasonic_heat_pump_main_dhw_energy_consumption
    name: Aquarea DHW Energy Consumed
    unit_prefix: k
    method: left
  #Calculation Energy consumed (kWh) - Heat
  - platform: integration
    source: sensor.panasonic_heat_pump_main_heat_energy_consumption
    name: Aquarea Heat Energy Consumed
    unit_prefix: k
    method: left

  #wsp pracy
  - platform: template
    sensors:
      heishamon_work_hours:
        unique_id: heishamon_work_hours
        friendly_name: "Aquarea Wsp. pracy sprężarki"
        unit_of_measurement: "x"
        value_template: >
          {{ ((states('sensor.Aquarea_Ilosc_zalaczen_sprezarki') | float ) / (states('sensor.Aquarea_Czas_dzialania_sprezarki') | float )) | round(3) }}

template:
  #laczne zuzycie energii
  - sensor:
      - name: "Aquarea Zużycie łączne energii CO + CWU"
        unique_id: aquarea_co_cwu_zuzycie_energii
        device_class: "energy"
        state_class: total_increasing
        unit_of_measurement: "kWh"
        state: >
          {% set cwu = states('sensor.Aquarea_DHW_Energy_Consumed') | float %}
          {% set co = states('sensor.Aquarea_Heat_Energy_Consumed') | float %}
          {{ (co + cwu)  | round(3, default=0) }}
  - sensor:
      - name: "Aquarea COP wykres"
        unique_id: aquarea_cop_wykres
        state_class: total_increasing
        unit_of_measurement: "x"
        state: >
          {% set cop = states('sensor.aquarea_cop') | float %}
          {{ (cop)  | round(1, default=0) }}
geduxas commented 1 year ago

and what about automation rules? in yaml file there was many automations to set/get/change values.. do you removed all automation rules from yaml?

kamaradclimber commented 1 year ago

Could you describe what happens precisely please? Specifically:

* before you start HA what was the status of zones (I assume 1+2 were on, lets confirm it)

* when you started HA, before interacting at all with anything, what was the status of zones? (it should still be 1+2)

* what are the actions taken in HA that led to the incorrect setup? (any change of configuration attempted from HA?)

For those questions, it might be relevant to look at what the heatpump display is showing, what heishamon web interface displays and what HA displays.

Could you run the scenario I proposed :arrow_up: ? (with a reboot of your raspberry since it appears to trigger the issue)

I expect it to make visible the behavior and inconsistencies between heatpump, heishamon and HA views. Or at least it should (if you get the debug logs activated) shows one of the entity to send an MQTT message changing the ZoneState.

kamaradclimber commented 1 year ago

I'll also go a bit further than @geduxas idea: are you able to reproduce the issue if you disable all manual configuration/automations? And are you able to reproduce it if you disable this integration (heishamon-homeassistant)?

meavric commented 1 year ago

Geduxas: You say about file in config/automations.yaml ? - this file is empty I removed my config file and after reboot Raspberry zone change to 1 - this is not a problem.

meavric commented 1 year ago
kamaradclimber commented 1 year ago

Thanks for having done this test. Do you see the "Zone 1" both on your heatpump, heishamon web interface and HA UI ? If that's the case, it would confirm that the issue is not a bug in HA view of the world but that is sending an order to the heatpump.

Also could you test all things proposed above?

geduxas commented 1 year ago

Geduxas: You say about file in config/automations.yaml ? - this file is empty I removed my config file and after reboot Raspberry zone change to 1 - this is not a problem.

No not automation.yaml... in heishamon.yaml if you are still using it, there was automation rules.. or there is left only that you have posted?

meavric commented 1 year ago

In heishamon.yamal i have only that what i posted.

I runed mqtt explorer and after restart raspberry i see commands:

commands = "reboot" SetZones = 0 LWT = Offline SetQuietMode = 3 SetDHWTemp = "umount /overlay"

I here one intresting thing - zones set 0 and in HA i see active only 1 zone it is correct (mqtt explorer data = HA data), but here is changed QuietMode too to 3 but i don't see it in HA - i see in ha status off and it is correct status.

PGnl commented 1 year ago

I never had this issue, and I am using 2 zones as well. Are you sure you are working from a clean system.

Remove heishamon.yaml. reboot system Remove all devices linked to that (they will show as "not available"). reboot system again.

For me, 2 zones works out of the box, however before transferring, I started from a clean HA install as I wanted to transfer from my RPI4 to proxmox anyway. I backed up my HA with only the items I wanted (thus excluding heisha and some other stuff) and transferred that to my new setup.

geduxas commented 1 year ago

For me strange looks command reboot.. and lwt offline means that heishamon goes offline.. it's seams that it truely rebooting.. and also strange looking set commands.. didn't noticed that ether.. which firmware version your are using?

meavric commented 1 year ago
logger:
  logs:
    custom_components.aquarea: debug

I added this section to main configuration.yaml HA is it correct?

meavric commented 1 year ago

I use last one 1.0.1 and Heisha monitor firmware in version 3.0

kamaradclimber commented 1 year ago

commands = "reboot" SetZones = 0 LWT = Offline SetQuietMode = 3 SetDHWTemp = "umount /overlay"

Unless I misunderstand :arrow_up: , there is something very fishy here!

SetDHWTemp = "umount /overlay looks like something is sending an MQTT message based on a unix command to manage filesystem.

meavric commented 1 year ago

My Raspberry is connect with hard disk via usb. Can it was a problem?

kamaradclimber commented 1 year ago

I don't think so.

Let's try to simplify the problem: does the incorrect behavior (zone set) happens when you restart HA (without restarting your raspberry)? Also: If you shutdown HA (and prevent it to restart after a reboot), then reboot your raspberry. What happens to your zone configuration?

For context: does your MQTT server runs on the raspberry as well?

meavric commented 1 year ago

When i run development tools and reboot then zones are ok (are set zone 1 and 2 ). When i run settings ->system and reboot then zones are ok (are set zone 1 and 2 ) too.

When i run settings ->system->hardware and reboot system then the zones has changed from 1 + 2 to zone 1.

MQTT server is running on this raspberry

kamaradclimber commented 1 year ago

Ok thanks for this. At this point, I assume the issue is not caused by HA shutting down but rather by something sending data to MQTT server during poweroff.

I guess you are running HA operating system. Do you have a way to just switch off HA (but not the raspberry itself)? If that's the case, please do it, wait a few minutes (ensure your zones are still set to 1+2 by looking at your heatpump) and then reboot the raspberry. I expect it to demonstrate the bug.

kamaradclimber commented 1 year ago

Alternative test scenario: uninstall HeishaMon HA integration (then restart HA to make sure state is completely cleared) and then reboot your raspberry. I would also expect the issue to appear (i.e zones to move from 1+2 to 1).

meavric commented 1 year ago

i don't know how disable only HA:(

kamaradclimber commented 1 year ago

No pb, the alternative test I proposed above should be enough.

geduxas commented 1 year ago

@kamaradclimber probably it will not work.. if @meavric using HA image in raspberry, there will be everything in docker. So same MQTT server is in additional docker instance. So reboot HA, restarts HA docker image. And reboot raspberry will restart whole device.. if it's from MQTT server, perhaps @meavric could try reboot only MQTT addon..

Also i have one idea, @meavric could you turn off heishamon, and clean all panasonic topic from mqtt explorer.. i think it could be stored data in mqtt which becames active while rebooting it..

meavric commented 1 year ago

@geduxas - could you turn off heishamon - you thing about PCB device?

geduxas commented 1 year ago

@geduxas - could you turn off heishamon - you thing about PCB device?

Yes, turn it off, or disconnect from network..

meavric commented 1 year ago

I plugoff heishamon PCB from pomp and removed all in MQTT Explorer, restart Raspberry and i dont see any topic to send to PCB in MQTT Explorer When i plugon heishamon PCB to pomp still not sent Topic to PCB in MQTT explorer (only reads topics). Still all zones are on. After reboot Raspberry still MQTT explorer only reads topics, all zones are online. I changed in HA zone from 1+ 2 to 1 in MQTT Explorer i see this change. I back from zone 1 to zone 1+2 and reboot raspberry and still is correct (2 zones) One more time rebbot and still ok. I set quiet mode to 3 and off , reboot and still all is ok. Hmm any ide what is happend?

geduxas commented 1 year ago

i think some topics got retained flag.. and after you restarting mqtt server, those retained topics are restored.. and send to heishamon.

meavric commented 1 year ago

ok thx all for your help, i hope it is end my problem:)

kamaradclimber commented 1 year ago

Good catch @geduxas ! What I find weird is that the integration does not send messages with the retain flag.

Anyway I'll close the issue. @meavric don't hesitate to comment if the issue is not fixed after all and I'll reopen.