chomupashchuk / ariston-remotethermo-home-assistant-v2

Ariston NET remotethermo integration for Home Assistant based on API
MIT License
92 stars 22 forks source link

_get_param errors #16

Closed avvalex closed 3 years ago

avvalex commented 3 years ago

Hi, the integration produces these couple of errors about every 2 minutes. Errors don't seem to be triggered by any specific sensor (they appear also with only one temp sensor exposed).

ariston action nok for _get_param: Unexpected code 500 received for the request _get_param 11:10:46 – Ariston (WARNING) - il messaggio si è verificato per la prima volta alle 11:05:43 e compare 3 volte <custom_components.ariston.ariston.AristonHandler object at 0xb15af748> _get_param invalid reply code 500 11:10:46 – Ariston (WARNING) - il messaggio si è verificato per la prima volta alle 11:05:43 e compare 3 volte

Is maybe the integration trying to get something not exposed in remotethermo? Is it a known bug or am i missing something? Thanks.

avvalex commented 3 years ago

This is the log behaviour:

2021-03-24 12:02:46 WARNING (Thread-22) [custom_components.ariston.ariston] <custom_components.ariston.ariston.AristonHandler object at 0xafa69478> _get_param invalid reply code 500 2021-03-24 12:02:46 WARNING (Thread-22) [custom_components.ariston.ariston] ariston action nok for _get_param: Unexpected code 500 received for the request _get_param 2021-03-24 12:03:14 DEBUG (Thread-21) [custom_components.ariston.ariston] <custom_components.ariston.ariston.AristonHandler object at 0xafa69478> Fetching next data in 30.0 seconds 2021-03-24 12:03:15 INFO (Thread-24) [custom_components.ariston.ariston] Setting sensors for _get_error 2021-03-24 12:03:15 INFO (Thread-24) [custom_components.ariston.ariston] Data fetched for _get_error 2021-03-24 12:03:15 INFO (Thread-24) [custom_components.ariston.ariston] ariston action ok for _get_error 2021-03-24 12:03:44 DEBUG (Thread-23) [custom_components.ariston.ariston] <custom_components.ariston.ariston.AristonHandler object at 0xafa69478> Fetching next data in 30.0 seconds 2021-03-24 12:04:14 DEBUG (Thread-25) [custom_components.ariston.ariston] <custom_components.ariston.ariston.AristonHandler object at 0xafa69478> Fetching next data in 30.0 seconds 2021-03-24 12:04:44 DEBUG (Thread-26) [custom_components.ariston.ariston] <custom_components.ariston.ariston.AristonHandler object at 0xafa69478> Fetching next data in 30.0 seconds 2021-03-24 12:04:50 INFO (Thread-28) [custom_components.ariston.ariston] Setting sensors for _get_main 2021-03-24 12:04:50 INFO (Thread-28) [custom_components.ariston.ariston] Setting sensors for _get_version 2021-03-24 12:04:50 INFO (Thread-28) [custom_components.ariston.ariston] Data fetched for _get_main 2021-03-24 12:04:50 INFO (Thread-28) [custom_components.ariston.ariston] ariston action ok for _get_main 2021-03-24 12:05:14 DEBUG (Thread-27) [custom_components.ariston.ariston] <custom_components.ariston.ariston.AristonHandler object at 0xafa69478> Fetching next data in 30.0 seconds 2021-03-24 12:05:16 WARNING (Thread-30) [custom_components.ariston.ariston] <custom_components.ariston.ariston.AristonHandler object at 0xafa69478> _get_param invalid reply code 500 2021-03-24 12:05:16 WARNING (Thread-30) [custom_components.ariston.ariston] ariston action nok for _get_param: Unexpected code 500 received for the request _get_param 2021-03-24 12:05:44 DEBUG (Thread-29) [custom_components.ariston.ariston] <custom_components.ariston.ariston.AristonHandler object at 0xafa69478> Fetching next data in 30.0 seconds 2021-03-24 12:05:46 INFO (Thread-32) [custom_components.ariston.ariston] Setting sensors for _get_error 2021-03-24 12:05:46 INFO (Thread-32) [custom_components.ariston.ariston] Data fetched for _get_error 2021-03-24 12:05:46 INFO (Thread-32) [custom_components.ariston.ariston] ariston action ok for _get_error 2021-03-24 12:06:14 DEBUG (Thread-31) [custom_components.ariston.ariston] <custom_components.ariston.ariston.AristonHandler object at 0xafa69478> Fetching next data in 30.0 seconds 2021-03-24 12:06:44 DEBUG (Thread-33) [custom_components.ariston.ariston] <custom_components.ariston.ariston.AristonHandler object at 0xafa69478> Fetching next data in 30.0 seconds 2021-03-24 12:07:14 DEBUG (Thread-34) [custom_components.ariston.ariston] <custom_components.ariston.ariston.AristonHandler object at 0xafa69478> Fetching next data in 30.0 seconds 2021-03-24 12:07:19 INFO (Thread-36) [custom_components.ariston.ariston] Setting sensors for _get_main 2021-03-24 12:07:19 INFO (Thread-36) [custom_components.ariston.ariston] Setting sensors for _get_version 2021-03-24 12:07:19 INFO (Thread-36) [custom_components.ariston.ariston] Data fetched for _get_main 2021-03-24 12:07:19 INFO (Thread-36) [custom_components.ariston.ariston] ariston action ok for _get_main 2021-03-24 12:07:44 DEBUG (Thread-35) [custom_components.ariston.ariston] <custom_components.ariston.ariston.AristonHandler object at 0xafa69478> Fetching next data in 30.0 seconds 2021-03-24 12:07:47 WARNING (Thread-38) [custom_components.ariston.ariston] <custom_components.ariston.ariston.AristonHandler object at 0xafa69478> _get_param invalid reply code 500 2021-03-24 12:07:47 WARNING (Thread-38) [custom_components.ariston.ariston] ariston action nok for _get_param: Unexpected code 500 received for the request _get_param

