BenPru / luxtronik

Luxtronik integration for Home Assistant
MIT License
74 stars 28 forks source link

[Errno 107] Socket not connected #202

Open Crashman1983 opened 10 months ago

Crashman1983 commented 10 months ago

This happened a few times since I started to use the new version of Luxtronik. Have not seen this before. It results on complete loss of all entities (unavailable) until I restart HA.

Logger: custom_components.luxtronik2 Source: custom_components/luxtronik2/lux_helper.py:157 Integration: Luxtronik First occurred: 14:58:47 (841 occurrences) Last logged: 17:18:47

Unexpected exception when checking if a socket is closed Traceback (most recent call last): File "/config/custom_components/luxtronik2/lux_helper.py", line 157, in _is_socket_closed data = sock.recv(16, socket.MSG_DONTWAIT | socket.MSG_PEEK) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ OSError: [Errno 107] Socket not connected

BenPru commented 10 months ago

@Crashman1983 I have added a handling in the main branch. Please try the main branch.

Crashman1983 commented 10 months ago

Hi!

i installed the main branch yesterday. I got another Error today, but your fix seems to be successful in terms of keeping the integration running.

But is it possible, that the integration sends incorrect values for heat amount when this error occurs? I am using a template sensor to add dhw_heat_amound and heat_amount_heating to heat_amount_total.

  - unique_id: luxtronik_heat_amount_total
    unit_of_measurement: "kWh"
    device_class: energy
    state_class: total_increasing
    availability: >
      {{ states('sensor.luxtronik_310312_0495_heat_amount_heating') not in [ unknown, unavailable, none ] and
           states('sensor.luxtronik_310312_0495_dhw_heat_amount') not in [ unknown, unavailable, none ] }}
    state: >
      {% set t = states('sensor.luxtronik_310312_0495_heat_amount_heating') | float %}
      {% set u = states('sensor.luxtronik_310312_0495_dhw_heat_amount') | float %}
      {{ (t+u) | round(1) }}

Whenever this happens, the template sensor jumps to zero, and after restart of the integration, the new template_sensor value is slightly lower, than before. I cannot explain that behavior.

image

What I can see is a kind of peak in heat_amount_heating, that I can't explain as well.

image
BenPru commented 10 months ago

If the values could not updated, e.g. network error, the sensor values should become the "unavailable" state. But I think this is a bigger change. E.g. in a future release.