marcopal74 / home-assistant-palazzetti

Definitive Palazzetti SmartStoves integration for Home Assistant
MIT License
12 stars 7 forks source link

Constant disconnections #8

Open rul3zz opened 2 years ago

rul3zz commented 2 years ago

Hi The integration has constant disconnections making the stove unusable via HA, is there any way to fix this? This is an example of an entity, but this happens to all entities except binary_sensor.connbox (stays connected)

Screenshot_2

JiMSigneLesArbres commented 2 years ago

same for me :

image

marcopal74 commented 2 years ago

I've to look into it. Also my boiler reports multiple disconnections but the integration is not unusable, so might be a kind of "false issue".

image

This is a screenshot of my "control panel" for the connection status of my Palazzetti products.

So, every time you have a network problem there is also a Product disconnection. For the same reason every time you have a Product disconnection all the entities become unavailable.

This is to share with you how it should work.

The KeepAlive process inside the integration can use either a UDP call or an HTTP call to check connectivity. The UDP is quicker but less reliable. Maybe you could try to switch to the HTTP call.

I'll let you know how to try this fix.

marcopal74 commented 2 years ago

Does anybody else experience those Product disconnections AND cannot execute commands properly? Thank you for your feedback.

rul3zz commented 2 years ago

Does anybody else experience those Product disconnections AND cannot execute commands properly? Thank you for your feedback.

The only thing I could see is that the problem occurs very frequently with the stove on, but with the stove off I notice about ten disconnections during the day .. looks like interference during use. The connection box is connected via Wifi, I will try via Ethernet as soon as possible.

marcopal74 commented 2 years ago

Does anybody else experience those Product disconnections AND cannot execute commands properly? Thank you for your feedback.

The only thing I could see is that the problem occurs very frequently with the stove on, but with the stove off I notice about ten disconnections during the day .. looks like interference during use.

OK @rul3zz this is an important information. Which product do you have? Because I know that some products might have this problem. If you can provide the serial number I can tell you if it's possibly affected by the interference you mentioned.

The connection box is connected via Wifi, I will try via Ethernet as soon as possible.

Ethernet is always better but doesn't help for this issue.

rul3zz commented 2 years ago

OK @rul3zz this is an important information. Which product do you have? Because I know that some products might have this problem. If you can provide the serial number I can tell you if it's possibly affected by the interference you mentioned.

I have a Ecofire Allegro with this serial number LT202113780580533057300

Ethernet is always better but doesn't help for this issue.

as I expected nothing has changed via eth

marcopal74 commented 2 years ago

I have a Ecofire Allegro with this serial number LT202113780580533057300

Thank you. As far as I know Allegro is not effected by interference... so I have to dig more in deep into this Integration.

rul3zz commented 2 years ago

I have a Ecofire Allegro with this serial number LT202113780580533057300

Thank you. As far as I know Allegro is not effected by interference... so I have to dig more in deep into this Integration.

If you need anything, I'm happy to help

marcopal74 commented 2 years ago

@rul3zz this is what you could try:

  1. edit the file custom_components/palazzetti/__init__.py
  2. at row 72 there is this block of code:

    async def async_upd_alls(hass: HomeAssistant, entry: ConfigEntry):
    myhub = hass.data[DOMAIN][entry.entry_id]
    # this update takes care to activate callbacks to update UI
    # in case something goes offline
    await myhub.async_update(deep=False)
    
    if myhub.product_online:
        _api = myhub.product
        if _api:
            await _api.async_get_alls()
    return
  3. change the line await myhub.async_update(deep=False) to await myhub.async_update(deep=True)
  4. save the file
  5. cross your fingers and restart Home Assistant

This flag allows the integration to make a HTTP call to the CBox if the UDP call fails. Should be more reliable.

Let me know if this solves the issue.

rul3zz commented 2 years ago

@rul3zz this is what you could try:

  1. edit the file custom_components/palazzetti/__init__.py
  2. at row 72 there is this block of code:
async def async_upd_alls(hass: HomeAssistant, entry: ConfigEntry):
    myhub = hass.data[DOMAIN][entry.entry_id]
    # this update takes care to activate callbacks to update UI
    # in case something goes offline
    await myhub.async_update(deep=False)

    if myhub.product_online:
        _api = myhub.product
        if _api:
            await _api.async_get_alls()
    return
  1. change the line await myhub.async_update(deep=False) to await myhub.async_update(deep=True)
  2. save the file
  3. cross your fingers and restart Home Assistant

This flag allows the integration to make a HTTP call to the CBox if the UDP call fails. Should be more reliable.

Let me know if this solves the issue.

I tried this morning but unfortunately I didn't notice any improvement

mars-cmd commented 2 years ago

Hi @marcopal74,

Since the integration in Home Assistant, I am experiencing two problems:

The first one, disconnections like the user (rul3zz) from the cibox and the stove entries in Home Assistant. The second problem: At times the stove restarts automatically without reason (I use the schedule in the application).

Analysis of the first problem: After some research I see that this problem comes directly from the cibox ( I test the API via requests and I have very often Time Out ). A ticket is opened to the support ( since 3 months ) to try to find the cause knowing that the wifi connection is good (antenna at 5 m with a 65/70 db).

Analysis of the second problem: Wouldn't there be an explanation on the side of Home Assistant? When it loses the connection with the stove and finds it again, would it launch a stop/start of the stove?

