LavermanJJ / home-assistant-solarfocus

🏡 Solarfocus eco manager touch integration for Home Assistant
Apache License 2.0
14 stars 4 forks source link

Unfortunately, I still get an error when I want to query the COP value. #26

Closed Vaszago closed 1 year ago

Vaszago commented 1 year ago
    Unfortunately, I still get an error when I want to query the COP value.

image

Here is the entry in Yaml

image

But the code works under template

image

What am I doing wrong

Originally posted by @Vaszago in https://github.com/LavermanJJ/home-assistant-solarfocus/issues/15#issuecomment-1302996779

LavermanJJ commented 1 year ago

I'm still investigating myself. I'll let you know one if fixed it.

LavermanJJ commented 1 year ago

I've extended it a little bit, to check for 0.0 values to avoid division by zero. However, your error message seems to be related to the overall structure: sensor -> template -> sensors -> solarfocus_heat_pump_cop

Below is the structure of my config:

sensor:
  - platform: template
    sensors:
      solarfocus_heat_pump_cop:
        friendly_name: "COP"
        unit_of_measurement: "W/W"
        icon_template: mdi:poll
        value_template: >
          {% if states("sensor.solarfocus_heat_pump_electrical_power") | int == 0 %}
          0.0
          {% else %}
          {{ '%0.f' | format(float(states('sensor.solarfocus_heat_pump_heating_thermal_power'), 0.0)  / 
              float(states('sensor.solarfocus_heat_pump_electrical_power'), 0.0)
          ) }}
          {%endif%}
LavermanJJ commented 1 year ago

I decided to re-introduce the COP calculation to the library and make it more specific:

The only thing that has to be done within HA (due to the missing persistence of the library itself), is the calculation of the Jahresarbeitszahl (JAZ, annual performance number). I'll close this issue, as soon as the release is out.

Vaszago commented 1 year ago

Hi I had to adjust the code a bit. My query now works correctly.

image

That would be great if you could tie it in like this.

Vaszago commented 1 year ago

It would be cool if you could also include the outside temperature of the WP in your query. Then I could delete the manual query via Modbus.

image

LavermanJJ commented 1 year ago

@Vaszago please create a new issue for that. Thanks

LavermanJJ commented 1 year ago

@Vaszago COP is now available again. The cop_heating corresponds to the former coefficient of performance provided by the integration.