MadPatrick / somfy

Tahoma/Conexoon plugin for IO blinds, this plugin require internet connexion and a Somfy account
GNU General Public License v3.0
14 stars 3 forks source link

RTS devices not found #27

Closed MikeyMan83 closed 1 year ago

MikeyMan83 commented 1 year ago

RTS devices are not found currently. Log looks as follows in 'Local' mode:

2022-11-09 13:51:07.793 Error: Somfy Tahoma: Call to function 'onStart' failed, exception details:
2022-11-09 13:51:07.831 Error: Somfy Tahoma: Traceback (most recent call last):
2022-11-09 13:51:07.831 Error: Somfy Tahoma: File "/usr/lib/python3/dist-packages/urllib3/connection.py", line 159, in _new_conn
2022-11-09 13:51:07.831 Error: Somfy Tahoma: (self._dns_host, self.port), self.timeout, **extra_kw)
2022-11-09 13:51:07.831 Error: Somfy Tahoma: File "/usr/lib/python3/dist-packages/urllib3/util/connection.py", line 57, in create_connection
2022-11-09 13:51:07.831 Error: Somfy Tahoma: for res in socket.getaddrinfo(host, port, family, socket.SOCK_STREAM):
2022-11-09 13:51:07.831 Error: Somfy Tahoma: File "/usr/lib/python3.7/socket.py", line 748, in getaddrinfo
2022-11-09 13:51:07.831 Error: Somfy Tahoma: for res in _socket.getaddrinfo(host, port, family, type, proto, flags):
2022-11-09 13:51:07.831 Error: Somfy Tahoma: socket.gaierror: [Errno -2] Name or service not known
2022-11-09 13:51:07.831 Error: Somfy Tahoma:
2022-11-09 13:51:07.831 Error: Somfy Tahoma: During handling of the above exception, another exception occurred:
2022-11-09 13:51:07.831 Error: Somfy Tahoma:
2022-11-09 13:51:07.831 Error: Somfy Tahoma: Traceback (most recent call last):
2022-11-09 13:51:07.831 Error: Somfy Tahoma: File "/usr/lib/python3/dist-packages/urllib3/connectionpool.py", line 600, in urlopen
2022-11-09 13:51:07.831 Error: Somfy Tahoma: chunked=chunked)
2022-11-09 13:51:07.831 Error: Somfy Tahoma: File "/usr/lib/python3/dist-packages/urllib3/connectionpool.py", line 343, in _make_request
2022-11-09 13:51:07.832 Error: Somfy Tahoma: self._validate_conn(conn)
2022-11-09 13:51:07.832 Error: Somfy Tahoma: File "/usr/lib/python3/dist-packages/urllib3/connectionpool.py", line 841, in _validate_conn
2022-11-09 13:51:07.832 Error: Somfy Tahoma: conn.connect()
2022-11-09 13:51:07.832 Error: Somfy Tahoma: File "/usr/lib/python3/dist-packages/urllib3/connection.py", line 301, in connect
2022-11-09 13:51:07.832 Error: Somfy Tahoma: conn = self._new_conn()
2022-11-09 13:51:07.832 Error: Somfy Tahoma: File "/usr/lib/python3/dist-packages/urllib3/connection.py", line 168, in _new_conn
2022-11-09 13:51:07.832 Error: Somfy Tahoma: self, "Failed to establish a new connection: %s" % e)
2022-11-09 13:51:07.832 Error: Somfy Tahoma: urllib3.exceptions.NewConnectionError: <urllib3.connection.VerifiedHTTPSConnection object at 0x60adbbb0>: Failed to establish a new connection: [Errno -2] Name or service not known
2022-11-09 13:51:07.832 Error: Somfy Tahoma:
2022-11-09 13:51:07.832 Error: Somfy Tahoma: During handling of the above exception, another exception occurred:
2022-11-09 13:51:07.832 Error: Somfy Tahoma:
2022-11-09 13:51:07.832 Error: Somfy Tahoma: Traceback (most recent call last):
2022-11-09 13:51:07.832 Error: Somfy Tahoma: File "/usr/lib/python3/dist-packages/requests/adapters.py", line 449, in send
2022-11-09 13:51:07.832 Error: Somfy Tahoma: timeout=timeout
2022-11-09 13:51:07.832 Error: Somfy Tahoma: File "/usr/lib/python3/dist-packages/urllib3/connectionpool.py", line 638, in urlopen
2022-11-09 13:51:07.832 Error: Somfy Tahoma: _stacktrace=sys.exc_info()[2])
2022-11-09 13:51:07.832 Error: Somfy Tahoma: File "/usr/lib/python3/dist-packages/urllib3/util/retry.py", line 398, in increment
2022-11-09 13:51:07.832 Error: Somfy Tahoma: raise MaxRetryError(_pool, url, error or ResponseError(cause))
2022-11-09 13:51:07.832 Error: Somfy Tahoma: urllib3.exceptions.MaxRetryError: HTTPSConnectionPool(host='2017-8871-5701.local', port=8443): Max retries exceeded with url: /enduser-mobile-web/1/enduserAPI/events/register (Caused by NewConnectionError('<urllib3.connection.VerifiedHTTPSConnection object at 0x60adbbb0>: Failed to establish a new connection: [Errno -2] Name or service not known'))
2022-11-09 13:51:07.833 Error: Somfy Tahoma:
2022-11-09 13:51:07.833 Error: Somfy Tahoma: During handling of the above exception, another exception occurred:
2022-11-09 13:51:07.833 Error: Somfy Tahoma:
2022-11-09 13:51:07.833 Error: Somfy Tahoma: Traceback (most recent call last):
2022-11-09 13:51:07.833 Error: Somfy Tahoma: File "/home/pi/domoticz/plugins/somfy/plugin.py", line 528, in onStart
2022-11-09 13:51:07.833 Error: Somfy Tahoma: _plugin.onStart()
2022-11-09 13:51:07.833 Error: Somfy Tahoma: File "/home/pi/domoticz/plugins/somfy/plugin.py", line 166, in onStart
2022-11-09 13:51:07.833 Error: Somfy Tahoma: self.tahoma.register_listener()
2022-11-09 13:51:07.833 Error: Somfy Tahoma: File "/home/pi/domoticz/plugins/somfy/tahoma_local.py", line 254, in register_listener
2022-11-09 13:51:07.833 Error: Somfy Tahoma: response = self.listener.register_listener(self.base_url_local + "/events/register", headers=self.headers_with_token, verify=False)
2022-11-09 13:51:07.833 Error: Somfy Tahoma: File "/home/pi/domoticz/plugins/somfy/listener.py", line 42, in register_listener
2022-11-09 13:51:07.833 Error: Somfy Tahoma: response = requests.post(url, headers=headers, verify=verify, timeout=timeout)
2022-11-09 13:51:07.833 Error: Somfy Tahoma: File "/usr/lib/python3/dist-packages/requests/api.py", line 116, in post
2022-11-09 13:51:07.833 Error: Somfy Tahoma: return request('post', url, data=data, json=json, **kwargs)
2022-11-09 13:51:07.833 Error: Somfy Tahoma: File "/usr/lib/python3/dist-packages/requests/api.py", line 60, in request
2022-11-09 13:51:07.833 Error: Somfy Tahoma: return session.request(method=method, url=url, **kwargs)
2022-11-09 13:51:07.833 Error: Somfy Tahoma: File "/usr/lib/python3/dist-packages/requests/sessions.py", line 533, in request
2022-11-09 13:51:07.833 Error: Somfy Tahoma: resp = self.send(prep, **send_kwargs)
2022-11-09 13:51:07.833 Error: Somfy Tahoma: File "/usr/lib/python3/dist-packages/requests/sessions.py", line 646, in send
2022-11-09 13:51:07.834 Error: Somfy Tahoma: r = adapter.send(request, **kwargs)
2022-11-09 13:51:07.834 Error: Somfy Tahoma: File "/usr/lib/python3/dist-packages/requests/adapters.py", line 516, in send
2022-11-09 13:51:07.834 Error: Somfy Tahoma: raise ConnectionError(e, request=request)
2022-11-09 13:51:07.834 Error: Somfy Tahoma: requests.exceptions.ConnectionError: HTTPSConnectionPool(host='2017-8871-5701.local', port=8443): Max retries exceeded with url: /enduser-mobile-web/1/enduserAPI/events/register (Caused by NewConnectionError('<urllib3.connection.VerifiedHTTPSConnection object at 0x60adbbb0>: Failed to establish a new connection: [Errno -2] Name or service not known'))