chomupashchuk commented 3 years ago

Most likely there is unsupported sensor/binary_sensor/switch defined in configuration.yaml (for example internet_weather does not work with Lydos from what I remember).

There are 2 options:

  1. remove or add sensors/switches one by one and see which causes the issue.
  2. store_config_files setting to true should log data and create a text file with error code in it's name, where server reply is received in html format. Then check the description which parameter causes the error. If it is coded as numbers (e.g. 6 1 1 2) then open ariston.py and look for similar numbers in variables that start with _ARISTON_ (at the beginning of the file).
avvalex commented 3 years ago

I've set store_config_files setting to true but i don't find any log... Where is it stored? I'm running HA Core in docker... Thanks!

chomupashchuk commented 3 years ago

It should create folder ariston_http_data' in config, unless permission issues.

avvalex commented 3 years ago

I think I've found the log.... I hope this is the part with errors...

<div id="contentWrapper" class="container-fluid">
        <h4>AN ERROR OCCURRED PROCESSING YOUR REQUEST</h4>
        <hr />
        <div class="row">
            <div class="col-sm-6 col-sm-offset-3">
                Please report the following error to the system administrator
            </div>
        </div>
        <div class="row"></div>
        <div class="row">
            <div class="col-sm-3 col-sm-offset-3">
                ERROR TYPE:
            </div>
            <div class="col-sm-3">
                UtilsLite.Diagnostics.ViolatedPostConditionException
            </div>
        </div>

        <div class="row">
            <div class="col-sm-3 col-sm-offset-3">
                ERROR MESSAGE:
            </div>
            <div class="col-sm-3">
                Violated Postcondition (CheckId: 710201000021): Node &quot;6.9.1.0.0&quot; not found in &quot;User&quot; menu
            </div>
        </div>
    </div>
chomupashchuk commented 3 years ago

Not good, the parameter is used as core parameter if I understand correctly. There are issues to set temperatures as such (there are 3 ways to set temperatures and I did notice difference in models handling it, but it seems there is optional support on top of that). Ariston does not make it simple.

chomupashchuk commented 3 years ago

So either I would need your support to test (and provide some of files from http requests), or provide temporary credentials for me to access the boiler (I need to test any solution at least on my boiler).

By the way, what kind of model do you have?

avvalex commented 3 years ago

I'd go with the first solution, you give me some help and I provide all needed tests and http responses... My model is Ariston Clas B Premium 35 (not EVO). Here is the manual:

https://www.google.it/url?sa=t&source=web&rct=j&url=https://www.ariston.com/media/files/37_clas_b_premium_manuale_inst_manut_2010.pdf&ved=2ahUKEwiR64rzxcvvAhW-wAIHHZomCdAQFjAAegQIBRAC&usg=AOvVaw1RlMcJtcpbfp8Ccja3ZpSx

This model does not have direct support to web connection, so they have added an external WiFi gateway like this:

https://www.google.it/url?sa=t&source=web&rct=j&url=https://www.ariston.com/tr/imgs/aristonnet/Ariston_Net_Installation_Manual.pdf&ved=2ahUKEwivjZzBxsvvAhXH16QKHRf3DOwQFjACegQIBBAC&usg=AOvVaw0K2X5diyk2SEEdc4hOMqgf&cshid=1616678995768

More, my boiler does not support the Sensys thermostat, so I have one with only basic functions (temp measure and display, change manual mode).

But it seems to me the the problem is not about home assistant sensors, since I have the error also with only 1 temp sensor exposed. I think it's more a matter of my profile webpage, any it's configuration...

Let me know what you need to explore the problem. Thanks.

PS: maibe one hint could be that using the first version of Julupanter's fork of your work I do not have this problem (but I am missing many sensors)

chomupashchuk commented 3 years ago

What I mean is that the parameter that causes issue is treated as mandatory internal one (regardless if you specify sensor or not) and is used for water_heater entity configuration as it is only working parameter for some models in specific case. By default climate (CH) and water_heater(DHW) are created and sensors/switches in HA are optional. If you login to Ariston remotethermo site and switch to USER MENU you should be able to see supported parameters.

I have Sensys thermostat with wifi gateway connected to my boiler, so I'm not sure what exactly is supported and what is not in your case to figure out how could I split supported values from unsupported ones without breaking things for other boiler configurations.

So there are 2 options:

  1. For you to setup sniffer (I use Google Chrome and Fiddler) and login to Ariston page and and provide me with data when changing some data. I tried to replicate interaction with that web page, which differes between models.
  2. Provide me with credentials (should not be commonly used one) for me to do it myself and coordinate when I could change the configuration to verify how it works.
avvalex commented 3 years ago

I'd go with option 1 (some fun for me too). After Chrome and Fiddler setup, what should I do?

chomupashchuk commented 3 years ago

Some short description I've made regarding use: https://github.com/chomupashchuk/ariston-remotethermo-home-assistant/blob/master/Guide_for_new_requests.doc

Since the error indicated 6.9.1.0.0 the problem is missing parameter to change DHW temperatures when timing function is used for DHW.

I'm interested in raw data request, when HOME page is loaded (what supported parameters are reported) to understand how I could potentially identify special case (other option is input parameter, which I'd like to avoid).

Since it is DHW, I'm curious which options are available for temperature control and if you may switch modes of DHW between manual and time program or something or if it is supported in your case. And if you can, in each of such modes try to change temperature on HOME and USER MENU pages and store information about which mode is used, which option was used from menu (like names in menu and menu numbers) with corresponding request raw data, and if it affected configuration (like switching other modes in the process). I'm familiar with requests changing values on HOME page, but from experience it either switched mode from time program to manual or in fact did nothing when was in time program mode. I am familiar with USER MENU requests, but I do not know which item numbers (and names) are available in your case and how they behave. After any change it is good to switch to HOME to get latest data.

I'm asking for a lot of data as there are ofthen unexpected behavior with Ariston and also different behavior for different boilers on the same data, even if supported on both.

If you have only option to control temperatures on HOME page and no modes, then only 1 raw data request is enough so that I could check reported supported values.

avvalex commented 3 years ago

I'am reading your tutorial, but firstly i think i have to point out one thing: i haven't any function to set DHW temps from app, from webpage or from thermostat. I have only the knob on the boiler, and i've used it to set DHW water at 40/42 ( i don't remember) degrees Celsius. I can not change that value from anywhere else, and i can not use any timer for DHW.

In HOME i can: 1) Set boiler in winter mode (DHW+CH) or Holyday (it pauses heating since the date indicated); the function Summer (only DHW) and OFF is modifiable only from the boiler's buttons. 2) Change between scheduled and manual mode. 3) Watch the currently set temperature. 4) Watch the detected temperature in house.

