tech-controllers icon indicating copy to clipboard operation
tech-controllers copied to clipboard

[Bug]: Entities hold the last value instead becoming unavailable when there is no communication

Open ZdenekM opened this issue 1 year ago • 9 comments

The problem

If the boiler is offline, entities provided by the integration hold the last obtained value instead of becoming unavailable (after some time), which would be more logical behavior, I think.

What version of Tech Controllers integration has the issue?

2.5.0

What version of Home Assistant Core has the issue?

2024.10.1

What was the last working version of Tech Controller integration?

No response

Diagnostics information

No response

Anything in the logs that might be useful for us?

No response

Additional information

No response

ZdenekM avatar Oct 08 '24 08:10 ZdenekM

can you provide API answer for two scenarios:

  1. everything is online and works as expected
  2. when boiler is offline

as we need understand does this is API behaviour or something what we can change on integration

daroga0002 avatar Oct 08 '24 13:10 daroga0002

Is this what you need? The Web UI is definitely aware that the boiler is online/offline.

Snímek obrazovky z 2024-10-08 15-17-28 Snímek obrazovky z 2024-10-08 15-14-35

kotel-online.json boiler-offline.json

ZdenekM avatar Oct 08 '24 13:10 ZdenekM

Does those json files are from API response as per: https://github.com/mariusz-ostoja-swierczynski/tech-controllers/blob/main/CONTRIBUTING.md#getting-json-data-from-emodul

??

In general there is no info about any state or etc. so asusming it is something different

daroga0002 avatar Oct 09 '24 08:10 daroga0002

Sorry... I missed those instructions. kotel-online.json kotel-offline.json

ZdenekM avatar Oct 09 '24 09:10 ZdenekM

@ZdenekM I don't have tests or means to properly verify this, but here is a blind attempt to fix this, so if you can, please check this version: https://github.com/mariusz-ostoja-swierczynski/tech-controllers/archive/refs/heads/issue_120.zip

Please enable debug and collect debug logs, ideally when boiler is online and then offline

anarion80 avatar Oct 10 '24 11:10 anarion80

@anarion80 Thanks for your effort. I copied files to HA, restarted it, enabled debug logs, and reloaded the integration. The boiler was first offline, then I disabled logging and saved the file, switched on the boiler, waited until it became online, switched the debug logging on again, reloaded the integration, kept it running for a while, and then turned off debug logging again and saved the file. Strangely, I can only see 'controllerStatus': 'active' in the logs, like it was online the whole time, but it certainly wasn't.

home-assistant_tech_2024-10-14T09-40-36.975Z-online.log home-assistant_tech_2024-10-14T09-36-10.790Z-offline.log

ZdenekM avatar Oct 14 '24 10:10 ZdenekM

Hmm, previously you reported that when boiler is offline, the returned JSON is pretty much empty:

{
    "tiles": [],
    "zones": {
        "elements": [],
        "globalSchedules": {
            "elements": []
        }
    },
    "menu": {
        "elements": []
    },
    "parents": [],
    "lastUpdate": null,
    "moduleStatus": "inactive",
    "controllerStatus": "active",
    "init": false
}

but now in the offline version, it seems like there is always something there:

[custom_components.tech.entity] _handle_coordinator_update: {'id': 1003, 'parentId': 0, 'type': 11,
[custom_components.tech.entity] _handle_coordinator_update: {'id': 1004, 'parentId': 0, 'type': 11,
[custom_components.tech.entity] _handle_coordinator_update: {'id': 1016, 'parentId': 0, 'type': 2, 
[custom_components.tech.entity] _handle_coordinator_update: {'id': 1020, 'parentId': 0, 'type': 11,
[custom_components.tech.entity] _handle_coordinator_update: {'id': 1003, 'parentId': 0, 'type': 11,
[custom_components.tech.entity] _handle_coordinator_update: {'id': 1004, 'parentId': 0, 'type': 11,
[custom_components.tech.entity] _handle_coordinator_update: {'id': 1016, 'parentId': 0, 'type': 2, 
[custom_components.tech.entity] _handle_coordinator_update: {'id': 1020, 'parentId': 0, 'type': 11,
[custom_components.tech.entity] _handle_coordinator_update: {'id': 1002, 'parentId': 0, 'type': 11,
[custom_components.tech.entity] _handle_coordinator_update: {'id': 1001, 'parentId': 0, 'type': 40,
[custom_components.tech.entity] _handle_coordinator_update: {'id': 1006, 'parentId': 0, 'type': 6, 
[custom_components.tech.entity] _handle_coordinator_update: {'id': 1008, 'parentId': 0, 'type': 1, 
[custom_components.tech.entity] _handle_coordinator_update: {'id': 1009, 'parentId': 0, 'type': 1, 
[custom_components.tech.entity] _handle_coordinator_update: {'id': 1010, 'parentId': 0, 'type': 31,
[custom_components.tech.entity] _handle_coordinator_update: {'id': 1011, 'parentId': 0, 'type': 22,
[custom_components.tech.entity] _handle_coordinator_update: {'id': 1012, 'parentId': 0, 'type': 23,
[custom_components.tech.entity] _handle_coordinator_update: {'id': 2040, 'parentId': 0, 'type': 40,
[custom_components.tech.entity] _handle_coordinator_update: {'id': 1003, 'parentId': 0, 'type': 11,
[custom_components.tech.entity] _handle_coordinator_update: {'id': 1004, 'parentId': 0, 'type': 11,
[custom_components.tech.entity] _handle_coordinator_update: {'id': 1016, 'parentId': 0, 'type': 2, 
[custom_components.tech.entity] _handle_coordinator_update: {'id': 1020, 'parentId': 0, 'type': 11,
[custom_components.tech.entity] _handle_coordinator_update: {'id': 1002, 'parentId': 0, 'type': 11,
[custom_components.tech.entity] _handle_coordinator_update: {'id': 1001, 'parentId': 0, 'type': 40,
[custom_components.tech.entity] _handle_coordinator_update: {'id': 1006, 'parentId': 0, 'type': 6, 
[custom_components.tech.entity] _handle_coordinator_update: {'id': 1008, 'parentId': 0, 'type': 1, 
[custom_components.tech.entity] _handle_coordinator_update: {'id': 1009, 'parentId': 0, 'type': 1, 
[custom_components.tech.entity] _handle_coordinator_update: {'id': 1010, 'parentId': 0, 'type': 31,
[custom_components.tech.entity] _handle_coordinator_update: {'id': 1011, 'parentId': 0, 'type': 22,
[custom_components.tech.entity] _handle_coordinator_update: {'id': 1012, 'parentId': 0, 'type': 23,
[custom_components.tech.entity] _handle_coordinator_update: {'id': 2040, 'parentId': 0, 'type': 40,
[custom_components.tech.entity] _handle_coordinator_update: {'id': 1003, 'parentId': 0, 'type': 11,
[custom_components.tech.entity] _handle_coordinator_update: {'id': 1004, 'parentId': 0, 'type': 11,
[custom_components.tech.entity] _handle_coordinator_update: {'id': 1016, 'parentId': 0, 'type': 2, 
[custom_components.tech.entity] _handle_coordinator_update: {'id': 1020, 'parentId': 0, 'type': 11,
[custom_components.tech.entity] _handle_coordinator_update: {'id': 1003, 'parentId': 0, 'type': 11,
[custom_components.tech.entity] _handle_coordinator_update: {'id': 1004, 'parentId': 0, 'type': 11,
[custom_components.tech.entity] _handle_coordinator_update: {'id': 1016, 'parentId': 0, 'type': 2, 
[custom_components.tech.entity] _handle_coordinator_update: {'id': 1020, 'parentId': 0, 'type': 11,
[custom_components.tech.entity] _handle_coordinator_update: {'id': 1002, 'parentId': 0, 'type': 11,
[custom_components.tech.entity] _handle_coordinator_update: {'id': 1001, 'parentId': 0, 'type': 40,
[custom_components.tech.entity] _handle_coordinator_update: {'id': 1006, 'parentId': 0, 'type': 6, 
[custom_components.tech.entity] _handle_coordinator_update: {'id': 1008, 'parentId': 0, 'type': 1, 
[custom_components.tech.entity] _handle_coordinator_update: {'id': 1009, 'parentId': 0, 'type': 1, 
[custom_components.tech.entity] _handle_coordinator_update: {'id': 1010, 'parentId': 0, 'type': 31,
[custom_components.tech.entity] _handle_coordinator_update: {'id': 1011, 'parentId': 0, 'type': 22,
[custom_components.tech.entity] _handle_coordinator_update: {'id': 1012, 'parentId': 0, 'type': 23,
[custom_components.tech.entity] _handle_coordinator_update: {'id': 2040, 'parentId': 0, 'type': 40,

so not really offline.

anarion80 avatar Oct 14 '24 10:10 anarion80

It was certainly offline - switched off for several days, and the web page showed it as offline as well. Is it possible that the API response I can get through the web is something different than the integration gets? I tried again (switched it off and waiting until it appeared as offline on the web portal), and on the web, I'm getting

{
    "tiles": [],
    "zones": {
        "elements": [],
        "globalSchedules": {
            "elements": []
        }
    },
    "menu": {
        "elements": []
    },
    "parents": [],
    "lastUpdate": null,
    "moduleStatus": "inactive",
    "controllerStatus": "active",
    "init": false
}

...while in HA there is:

2024-10-14 12:43:59.301 DEBUG (MainThread) [custom_components.tech] Entry -> title: Kotel, data: {'user_id': '21681077', 'token': '***HIDDEN***', 'controller': {'id': 0, 'default': False, 'name': 'Kotel', 'email': '', 'type': 'pellet', 'controllerStatus': 'active', 'moduleStatus': 'active', 'additionalInformation': '', 'phoneNumber': None, 'zipCode': '67573', 'tag': 'OPOP', 'country': 'Czech Republic (Česká republika)', 'gmtId': 30, 'gmtTime': '1', 'postcodePolicyAccepted': True, 'style': 'defro', 'version': 'OPOP: ST-581v9 Premium 1.6.1 P01 (v.3.0.2)', 'company': 'opop', 'udid': '9e272db82251974547fb4e2540645813'}, 'version': 'OPOP: ST-581v9 Premium 1.6.1 P01 (v.3.0.2): Kotel', 'include_hub_in_name': True}, id: 01J6Y7C6N0QQGJ3N4ANF9K6FVG, domain: tech

No idea how is that possible...

ZdenekM avatar Oct 14 '24 10:10 ZdenekM

@ZdenekM regarding last comment HA debug log showing API call to: https://emodul.pl/api/v1/users/**********/modules

which will show always output of all modules as this is info about registered module (it can be ofline or online).

Output from API which you posted is calling https://emodul.pl/api/v1/users/**********/modules/******** which will show zones and tiles status from module (so if module is offline for some time it returns something like you posted).

daroga0002 avatar Oct 15 '24 09:10 daroga0002