and on web mode:

2022-11-09 13:52:31.075 Error: Somfy Tahoma: Call to function 'onStart' failed, exception details:
2022-11-09 13:52:31.077 Error: Somfy Tahoma: Traceback (most recent call last):
2022-11-09 13:52:31.077 Error: Somfy Tahoma: File "/home/pi/domoticz/plugins/somfy/plugin.py", line 528, in onStart
2022-11-09 13:52:31.077 Error: Somfy Tahoma: _plugin.onStart()
2022-11-09 13:52:31.077 Error: Somfy Tahoma: File "/home/pi/domoticz/plugins/somfy/plugin.py", line 172, in onStart
2022-11-09 13:52:31.077 Error: Somfy Tahoma: self.create_devices(filtered_devices)
2022-11-09 13:52:31.077 Error: Somfy Tahoma: File "/home/pi/domoticz/plugins/somfy/plugin.py", line 485, in create_devices
2022-11-09 13:52:31.077 Error: Somfy Tahoma: elif (device["definition"]["deviceURL"].startswith("rts://")):
2022-11-09 13:52:31.077 Error: Somfy Tahoma: KeyError: 'deviceURL'

Also saw this error: 2022-11-09 13:52:31.077 Error: Somfy Tahoma: elif (device["definition"]["deviceURL"].startswith("rts://")):