In USER MENU i have: 3 - Summer/Winter/Off: It shows a drop down menu, but only with Winter option (as seen above, other options are only selectable from boiler buttons). 0 - Programmed (or scheduled, i don't know the exact translation)/Manual: i can change the option in 6 zones, but i have only one zone (Zone 2), and i can choose OFF/Manual/Programmed (i have it now in programmed). 6 - 6.3 - Climate heating settings ("impostazione riscaldamento" in italian) 6.3.3 - Auto function - ON or OFF (ON) 6.3.0 - Climate set temp ("temperatura impostata riscaldamento" in italian) 6.3.0.1 - T set Zone 1 (value 1) 6.3.0.3 - T set Zone 2 (value 1) 6.3.0.5 - T set Zone 3 (value 1) 6.3.1 - Programmed ("programmato" in italian) 6.3.1.0 - Zone 1 6.3.1.0.0 - Set T comfort (19,0) 6.3.1.0.1 - Set T reduced ("ridotto" in italian) (16,0) 6.3.1.1 - Zone 2 (I THINK MY ACTIVE AND ONLY ZONE) 6.3.1.1.0 - Set T comfort (23,5) <----- And yessss, my wife is always cold..... 6.3.1.1.1 - Set T reduced (18) 6.3.1.2 - Zone 3 6.3.1.2.0 - Set T comfort (19,0) 6.3.1.2.1 - Set T reduced (16,0) 6.9 - DHW setting ("impostazione acqua calda" in italian) 6.9.* - DHW setting 6.9.0 - Comfort temp for hot water (40) <----- I can save a different number, but when i refresh it returns to 40, so apparently nothing is saved (for the same reason explained above.... I have to use boiler's knob) 6.9.2 - Comfort function (it has three strange options in drop down menu: Configuration error, Level, Input voltage. Currently "Level" is selected, and i don't think i can validly change the option. I don't know what does it mean, also....).

Tell me if you need something else.... BTW, i didn't find any 6.9.1.0.0 option, perhaps for the reason mentioned above (DHW set only with knob, and no time program function for DHW).

chomupashchuk commented 3 years ago

I'd like to see reported REST reply on HOME page. I forgot that there are 2 options for that:

  1. Set store_config_files to true and restart HA. It should create folder and store files and data_ariston_get_main.json is the one I'm interesetd in. Since you have sent HTTP reply, you should already have that file. It has no personal data, but should give a hint if I could make it automatically determine your case (where DHW does not work)
  2. Get data via Fiddler and Chrome - it is a case with additional features, which I do not have, but I guess this is opposite case and thus option 1 should work as well.
chomupashchuk commented 3 years ago

Basically I have to lock DHW functionality in your case if it does not work anyway via web, and I need to understand if it can be done automatically based on received data or I have to create additional input parameter.

avvalex commented 3 years ago

Are these the files needed? (i renamed data_ariston_get_main.json to txt)

data_ariston_get_main.txt data_ariston_get_main_599_error.txt data_ariston_get_param_500_error.txt

avvalex commented 3 years ago

If i try to refresh the 6.9.* parameters (DHW settings) this is what i obtain from Fiddler:

GET hxxps://wxw.ariston-net.remotethermo.com/Menu/User/Refresh/xxxxxxxxxxxx?paramIds=U6_9_0,U6_92&umsys=si&rnd=1616848397078&=1616848220061 HTTP/1.1

and

[{"id":"U6_9_0","value":40.0,"min":40.0,"max":65.0,"dropDownOptions":null,"anyError":false},{"id":"U6_9_2","value":1.0,"min":0.0,"max":2.0,"dropDownOptions":[{"value":0,"text":"Errore di configurazione"},{"value":1,"text":"Livello"},{"value":2,"text":"Tensione in ingresso"}],"anyError":false}]

chomupashchuk commented 3 years ago

ariston.txt

please try renaming extension to py from txt in attached file, replace ariston.py in the folder and restart the HA. Let me know if it works.

avvalex commented 3 years ago

It goes A LOT better!!! In 10 minutes the only problems are:

1) Recent warning for missing version in manifest, simply to fix;

2) Only one error, that seems to appear about every 8-10 minutes.

2021-03-27 19:36:39 WARNING (Thread-34) [custom_components.ariston.ariston] <custom_components.ariston.ariston.AristonHandler object at 0xb00fb520> _get_param invalid reply code 500 2021-03-27 19:36:39 WARNING (Thread-34) [custom_components.ariston.ariston] ariston action nok for _get_param: Unexpected code 500 received for the request _get_param

3) A very verbose logging, repeating this pattern 2021-03-27 19:35:06 DEBUG (Thread-27) [custom_components.ariston.ariston] <custom_components.ariston.ariston.AristonHandler object at 0xb00fb520> Fetching next data in 30.0 seconds 2021-03-27 19:35:36 DEBUG (Thread-29) [custom_components.ariston.ariston] <custom_components.ariston.ariston.AristonHandler object at 0xb00fb520> Fetching next data in 30.0 seconds 2021-03-27 19:36:06 DEBUG (Thread-30) [custom_components.ariston.ariston] <custom_components.ariston.ariston.AristonHandler object at 0xb00fb520> Fetching next data in 30.0 seconds 2021-03-27 19:36:13 INFO (Thread-32) [custom_components.ariston.ariston] <custom_components.ariston.ariston.AristonHandler object at 0xb00fb520> DHW parameters probably not supported. 2021-03-27 19:36:13 INFO (Thread-32) [custom_components.ariston.ariston] Setting sensors for _get_main 2021-03-27 19:36:13 INFO (Thread-32) [custom_components.ariston.ariston] Setting sensors for _get_version 2021-03-27 19:36:13 INFO (Thread-32) [custom_components.ariston.ariston] Data fetched for _get_main 2021-03-27 19:36:13 INFO (Thread-32) [custom_components.ariston.ariston] ariston action ok for _get_main

