home-assistant / core

:house_with_garden: Open source home automation that puts local control and privacy first.
https://www.home-assistant.io
Apache License 2.0
73.91k stars 30.98k forks source link

Incomfort code change! #79594

Closed thoompje closed 2 years ago

thoompje commented 2 years ago

The problem

Hi All,

I am using a long time Incomfort, but suddenly it is not working anymore. The following message i got in the logs:

Logger: homeassistant.setup
Source: setup.py:162
First occurred: 20:03:48 (1 occurrences)
Last logged: 20:03:48

Setup failed for incomfort: Integration failed to initialize.

Logger: homeassistant.components.incomfort
Source: components/incomfort/init.py:58
Integration: incomfort (documentation], [issues])
First occurred: 20:03:48 (1 occurrences)
Last logged: 20:03:48

Logger: homeassistant.components.incomfort
Source: components/incomfort/init.py:58
Integration: incomfort ([documentation], [issues 1](https://github.com/home-assistant/home-assistant/issues?q=is%3Aissue+is%3Aopen+label%3A%22integration%3A+incomfort%22))
First occurred: 20:17:39 (1 occurrences)
Last logged: 20:17:39

Setup failed, check your configuration, message is: 404, message=‘Not found’, url=URL(‘[http://192.168.178.3/protect/heaterlist.json 1](http://192.168.178.3/protect/heaterlist.json)’)

***FIX**

So i fixed the issue. There needs to be a change in the code of Home Assistant Core. (Can someone help me with that?)

I changed the following code in the file init.py in the location of the homeassistant container

/usr/local/lib/python3.10/site-packages/incomfortclient

From:

    else:
        self._url_base = f"http://{hostname}/protect/"
        self._auth = aiohttp.BasicAuth(login=username, password=password)

TO:

    else:
        self._url_base = f"http://{hostname}/"
        self._auth = aiohttp.BasicAuth(login=username, password=password)

Now i don’t get any error and the heater is again as entity in HA.

What version of Home Assistant Core has the issue?

core-2022.9.7

What was the last working version of Home Assistant Core?

No response

What type of installation are you running?

Home Assistant OS

Integration causing the issue

incomfort

Link to integration documentation on our website

https://www.home-assistant.io/integrations/incomfort/

Diagnostics information

So i fixed the issue. There needs to be a change in the code of Home Assistant Core. (Can someone help me with that?)

I changed the following code in the file init.py in the location of the homeassistant container

/usr/local/lib/python3.10/site-packages/incomfortclient

From:

else:
    self._url_base = f"http://{hostname}/protect/"
    self._auth = aiohttp.BasicAuth(login=username, password=password)

TO:

else:
    self._url_base = f"http://{hostname}/"
    self._auth = aiohttp.BasicAuth(login=username, password=password)

Now i don’t get any error and the heater is again as entity in HA.

Example YAML snippet

No response

Anything in the logs that might be useful for us?

No response

Additional information

No response

homeassistant commented 2 years ago

Hey there @zxdavb, mind taking a look at this issue as it has been labeled with an integration (incomfort) you are listed as a code owner for? Thanks! (message by CodeOwnersMention)


incomfort documentation incomfort source (message by IssueLinks)

thoompje commented 2 years ago

So can someone change this code in the main core? The /protect/ part is not good anymore...

Vaskivskyi commented 2 years ago

Just so you know, you have changed not the integration code, but the code of the module(library) incomfort-client on which integration relies.

If this is really the fix, it should be firstly implemented in the new version of this library and only then the integration dependency can be changed to the new library version. Since the author of both this integration and the library is the same, he will probably do it if consider it a correct solution

thoompje commented 2 years ago

Haha really, oke. Yes i have changed the code from the incomfort-client folder. Hmmm so what is handy to do?

AxelBaas commented 2 years ago

Is there an easy way to changes these lines on a Home assistant OS? The files aren't visible on the /usr location if connecting by SCP of SSH. Are they stored in a different location?

zxdavb commented 2 years ago

Hello, thanks for submitting this issue. I wrote the HA integration and the underlying client library, so I hope I can address this issue for you.

@thoompje, for me to help you, please provide:

There are, as far as I am aware, two types of gateway:

@AxelBaas, are you saying you are having the same issue? If so, can you provide the same info.

I should also say that the code fragments you have provided do not show the full picture. Because it is relevant, I include it here:

if username is None:
    self._url_base = f"http://{hostname}/"
    self._auth = None
else:
    self._url_base = f"http://{hostname}/protect/"
    self._auth = aiohttp.BasicAuth(login=username, password=password)

So: have you tried the integration without a username/password?

axel-baas commented 2 years ago

For some reason the intergration is working again, without making changes. Weird! But thanks for your reply!

Marijn1250 commented 2 years ago

It seems that the problem is fixed in Home Assistant 2022.10.4. I just updated and the gateway is working fine.

zxdavb commented 2 years ago

I believe the appropriate step now is to close this issue.

thoompje commented 2 years ago

Really weird then, and nothing change in the code? Because we have updated to the latest version but its not working now... So i need to change the code again.

thoompje commented 2 years ago

Hello, thanks for submitting this issue. I wrote the HA integration and the underlying client library, so I hope I can address this issue for you.

@thoompje, for me to help you, please provide:

  • a copy of the incomfort: section from your configuration.yaml
  • the type / version of the Intergas RF gateway you have?

There are, as far as I am aware, two types of gateway:

  • older version: red/rectangular - Intouch Lan2RF (the one I have)
  • newer version: black/square - Incomfort Gateway II

@AxelBaas, are you saying you are having the same issue? If so, can you provide the same info.

I should also say that the code fragments you have provided do not show the full picture. Because it is relevant, I include it here:

if username is None:
    self._url_base = f"http://{hostname}/"
    self._auth = None
else:
    self._url_base = f"http://{hostname}/protect/"
    self._auth = aiohttp.BasicAuth(login=username, password=password)

So: have you tried the integration without a username/password?

configuration.yaml:

incomfort:
  host: 192.168.178.3
  username: admin
  password: intergas

And the device is: Honeywell ML1 5SB UK Web interface version: 1.1 Firmware version: IC3-ICN-V1.15 Build date: Feb 10 2017 00:08:00

Only when we change:

 else:
     self._url_base = f"http://{hostname}/protect/"
     self._auth = aiohttp.BasicAuth(login=username, password=password)

to:

 else:
     self._url_base = f"http://{hostname}/"
     self._auth = aiohttp.BasicAuth(login=username, password=password)

in: /usr/local/lib/python3.10/site-packages/incomfortclient

Then its working again

zxdavb commented 1 year ago

@thoompje This issue looks the same as #76042...

Has it sorted itself out, or are you still needing to make the code change to describe above?

If it is still an issue, could you provide the exact make/model of your RF gateway, as well as if it requires a username and password.