Let me know if you need anything!

JanJaapKo commented 1 year ago

@MikeyMan83 Please restart the plugin with debug logging enabled and also add the logging that is found in the /domoticz/somfy.log file as this holds the messages to/from the box.

MikeyMan83 commented 1 year ago

@JanJaapKo already had debug turned on ;)

somfy.log

JanJaapKo commented 1 year ago

ok, tnx for the logging. Really helpful. It works OK on the 'addPod' branch, so I'll just merge that one, although the button function doesn't work yet. Just merged #28 . Can you please check if it works ok now?

MikeyMan83 commented 1 year ago

@JanJaapKo The good news is; the web variant is now working it seems. Two comments here:

image

Now the local version does still give an error. somfy.log

Now i'm more than a bit stubborn, but convinced that it works perfectly with just the ip-address, without fiddling around with hosts. But this might just be the issue. I've got the API's working through postman.co with just the IP, like i mentioned before.

Also; might make sense to limit the volume of the somfy.log file.

JanJaapKo commented 1 year ago

Hey,

I'll look into the local error further this evening but as some background info: the error comes when the plugin tries to get an update from the box saying not authenticated. This is normally a token issue. After starting the plugin, did it work OK at first? And when you send a command, does that work?

Further, for the open/close topic, we have an issue for that: #23 but this seems to come from Domoticz. All I do in the plugin is forward the open and close command. You may want to read this topic: Domoticz wiki - blinds

All I need to know is if this inversion is present at all devices, then I can revert the plugin. But I prefer to just forward the commands 1 on 1 from Domoticz and solve it in Domoticz using the described configuration.

MikeyMan83 commented 1 year ago

@JanJaapKo the local plugin never worked. But i'm still a bit confused on how it would get it's token.

I already have a token, but i cannot fill that in anywhere. Using postman, it is working without issue.

Although i see several Domoticz tokens:

[
    {
        "label": "Domoticz token",
        "gatewayId": "2017-8871-5701",
        "expirationTime": 1683580003000,
        "gatewayCreationTime": 1667812003000,
        "uuid": "84efcbeb-a3b3-41af-8b67-a5364bc81a66",
        "scope": "devmode"
    },
    {
        "label": "Domoticz token",
        "gatewayId": "2017-8871-5701",
        "expirationTime": 1683669313000,
        "gatewayCreationTime": 1667901313000,
        "uuid": "aa2c632c-43a3-4834-a07d-d4dd13f182b2",
        "scope": "devmode"
    },
    {
        "label": "Domoticz token",
        "gatewayId": "2017-8871-5701",
        "expirationTime": 1683579968000,
        "gatewayCreationTime": 1667811968000,
        "uuid": "c600c7e0-9b3c-4de7-907a-b2f33416381f",
        "scope": "devmode"
    },
    {
        "label": "Toto token",
        "gatewayId": "2017-8871-5701",
        "expirationTime": 1675455166000,
        "gatewayCreationTime": 1659687166000,
        "uuid": "ddd5c6de-eae4-481b-85a9-5938c62117fe",
        "scope": "devmode"
    }
]

So it did manage to get one i think.

Although this begs the question on how many tokens are created. And if that needs support in the lines of removal.

MikeyMan83 commented 1 year ago

Trying the API's locally through postman, getting an Error: connect ECONNREFUSED 10.0.0.199:8443 now...

MikeyMan83 commented 1 year ago

They seem to have blocked the direct IP access with a recent update it seems... :X

MikeyMan83 commented 1 year ago

Slightly differnent errors after adding to /etc/hosts/