Maybe error 2 is due to much frequent http requests, and this seems related to point 3 too... Can you suggest me to try some different parameter to avoid this? Now i have "polling" commented, swhat value do you suggest? 1.2 could be enough?

Attached you find a 10 minutes log, it's repeating itself in next minutes....

avvalex commented 3 years ago

Next 15 minutes no error 500, only one 599.... I really think i must set more delayed http requests....

2021-03-27 20:14:26 WARNING (Thread-68) [custom_components.ariston.ariston] <custom_components.ariston.ariston.AristonHandler object at 0xaffe1d60> _get_main invalid reply code 599 2021-03-27 20:14:26 WARNING (Thread-68) [custom_components.ariston.ariston] Connection errors: 1 2021-03-27 20:14:26 WARNING (Thread-68) [custom_components.ariston.ariston] ariston action nok for _get_main: Unexpected code 599 received for the request _get_main

chomupashchuk commented 3 years ago

The problem with replies that code itself is not much of information and thus files are genetared to store HTML replies, which would have been to big for the log (they have code in file name and extension txt). I also get occasional errors 500 and 599, it is relatively fine for as long as it is not permanent. I have polling set to 1.2, but no problem to increase it to 2.0 (just slower responcivness, which should not be too critical).

Normally I check few things:

P.S.: Manifest is present in newer versions of integration

chomupashchuk commented 3 years ago

Let me know if it seems OK so that I could push updates to Github

avvalex commented 3 years ago

This is the HA log of last 35 minutes:

Once everithing is fixed, i'd like to reduce all that tons of logging. Shoud i set logger integration in HA to WARNING for the Ariston custom component, or is (will be) there a specific setting in the component itself?

LOG.txt

Edit: Tried 1.5: i got only one

2021-03-27 23:08:00 WARNING (Thread-124) [custom_components.ariston.ariston] <custom_components.ariston.ariston.AristonHandler object at 0xb1698418> _get_main invalid reply code 599 2021-03-27 23:08:00 WARNING (Thread-124) [custom_components.ariston.ariston] Connection errors: 1 2021-03-27 23:08:00 WARNING (Thread-124) [custom_components.ariston.ariston] ariston action nok for _get_main: Unexpected code 599 received for the request _get_main

In one hour

chomupashchuk commented 3 years ago

Occasional timeouts also happens (some requests wait for alsmost 30 seconds and implementation was done to send one request at a time), and unexpected replies also happens for unknown reason and only polling option seems to affect frequency of such events but I could never get rid of them. For some time value 1.0 worked fine for me, then faults became more frequent and I changed it to 1.2 and now it became relatively fine, I don't know why that happens, but seems to be a problem on AArsiton side.

As for logging, as a test can you change value in __init__.py file from logging_level="DEBUG" to logging_level="WARNING" (I have not tested it). I have setting to WARNING in HA and if I need more details, I just open log file directly, where all data is visible and thus I have not bothered with logging.

avvalex commented 3 years ago

This night with polling at 1.5 I had 19 times

2021-03-27 23:08:00 WARNING (Thread-124) [custom_components.ariston.ariston] <custom_components.ariston.ariston.AristonHandler object at 0xb1698418> _get_main invalid reply code 599 2021-03-27 23:08:00 WARNING (Thread-124) [custom_components.ariston.ariston] Connection errors: 1 2021-03-27 23:08:00 WARNING (Thread-124) [custom_components.ariston.ariston] ariston action nok for _get_main: Unexpected code 599 received for the request _get_main

If it is the best we can achieve I think we can close the issue and push the update. Now i try with the change to init to reduce logging...

avvalex commented 3 years ago

The logging change in init file seems to work fine. I'm thinking that maybe an option (with explanations) for HA's configuration.yaml should be useful...

chomupashchuk commented 3 years ago

changes were pushed earlier and logging control is now available in configuration.yaml (description in README.MD)