cyberjunky / home-assistant-toon_climate

This component provides a climate device for rooted Toon thermostats.
MIT License
32 stars 8 forks source link

Error while setting up platform toon_climate (16:43 custom_components/toon_climate/climate.py (ERROR)) #1

Closed antoinevandenhurk closed 4 years ago

antoinevandenhurk commented 4 years ago

`Sat Jan 04 2020 16:43:40 GMT+0100 (Midden-Europese standaardtijd) Error while setting up platform toon_climate Traceback (most recent call last): File "/usr/local/lib/python3.7/site-packages/urllib3/connection.py", line 157, in _new_conn (self._dns_host, self.port), self.timeout, **extra_kw File "/usr/local/lib/python3.7/site-packages/urllib3/util/connection.py", line 84, in create_connection raise err File "/usr/local/lib/python3.7/site-packages/urllib3/util/connection.py", line 74, in create_connection sock.connect(sa) socket.timeout: timed out

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File "/usr/local/lib/python3.7/site-packages/urllib3/connectionpool.py", line 672, in urlopen chunked=chunked, File "/usr/local/lib/python3.7/site-packages/urllib3/connectionpool.py", line 387, in _make_request conn.request(method, url, **httplib_request_kw) File "/usr/local/lib/python3.7/http/client.py", line 1252, in request self._send_request(method, url, body, headers, encode_chunked) File "/usr/local/lib/python3.7/http/client.py", line 1298, in _send_request self.endheaders(body, encode_chunked=encode_chunked) File "/usr/local/lib/python3.7/http/client.py", line 1247, in endheaders self._send_output(message_body, encode_chunked=encode_chunked) File "/usr/local/lib/python3.7/http/client.py", line 1026, in _send_output self.send(msg) File "/usr/local/lib/python3.7/http/client.py", line 966, in send self.connect() File "/usr/local/lib/python3.7/site-packages/urllib3/connection.py", line 184, in connect conn = self._new_conn() File "/usr/local/lib/python3.7/site-packages/urllib3/connection.py", line 164, in _new_conn % (self.host, self.timeout), urllib3.exceptions.ConnectTimeoutError: (<urllib3.connection.HTTPConnection object at 0x7fb0d9906b10>, 'Connection to 192.168.123.9 timed out. (connect timeout=5)')

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File "/usr/local/lib/python3.7/site-packages/requests/adapters.py", line 449, in send timeout=timeout File "/usr/local/lib/python3.7/site-packages/urllib3/connectionpool.py", line 720, in urlopen method, url, error=e, _pool=self, _stacktrace=sys.exc_info()[2] File "/usr/local/lib/python3.7/site-packages/urllib3/util/retry.py", line 436, in increment raise MaxRetryError(_pool, url, error or ResponseError(cause)) urllib3.exceptions.MaxRetryError: HTTPConnectionPool(host='192.168.123.9', port=10080): Max retries exceeded with url: /happ_thermstat?action=getThermostatInfo (Caused by ConnectTimeoutError(<urllib3.connection.HTTPConnection object at 0x7fb0d9906b10>, 'Connection to 192.168.123.9 timed out. (connect timeout=5)'))

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 150, in _async_setup_platform await asyncio.wait_for(asyncio.shield(task), SLOW_SETUP_MAX_WAIT) File "/usr/local/lib/python3.7/asyncio/tasks.py", line 442, in wait_for return fut.result() File "/usr/local/lib/python3.7/concurrent/futures/thread.py", line 57, in run result = self.fn(*self.args, self.kwargs) File "/config/custom_components/toon_climate/climate.py", line 68, in setup_platform config.get(CONF_PORT))]) File "/config/custom_components/toon_climate/climate.py", line 90, in init self.update() File "/config/custom_components/toon_climate/climate.py", line 119, in update '/happ_thermstat?action=getThermostatInfo')) File "/config/custom_components/toon_climate/climate.py", line 95, in do_api_request req = requests.get(url, timeout=DEFAULT_TIMEOUT) File "/usr/local/lib/python3.7/site-packages/requests/api.py", line 75, in get return request('get', url, params=params, kwargs) File "/usr/local/lib/python3.7/site-packages/requests/api.py", line 60, in request return session.request(method=method, url=url, kwargs) File "/usr/local/lib/python3.7/site-packages/requests/sessions.py", line 533, in request resp = self.send(prep, send_kwargs) File "/usr/local/lib/python3.7/site-packages/requests/sessions.py", line 646, in send r = adapter.send(request, **kwargs) File "/usr/local/lib/python3.7/site-packages/requests/adapters.py", line 504, in send raise ConnectTimeout(e, request=request) requests.exceptions.ConnectTimeout: HTTPConnectionPool(host='192.168.123.9', port=10080): Max retries exceeded with url: /happ_thermstat?action=getThermostatInfo (Caused by ConnectTimeoutError(<urllib3.connection.HTTPConnection object at 0x7fb0d9906b10>, 'Connection to 192.168.123.9 timed out. (connect timeout=5)'))`