2022-11-11 09:59:24.968 Error: Somfy Tahoma: Call to function 'onStart' failed, exception details:
2022-11-11 09:59:24.992 Error: Somfy Tahoma: Traceback (most recent call last):
2022-11-11 09:59:24.992 Error: Somfy Tahoma: File "/usr/lib/python3/dist-packages/urllib3/connection.py", line 159, in _new_conn
2022-11-11 09:59:24.992 Error: Somfy Tahoma: (self._dns_host, self.port), self.timeout, **extra_kw)
2022-11-11 09:59:24.992 Error: Somfy Tahoma: File "/usr/lib/python3/dist-packages/urllib3/util/connection.py", line 80, in create_connection
2022-11-11 09:59:24.992 Error: Somfy Tahoma: raise err
2022-11-11 09:59:24.992 Error: Somfy Tahoma: File "/usr/lib/python3/dist-packages/urllib3/util/connection.py", line 70, in create_connection
2022-11-11 09:59:24.992 Error: Somfy Tahoma: sock.connect(sa)
2022-11-11 09:59:24.993 Error: Somfy Tahoma: ConnectionRefusedError: [Errno 111] Connection refused
2022-11-11 09:59:24.993 Error: Somfy Tahoma:
2022-11-11 09:59:24.993 Error: Somfy Tahoma: During handling of the above exception, another exception occurred:
2022-11-11 09:59:24.993 Error: Somfy Tahoma:
2022-11-11 09:59:24.993 Error: Somfy Tahoma: Traceback (most recent call last):
2022-11-11 09:59:24.993 Error: Somfy Tahoma: File "/usr/lib/python3/dist-packages/urllib3/connectionpool.py", line 600, in urlopen
2022-11-11 09:59:24.993 Error: Somfy Tahoma: chunked=chunked)
2022-11-11 09:59:24.993 Error: Somfy Tahoma: File "/usr/lib/python3/dist-packages/urllib3/connectionpool.py", line 343, in _make_request
2022-11-11 09:59:24.993 Error: Somfy Tahoma: self._validate_conn(conn)
2022-11-11 09:59:24.993 Error: Somfy Tahoma: File "/usr/lib/python3/dist-packages/urllib3/connectionpool.py", line 841, in _validate_conn
2022-11-11 09:59:24.993 Error: Somfy Tahoma: conn.connect()
2022-11-11 09:59:24.993 Error: Somfy Tahoma: File "/usr/lib/python3/dist-packages/urllib3/connection.py", line 301, in connect
2022-11-11 09:59:24.993 Error: Somfy Tahoma: conn = self._new_conn()
2022-11-11 09:59:24.993 Error: Somfy Tahoma: File "/usr/lib/python3/dist-packages/urllib3/connection.py", line 168, in _new_conn
2022-11-11 09:59:24.993 Error: Somfy Tahoma: self, "Failed to establish a new connection: %s" % e)
2022-11-11 09:59:24.993 Error: Somfy Tahoma: urllib3.exceptions.NewConnectionError: <urllib3.connection.VerifiedHTTPSConnection object at 0x63e448b0>: Failed to establish a new connection: [Errno 111] Connection refused
2022-11-11 09:59:24.993 Error: Somfy Tahoma:
2022-11-11 09:59:24.993 Error: Somfy Tahoma: During handling of the above exception, another exception occurred:
2022-11-11 09:59:24.993 Error: Somfy Tahoma:
2022-11-11 09:59:24.993 Error: Somfy Tahoma: Traceback (most recent call last):
2022-11-11 09:59:24.993 Error: Somfy Tahoma: File "/usr/lib/python3/dist-packages/requests/adapters.py", line 449, in send
2022-11-11 09:59:24.993 Error: Somfy Tahoma: timeout=timeout
2022-11-11 09:59:24.993 Error: Somfy Tahoma: File "/usr/lib/python3/dist-packages/urllib3/connectionpool.py", line 638, in urlopen
2022-11-11 09:59:24.993 Error: Somfy Tahoma: _stacktrace=sys.exc_info()[2])
2022-11-11 09:59:24.993 Error: Somfy Tahoma: File "/usr/lib/python3/dist-packages/urllib3/util/retry.py", line 398, in increment
2022-11-11 09:59:24.993 Error: Somfy Tahoma: raise MaxRetryError(_pool, url, error or ResponseError(cause))
2022-11-11 09:59:24.993 Error: Somfy Tahoma: urllib3.exceptions.MaxRetryError: HTTPSConnectionPool(host='2017-8871-5701.local', port=8443): Max retries exceeded with url: /enduser-mobile-web/1/enduserAPI/events/register (Caused by NewConnectionError('<urllib3.connection.VerifiedHTTPSConnection object at 0x63e448b0>: Failed to establish a new connection: [Errno 111] Connection refused'))
2022-11-11 09:59:24.993 Error: Somfy Tahoma:
2022-11-11 09:59:24.993 Error: Somfy Tahoma: During handling of the above exception, another exception occurred:
2022-11-11 09:59:24.993 Error: Somfy Tahoma:
2022-11-11 09:59:24.993 Error: Somfy Tahoma: Traceback (most recent call last):
2022-11-11 09:59:24.993 Error: Somfy Tahoma: File "/home/pi/domoticz/plugins/somfy/plugin.py", line 542, in onStart
2022-11-11 09:59:24.993 Error: Somfy Tahoma: _plugin.onStart()
2022-11-11 09:59:24.993 Error: Somfy Tahoma: File "/home/pi/domoticz/plugins/somfy/plugin.py", line 166, in onStart
2022-11-11 09:59:24.993 Error: Somfy Tahoma: self.tahoma.register_listener()
2022-11-11 09:59:24.993 Error: Somfy Tahoma: File "/home/pi/domoticz/plugins/somfy/tahoma_local.py", line 254, in register_listener
2022-11-11 09:59:24.994 Error: Somfy Tahoma: response = self.listener.register_listener(self.base_url_local + "/events/register", headers=self.headers_with_token, verify=False)
2022-11-11 09:59:24.994 Error: Somfy Tahoma: File "/home/pi/domoticz/plugins/somfy/listener.py", line 42, in register_listener
2022-11-11 09:59:24.994 Error: Somfy Tahoma: response = requests.post(url, headers=headers, verify=verify, timeout=timeout)
2022-11-11 09:59:24.994 Error: Somfy Tahoma: File "/usr/lib/python3/dist-packages/requests/api.py", line 116, in post
2022-11-11 09:59:24.994 Error: Somfy Tahoma: return request('post', url, data=data, json=json, **kwargs)
2022-11-11 09:59:24.994 Error: Somfy Tahoma: File "/usr/lib/python3/dist-packages/requests/api.py", line 60, in request
2022-11-11 09:59:24.994 Error: Somfy Tahoma: return session.request(method=method, url=url, **kwargs)
2022-11-11 09:59:24.994 Error: Somfy Tahoma: File "/usr/lib/python3/dist-packages/requests/sessions.py", line 533, in request
2022-11-11 09:59:24.994 Error: Somfy Tahoma: resp = self.send(prep, **send_kwargs)
2022-11-11 09:59:24.994 Error: Somfy Tahoma: File "/usr/lib/python3/dist-packages/requests/sessions.py", line 646, in send
2022-11-11 09:59:24.994 Error: Somfy Tahoma: r = adapter.send(request, **kwargs)
2022-11-11 09:59:24.994 Error: Somfy Tahoma: File "/usr/lib/python3/dist-packages/requests/adapters.py", line 516, in send
2022-11-11 09:59:24.994 Error: Somfy Tahoma: raise ConnectionError(e, request=request)
2022-11-11 09:59:24.994 Error: Somfy Tahoma: requests.exceptions.ConnectionError: HTTPSConnectionPool(host='2017-8871-5701.local', port=8443): Max retries exceeded with url: /enduser-mobile-web/1/enduserAPI/events/register (Caused by NewConnectionError('<urllib3.connection.VerifiedHTTPSConnection object at 0x63e448b0>: Failed to establish a new connection: [Errno 111] Connection refused'))