Finally, would my stove be affected by any problem, here is the serial number: LT202032180580584064046

Thank you in advance, I am available to exchange with you technically.

2022-03-08_14h26_34

marcopal74 commented 2 years ago

Hi @mars-cmd, first of all thank you for the detailed informations, my purpose is to improve the integration and not to create problems so those info are precious for me.

I start from problem two:

Analysis of the second problem: Wouldn't there be an explanation on the side of Home Assistant? When it loses the connection with the stove and finds it again, would it launch a stop/start of the stove?

Definitely no: I do only keep on calling a GET STDT either via UDP or also HTTP (that's the meaning of the deep flag in the async_keep_alive function) until I receive an answer to identify that the connection is on again.

Once online again I go for GET ALLS every 30", GET STDT every 7 days and GET CNTR every 300":

INTERVAL = timedelta(seconds=30)  # Interval for check dynamic data
INTERVAL_CNTR = timedelta(seconds=300)  # Interval for check counters
INTERVAL_STDT = timedelta(days=7)  # Interval for check static data

On this I have a question: were you experiencing those random ON/OFF before installing the integration?

for problem one:

The first one, disconnections like the user (rul3zz) from the cibox and the stove entries in Home Assistant.

As mentioned above and in the integration documentation I do a continuous polling to the CBox local API to update the data. The GET ALLS call takes almost 7 seconds to execute, it could be that I'm a bit overloading the CBox which is not dimensioned for multiple concurrent API calls. Also remember that the APP calls a GET ALLS every 10" when active in any screen of the stove.

Also in my home installation I have several "disconnections" but not side effects in terms of usability of the APP or of Home Assistant. As I wrote to @rul3zz I need some time/help from other developers to see how to make it more reliable and avoid those disconnections.

Finally:

After some research I see that this problem comes directly from the cibox ( I test the API via requests and I have very often Time Out ).

I give you a hint: try to test the GET LALL (it's an undocumented API command) that is equivalent to GET ALLS but reads data from the CBox RAM instead of asking directly to the stove via the serial port. It should answer immediately (not to wait the above mentioned 7") but data is updated every 30". It's the same as the UDP GET ALLS call but available via HTTP API. If also this call has goes in timeout either there is a network issue or a problem in the CBox.

THE LAST TRY: if everything goes bad the last possible try is to call the GET LABL command via API (it returns the name you have given to the stove) with the serial cable disconnected from the stove. In this way we can diagnose the potential interference in the communication between the stove and the CBox.

Please let me know any output of your tests.

RonandoDeLaVega commented 2 years ago

Hello,

Could the issue come from the version of Home Assistant ?

I'm on a raspberry pi and I have the same issue since I upgraded Home assistant Core (2022.2.9 -> 2022.4.5)

image

Thanks, Ronan

Sieste68 commented 1 year ago

Does anybody else experience those Product disconnections AND cannot execute commands properly? Thank you for your feedback.

Hi. I did the swith to the latest version of HA and this component and have the same issue presented here. I'm open to work with you to solve it. Thanks

I activated logs and got this when i restarted:

2022-12-21 14:13:01.112 DEBUG (MainThread) [custom_components.palazzetti] Init of palazzetti component 2022-12-21 14:13:34.095 ERROR (MainThread) [homeassistant] Error doing job: Task exception was never retrieved Traceback (most recent call last): File "/config/custom_components/palazzetti/input_number.py", line 59, in create_input_number "max": _config["_value_fan_limits"][(((fan - 1) * 2) + 1)], TypeError: 'NoneType' object is not subscriptable

RonandoDeLaVega commented 1 year ago

Does anybody else experience those Product disconnections AND cannot execute commands properly? Thank you for your feedback.

Hi. I did the swith to the latest version of HA and this component and have the same issue presented here. I'm open to work with you to solve it. Thanks

I activated logs and got this when i restarted:

2022-12-21 14:13:01.112 DEBUG (MainThread) [custom_components.palazzetti] Init of palazzetti component 2022-12-21 14:13:34.095 ERROR (MainThread) [homeassistant] Error doing job: Task exception was never retrieved Traceback (most recent call last): File "/config/custom_components/palazzetti/input_number.py", line 59, in create_input_number "max": _config["_value_fan_limits"][(((fan - 1) * 2) + 1)], TypeError: 'NoneType' object is not subscriptable

Hello Sieste68,

I have the issue after each upgrade of version of HA. Each time I recharge the Integration & it get back to normal ...

image

Sieste68 commented 1 year ago

Hi RonandoDeLaVega,

In fact, I have this issue just after removing the component, restart HA, install again the component, and restart HA. I reloaded the component without any "effect", unfortunately image

Zesstra69 commented 11 months ago

Pinging here guys - Ok, old topic but:

I have a Palazzetti s/n: LT201825680580456026964 : "Bianca 9" and the connection is not stable too. It disconnects / reconnects something like each 5 min :-(.

To compensate, I have written down my own FSM synchronizing with the device after each reconnection. That's working fine, it's not a drama if there is a 2 min delay between the desired state and the real state.

... but I would rather prefer trying to fix the problem into the connector itself but it goes beyond my current knowledge of HA. Any clue ? Any light from you guys before digging into this one myself somedays ?

Zess