cyberjunky commented 4 years ago

Did it work, or first setup? It seems the ip or port is wrong, or the whitelist isn't disabled like described on forum?

Do you see output if you browse to http://ip_of_your_toon:port_of_toon/happ_thermstat?action=getThermostatInfo

antoinevandenhurk commented 4 years ago

I have assigned Toon a static ip address, namely 192.168.123.9, see below: Bekabeld | Tooneneco-001-078297 |   192.168.123.9 | 54:27:1E:5A:67:41  | Tooneneco-001-078297 I have a small HASSIO installation on an RPIE and a large installation on a virtual station, but I cannot integrate custom "TOON Climate Component" on both devices. So i'm desperate. What do you mean with "or the whitelist is not disabled like described on forum". I have the following clip in my .configuration.yaml. whitelist_external_dirs:      - / tmp      - / config / www / snapshots      - / config / tts

My "Toon" is rooted by TheHogNL, so that shouldn't be the problem. Any advise?

cyberjunky commented 4 years ago

If you open a web browser on your laptop/desktop and browse to one of the following urls, do you get any json output or error/blank page?

http://192.168.123.9:10080/happ_thermstat?action=getThermostatInfo http://192.168.123.9:7080/happ_thermstat?action=getThermostatInfo

To enable this web service you need to edit a file and set enforce whitelist to false. Maybe this was already done, I don't know. https://www.domoticaforum.eu/viewtopic.php?f=100&t=11235#p82535

antoinevandenhurk commented 4 years ago

Thanks, but it seems like do not have that particular file at all in my Toon. I searched for hcb_project.xml on the whole device, but no results. Ik have to ask "TheHogNL" about this issue, hopefully that leads to an answer...

IgorYbema commented 4 years ago

So yes, on recent Toon firmware that hcb_project.xml doesn't exist anymore (it is now split in qml_release/hardware/tenant.xml). But on every recent rooted toon this is always set in the right mode with the update-rooted.sh -f option. Ports 10080 and 7080 are however old ports. Just use regular port 80

antoinevandenhurk commented 4 years ago

Thanks, with my new config it's working ... - platform: toon_climate name: TOON Thermostat host: 192.168.123.9 port: 80 scan_interval: 10 (maybe a little documentation update on https://github.com/cyberjunky/home-assistant-toon_climate) ;-)

cyberjunky commented 4 years ago

To be honest it's the first time I hear port 80 is configured. ;P I will update documentation with possible other port numbers used. I root my toons manually, using a script is for noobs ;-) ;-)

IgorYbema commented 4 years ago

To be honest it's the first time I hear port 80 is configured. ;P I will update documentation with possible other port numbers used. I root my toons manually, using a script is for noobs ;-) ;-)

Port 10080 is default on firmware 3 and older. From somewhere firmware 4 (we are now at 5.18.8, close to 6) port 10080 is still there but only pointing to the same location as port 80. Therefore port 80 (what most people use ofcourse) is needed to be open only.

I'm pretty sure that you missing a lot of opportunities with manual rooting. The script does a lot of things for you. Yes ofcourse, you can copy paste from the script and get the same result but thats more noob than using the script ;-) Script is automation. Automation what you want if you are not in a test enviroment :)

## a static document-root, for virtual-hosting take look at the
## server.virtual-* options
server.document-root        = "/qmf/www"

$SERVER["socket"] == ":10080" {
server.document-root = "/qmf/www"
}
...
## bind to port (default: 80)
server.port                = 80
cyberjunky commented 4 years ago

If you upgrade from 3, 4 to 5 like I did, it stays 10080.

IgorYbema commented 4 years ago

It is there for backwards compatibity yes. And so for Toons with 10080 opend in the iptables.conf. But eventually eneco will remove 10080 and therefore we opt not to open 10080 anymore in newly rooted toons.

cyberjunky commented 4 years ago

Clear, I have updated the code as well, thanks! Will release new version soon for hacs.