Domoticz is rather inconsistent at the moment: image

Only comment that is working is 'close' where the status is also 'closed' already. But thats more of a general issue i presume.

And the latest log: somfy.log

somfy.log

MikeyMan83 commented 1 year ago

@MadPatrick @JanJaapKo any ideas on this? :)

ab10002 commented 1 year ago

What did you add in your hosts file?

MikeyMan83 commented 1 year ago

@ab10002 I added the following:

ab10002 commented 1 year ago

If that's the ip-address from your tahoma-box, that's okay. (better remove your PIN here on www..)

Did you a clean plugin install ? ea remove old device and old dir's like somfy?

MikeyMan83 commented 1 year ago

@ab10002 i did do a clean install recently, but not after adding the /etc/hosts line Can give that a try

MikeyMan83 commented 1 year ago

No luck. Same error.

MikeyMan83 commented 1 year ago
2022-11-14 13:56:01.484 Error: Somfy zonneschermen: Call to function 'onStart' failed, exception details:
2022-11-14 13:56:01.496 Error: Somfy zonneschermen: Traceback (most recent call last):
2022-11-14 13:56:01.496 Error: Somfy zonneschermen: File "/usr/lib/python3/dist-packages/urllib3/connection.py", line 159, in _new_conn
2022-11-14 13:56:01.496 Error: Somfy zonneschermen: (self._dns_host, self.port), self.timeout, **extra_kw)
2022-11-14 13:56:01.496 Error: Somfy zonneschermen: File "/usr/lib/python3/dist-packages/urllib3/util/connection.py", line 80, in create_connection
2022-11-14 13:56:01.496 Error: Somfy zonneschermen: raise err
2022-11-14 13:56:01.496 Error: Somfy zonneschermen: File "/usr/lib/python3/dist-packages/urllib3/util/connection.py", line 70, in create_connection
2022-11-14 13:56:01.496 Error: Somfy zonneschermen: sock.connect(sa)
2022-11-14 13:56:01.496 Error: Somfy zonneschermen: ConnectionRefusedError: [Errno 111] Connection refused
2022-11-14 13:56:01.496 Error: Somfy zonneschermen:
2022-11-14 13:56:01.496 Error: Somfy zonneschermen: During handling of the above exception, another exception occurred:
2022-11-14 13:56:01.496 Error: Somfy zonneschermen:
2022-11-14 13:56:01.496 Error: Somfy zonneschermen: Traceback (most recent call last):
2022-11-14 13:56:01.496 Error: Somfy zonneschermen: File "/usr/lib/python3/dist-packages/urllib3/connectionpool.py", line 600, in urlopen
2022-11-14 13:56:01.496 Error: Somfy zonneschermen: chunked=chunked)
2022-11-14 13:56:01.496 Error: Somfy zonneschermen: File "/usr/lib/python3/dist-packages/urllib3/connectionpool.py", line 343, in _make_request
2022-11-14 13:56:01.496 Error: Somfy zonneschermen: self._validate_conn(conn)
2022-11-14 13:56:01.496 Error: Somfy zonneschermen: File "/usr/lib/python3/dist-packages/urllib3/connectionpool.py", line 841, in _validate_conn
2022-11-14 13:56:01.496 Error: Somfy zonneschermen: conn.connect()
2022-11-14 13:56:01.496 Error: Somfy zonneschermen: File "/usr/lib/python3/dist-packages/urllib3/connection.py", line 301, in connect
2022-11-14 13:56:01.496 Error: Somfy zonneschermen: conn = self._new_conn()
2022-11-14 13:56:01.497 Error: Somfy zonneschermen: File "/usr/lib/python3/dist-packages/urllib3/connection.py", line 168, in _new_conn
2022-11-14 13:56:01.497 Error: Somfy zonneschermen: self, "Failed to establish a new connection: %s" % e)
2022-11-14 13:56:01.497 Error: Somfy zonneschermen: urllib3.exceptions.NewConnectionError: <urllib3.connection.VerifiedHTTPSConnection object at 0x63412c50>: Failed to establish a new connection: [Errno 111] Connection refused
2022-11-14 13:56:01.497 Error: Somfy zonneschermen:
2022-11-14 13:56:01.497 Error: Somfy zonneschermen: During handling of the above exception, another exception occurred:
2022-11-14 13:56:01.497 Error: Somfy zonneschermen:
2022-11-14 13:56:01.497 Error: Somfy zonneschermen: Traceback (most recent call last):
2022-11-14 13:56:01.497 Error: Somfy zonneschermen: File "/usr/lib/python3/dist-packages/requests/adapters.py", line 449, in send
2022-11-14 13:56:01.497 Error: Somfy zonneschermen: timeout=timeout
2022-11-14 13:56:01.497 Error: Somfy zonneschermen: File "/usr/lib/python3/dist-packages/urllib3/connectionpool.py", line 638, in urlopen
2022-11-14 13:56:01.497 Error: Somfy zonneschermen: _stacktrace=sys.exc_info()[2])
2022-11-14 13:56:01.497 Error: Somfy zonneschermen: File "/usr/lib/python3/dist-packages/urllib3/util/retry.py", line 398, in increment
2022-11-14 13:56:01.497 Error: Somfy zonneschermen: raise MaxRetryError(_pool, url, error or ResponseError(cause))
2022-11-14 13:56:01.497 Error: Somfy zonneschermen: urllib3.exceptions.MaxRetryError: HTTPSConnectionPool(host='2017-8871-5701.local', port=8443): Max retries exceeded with url: /enduser-mobile-web/1/enduserAPI/events/register (Caused by NewConnectionError('<urllib3.connection.VerifiedHTTPSConnection object at 0x63412c50>: Failed to establish a new connection: [Errno 111] Connection refused'))
2022-11-14 13:56:01.497 Error: Somfy zonneschermen:
2022-11-14 13:56:01.497 Error: Somfy zonneschermen: During handling of the above exception, another exception occurred:
2022-11-14 13:56:01.497 Error: Somfy zonneschermen:
2022-11-14 13:56:01.497 Error: Somfy zonneschermen: Traceback (most recent call last):
2022-11-14 13:56:01.497 Error: Somfy zonneschermen: File "/home/pi/domoticz/plugins/somfy/plugin.py", line 545, in onStart
2022-11-14 13:56:01.497 Error: Somfy zonneschermen: _plugin.onStart()
2022-11-14 13:56:01.497 Error: Somfy zonneschermen: File "/home/pi/domoticz/plugins/somfy/plugin.py", line 166, in onStart
2022-11-14 13:56:01.497 Error: Somfy zonneschermen: self.tahoma.register_listener()
2022-11-14 13:56:01.497 Error: Somfy zonneschermen: File "/home/pi/domoticz/plugins/somfy/tahoma_local.py", line 254, in register_listener
2022-11-14 13:56:01.497 Error: Somfy zonneschermen: response = self.listener.register_listener(self.base_url_local + "/events/register", headers=self.headers_with_token, verify=False)
2022-11-14 13:56:01.497 Error: Somfy zonneschermen: File "/home/pi/domoticz/plugins/somfy/listener.py", line 42, in register_listener
2022-11-14 13:56:01.497 Error: Somfy zonneschermen: response = requests.post(url, headers=headers, verify=verify, timeout=timeout)
2022-11-14 13:56:01.497 Error: Somfy zonneschermen: File "/usr/lib/python3/dist-packages/requests/api.py", line 116, in post
2022-11-14 13:56:01.497 Error: Somfy zonneschermen: return request('post', url, data=data, json=json, **kwargs)
2022-11-14 13:56:01.497 Error: Somfy zonneschermen: File "/usr/lib/python3/dist-packages/requests/api.py", line 60, in request
2022-11-14 13:56:01.497 Error: Somfy zonneschermen: return session.request(method=method, url=url, **kwargs)
2022-11-14 13:56:01.497 Error: Somfy zonneschermen: File "/usr/lib/python3/dist-packages/requests/sessions.py", line 533, in request
2022-11-14 13:56:01.498 Error: Somfy zonneschermen: resp = self.send(prep, **send_kwargs)
2022-11-14 13:56:01.498 Error: Somfy zonneschermen: File "/usr/lib/python3/dist-packages/requests/sessions.py", line 646, in send
2022-11-14 13:56:01.498 Error: Somfy zonneschermen: r = adapter.send(request, **kwargs)
2022-11-14 13:56:01.498 Error: Somfy zonneschermen: File "/usr/lib/python3/dist-packages/requests/adapters.py", line 516, in send
2022-11-14 13:56:01.498 Error: Somfy zonneschermen: raise ConnectionError(e, request=request)
2022-11-14 13:56:01.498 Error: Somfy zonneschermen: requests.exceptions.ConnectionError: HTTPSConnectionPool(host='2017-8871-5701.local', port=8443): Max retries exceeded with url: /enduser-mobile-web/1/enduserAPI/events/register (Caused by NewConnectionError('<urllib3.connection.VerifiedHTTPSConnection object at 0x63412c50>: Failed to establish a new connection: [Errno 111] Connection refused'))
ab10002 commented 1 year ago

You can try update python to 3.9.2

MikeyMan83 commented 1 year ago

@ab10002 isnt that a bit risky? I'm on 3.7.3 now, in line with the readme

MadPatrick commented 1 year ago

Python version should not be the issue. I'm running in 3.6.8.

ab10002 commented 1 year ago

Python version should not be the issue. I'm running in 3.6.8.

Are you sure?😎

MadPatrick commented 1 year ago

Check your credentials.

I see this error in your log

Failed to establish a new connection: [Errno 111] Connection refused')

MikeyMan83 commented 1 year ago

@MadPatrick username and password you mean? Should be 100% correct. Web is working without issues. Also; doesn't the local connection only use pin, token and portnumber?

https://gateway-{{pin}}.local:{{port}}/enduser-mobile-web/1/enduserAPI

JanJaapKo commented 1 year ago

@MikeyMan83 the plugin needs, at first use, to get a token to authenticate at the box. This token is acquired at the web server of Tahoma, for which the web credentials are needed.

Do you still have an issue? If so, I need full debug logging (somfy.log) and in case of errors in the domoticz log, also those. If all is working fine, then please close the issue.

MikeyMan83 commented 1 year ago

Issue is still there. Running on web mode currently.

What are the suggested next steps?

?

JanJaapKo commented 1 year ago

To be able to see if I can solve this, I would need the somfy.log plus the domoticz log for a full start of the plugin in local mode. To be sure, please also set the Reset token option in the HW config to True, so that a new token is forced for the plugin.

MikeyMan83 commented 1 year ago

@JanJaapKo It seems the reset token is working:

2022-11-24 10:11:38.062 Status: Somfy zonneschermen: Too many connections waiting before authenticating again
2022-11-24 10:12:03.692 Status: Somfy zonneschermen: Stop directive received.
2022-11-24 10:12:04.693 Somfy zonneschermen: Worker thread started.
2022-11-24 10:12:04.644 Status: Somfy zonneschermen: Exiting work loop.
2022-11-24 10:12:04.693 Status: Somfy zonneschermen: Stopping threads.
2022-11-24 10:12:04.693 Status: Somfy zonneschermen: Stopped.
2022-11-24 10:12:04.693 Status: Somfy zonneschermen: Entering work loop.
2022-11-24 10:12:04.693 Status: Somfy zonneschermen: Started.
2022-11-24 10:12:05.407 Somfy zonneschermen: Debug logging mask set to: PYTHON
2022-11-24 10:12:05.407 Somfy zonneschermen: Parameters count: 25
2022-11-24 10:12:05.407 Somfy zonneschermen: Parameter: 'HardwareID':'36'
2022-11-24 10:12:05.407 Somfy zonneschermen: Parameter: 'HomeFolder':'/home/pi/domoticz/plugins/somfy/'
2022-11-24 10:12:05.407 Somfy zonneschermen: Parameter: 'StartupFolder':'/home/pi/domoticz/'
2022-11-24 10:12:05.407 Somfy zonneschermen: Parameter: 'UserDataFolder':'/home/pi/domoticz/'
2022-11-24 10:12:05.407 Somfy zonneschermen: Parameter: 'Database':'/home/pi/domoticz/domoticz.db'
2022-11-24 10:12:05.407 Somfy zonneschermen: Parameter: 'Language':'nl'
2022-11-24 10:12:05.407 Somfy zonneschermen: Parameter: 'Version':'4.1.6'
2022-11-24 10:12:05.407 Somfy zonneschermen: Parameter: 'Author':'MadPatrick'
2022-11-24 10:12:05.407 Somfy zonneschermen: Parameter: 'Name':'Somfy zonneschermen'
2022-11-24 10:12:05.407 Somfy zonneschermen: Parameter: 'Port':'8443'
2022-11-24 10:12:05.407 Somfy zonneschermen: Parameter: 'Username':
2022-11-24 10:12:05.407 Somfy zonneschermen: Parameter: 'Password
2022-11-24 10:12:05.407 Somfy zonneschermen: Parameter: 'Key':'tahomaIO'
2022-11-24 10:12:05.407 Somfy zonneschermen: Parameter: 'Mode1':'True'
2022-11-24 10:12:05.407 Somfy zonneschermen: Parameter: 'Mode2':'2'
2022-11-24 10:12:05.407 Somfy zonneschermen: Parameter: 'Mode3':'2017-8871-5701'
2022-11-24 10:12:05.407 Somfy zonneschermen: Parameter: 'Mode4':'Web'
2022-11-24 10:12:05.408 Somfy zonneschermen: Parameter: 'Mode6':'Debug'
2022-11-24 10:12:05.408 Somfy zonneschermen: Parameter: 'DomoticzVersion':'2022.2 (build 14773)'
2022-11-24 10:12:05.408 Somfy zonneschermen: Parameter: 'DomoticzHash':'c51c73737'
2022-11-24 10:12:05.408 Somfy zonneschermen: Parameter: 'DomoticzBuildTime':'2022-11-23 17:59:55'
2022-11-24 10:12:05.408 Somfy zonneschermen: Configuration count: 5
2022-11-24 10:12:05.408 Somfy zonneschermen: Configuration 'MajorVersion':'4'
2022-11-24 10:12:05.408 Somfy zonneschermen: Configuration 'MinorVersion':'1'
2022-11-24 10:12:05.408 Somfy zonneschermen: Configuration 'patchVersion':'6'
2022-11-24 10:12:05.408 Somfy zonneschermen: Configuration 'plugin version':'4.1.6'
2022-11-24 10:12:05.408 Somfy zonneschermen: Configuration 'token':'63723ae1911866b523e0'
2022-11-24 10:12:05.408 Somfy zonneschermen: Device count: 8
2022-11-24 10:12:05.408 Somfy zonneschermen: Device: internal://2017-8871-5701/pod/0 - DeviceID: 'internal://2017-8871-5701/pod/0', Units: 1
2022-11-24 10:12:05.408 Somfy zonneschermen: Device: io://2017-8871-5701/14384853 - DeviceID: 'io://2017-8871-5701/14384853', Units: 1
2022-11-24 10:12:05.408 Somfy zonneschermen: Device: io://2017-8871-5701/3196925 - DeviceID: 'io://2017-8871-5701/3196925', Units: 1
2022-11-24 10:12:05.409 Somfy zonneschermen: Device: io://2017-8871-5701/8684910 - DeviceID: 'io://2017-8871-5701/8684910', Units: 1
2022-11-24 10:12:05.409 Somfy zonneschermen: Device: rts://2017-8871-5701/16722109 - DeviceID: 'rts://2017-8871-5701/16722109', Units: 1
2022-11-24 10:12:05.409 Somfy zonneschermen: Device: rts://2017-8871-5701/16736992 - DeviceID: 'rts://2017-8871-5701/16736992', Units: 1
2022-11-24 10:12:05.409 Somfy zonneschermen: Device: rts://2017-8871-5701/16740764 - DeviceID: 'rts://2017-8871-5701/16740764', Units: 1
2022-11-24 10:12:05.409 Somfy zonneschermen: Device: rts://2017-8871-5701/16745695 - DeviceID: 'rts://2017-8871-5701/16745695', Units: 1
2022-11-24 10:12:05.410 Somfy zonneschermen: os.path.exists(Parameters['Mode5']) = False
2022-11-24 10:12:05.411 Somfy zonneschermen: Starting version: 4.1.6
2022-11-24 10:12:05.399 Status: Somfy zonneschermen: Initialized version 4.1.6, author 'MadPatrick'
2022-11-24 10:12:05.406 Status: Somfy zonneschermen: Location does not exist, logging to default location
2022-11-24 10:12:05.406 Status: Somfy zonneschermen: Starting Tahoma blind plugin, logging to file somfy.log

somfy.log

Bit weird, as there were already three tokens in the somfy for domoticz.

JanJaapKo commented 1 year ago

Hey,

The problem is that I cannot control the list of tokens from the plugin. You can, using the manual script, delete tokens, but you cannot 'get' that token and re-activate it. So once a token in the plugin for some reason turns invalid/unusable, there is no other choice than to create a new one.

MadPatrick commented 1 year ago

Michael

Please remove your credentials in the log file. It is now visible for everybody

MikeyMan83 commented 1 year ago

Michael

Please remove your credentials in the log file. It is now visible for everybody

Doh, missed that... Can that be scrambled in the logging?

JanJaapKo commented 1 year ago

It is deliberately left open, to be able to check that you have the right credentials in use and they do not get malformed or whatever in the process......