Home Assistant - Control Google Assistant Devices?

Hi!
it looksl like you have the connection for the enet server up and running, but the connection to your home-assistant is failing.

Hi everyone!
Today, I pushed a pull request to our enet2mqtt bridge. With a new guide how to install it. I hope some of you find it useful. :slight_smile:

2 Likes

Hi everyone, small update. The Enet2mqtt is now also available from the unraid appstore and docker hub!

2 Likes

Tried it and using a seperate does cker container on my synology NAS, this is now fully working and connecting to the HA Mqtt broker. Works like a charm! Thanks for all efforts!

Regards,
Jeroen

1 Like

Hi Thomas,

I installed the enet2mqtt docker on a server and is is ready with all the credentials and other stuff. But i get an error about a certificate.

In portainer i see:
Status Stopped for 7 minutes with exit code 1

Hi @Thetmar, could you make an issue at https://github.com/mnordseth/enet2mqtt/issues/new/choose?
Please include you logs :slight_smile:
Thanks!

Hi Thomas
Unfortunately, I can’t create a ticket at the moment because my account is flagged at github :frowning:
So unfortunately that won’t work. But I will ask Jeroen how he has the settings set.
Regards Thetmar.

Ah, get it! Could you share here your logs maybe?

Hello Thomas,
I will post the message i want to post on github :wink:

Hi Thomas,

As discussed herewith please find the log of the docker. What I see happening is that the container wants to connect on 80 and starts trying on 443.

If I restart the iobroker docker for the test which can connect to the enet server I see that it does so on 443. If I turn off https on the enet server / 443 then it also fails to connect.

I also turned off the https login on the enet server but still i get the message about a certificate error.

If more info is needed I would love to hear about it. And maybe it is a handy or nice option to have a choice between 80 and or 443?
Thanks in advance,
Thetmar Wiegers.

Here it connects to port 80:

    29-Jun-22 08:26:15 - Starting new HTTP connection (1): 192.168.178.90:80

Web server returns HTTP 302, which is a redirect

    29-Jun-22 08:26:15 - http://192.168.178.90:80 "POST /jsonrpc/management HTTP/1.1" 302 0

This is where it starts a new session on HTTPS:

    29-Jun-22 08:26:15 - Starting new HTTPS connection (1): 192.168.178.90:443

And after that comes that certificate error because you don’t have a trusted vert on your enet server.

COMPLET LOG:
Traceback (most recent call last):

2022-06-29T11:53:53.306151319Z 29-Jun-22 11:53:53 - Starting new HTTP connection (1): 192.168.178.90:80

2022-06-29T11:53:53.371993841Z 29-Jun-22 11:53:53 - http://192.168.178.90:80 “POST /jsonrpc/management HTTP/1.1” 302 0

2022-06-29T11:53:53.373965668Z 29-Jun-22 11:53:53 - Starting new HTTPS connection (1): 192.168.178.90:443

2022-06-29T11:53:54.165124906Z Traceback (most recent call last):

2022-06-29T11:53:54.165147591Z File “/usr/local/lib/python3.7/site-packages/urllib3/connectionpool.py”, line 710, in urlopen

2022-06-29T11:53:54.165161444Z chunked=chunked,

2022-06-29T11:53:54.165165180Z File “/usr/local/lib/python3.7/site-packages/urllib3/connectionpool.py”, line 386, in _make_request

2022-06-29T11:53:54.165168365Z self._validate_conn(conn)

2022-06-29T11:53:54.165171173Z File “/usr/local/lib/python3.7/site-packages/urllib3/connectionpool.py”, line 1040, in _validate_conn

2022-06-29T11:53:54.165174099Z conn.connect()

2022-06-29T11:53:54.165176626Z File “/usr/local/lib/python3.7/site-packages/urllib3/connection.py”, line 424, in connect

2022-06-29T11:53:54.165179323Z tls_in_tls=tls_in_tls,

2022-06-29T11:53:54.165181859Z File “/usr/local/lib/python3.7/site-packages/urllib3/util/ssl_.py”, line 453, in ssl_wrap_socket

2022-06-29T11:53:54.165184584Z ssl_sock = _ssl_wrap_socket_impl(sock, context, tls_in_tls)

2022-06-29T11:53:54.165187189Z File “/usr/local/lib/python3.7/site-packages/urllib3/util/ssl_.py”, line 495, in _ssl_wrap_socket_impl

2022-06-29T11:53:54.165189917Z return ssl_context.wrap_socket(sock)

2022-06-29T11:53:54.165192503Z File “/usr/local/lib/python3.7/ssl.py”, line 423, in wrap_socket

2022-06-29T11:53:54.165195170Z session=session

2022-06-29T11:53:54.165197710Z File “/usr/local/lib/python3.7/ssl.py”, line 870, in _create

2022-06-29T11:53:54.165200331Z self.do_handshake()

2022-06-29T11:53:54.165202893Z File “/usr/local/lib/python3.7/ssl.py”, line 1139, in do_handshake

2022-06-29T11:53:54.165205555Z self._sslobj.do_handshake()

2022-06-29T11:53:54.165208115Z ssl.SSLCertVerificationError: [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: self-signed certificate in certificate chain (_ssl.c:1076)

2022-06-29T11:53:54.165225604Z

2022-06-29T11:53:54.165235920Z During handling of the above exception, another exception occurred:

2022-06-29T11:53:54.165238767Z

2022-06-29T11:53:54.165240890Z Traceback (most recent call last):

2022-06-29T11:53:54.165243152Z File “/usr/local/lib/python3.7/site-packages/requests/adapters.py”, line 450, in send

2022-06-29T11:53:54.165245551Z timeout=timeout

2022-06-29T11:53:54.165247790Z File “/usr/local/lib/python3.7/site-packages/urllib3/connectionpool.py”, line 786, in urlopen

2022-06-29T11:53:54.165250159Z method, url, error=e, _pool=self, _stacktrace=sys.exc_info()[2]

2022-06-29T11:53:54.165252460Z File “/usr/local/lib/python3.7/site-packages/urllib3/util/retry.py”, line 592, in increment

2022-06-29T11:53:54.165254832Z raise MaxRetryError(_pool, url, error or ResponseError(cause))

2022-06-29T11:53:54.165258018Z urllib3.exceptions.MaxRetryError: HTTPSConnectionPool(host=‘192.168.178.90’, port=443): Max retries exceeded with url: /jsonrpc/management (Caused by SSLError(SSLCertVerificationError(1, ‘[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: self-signed certificate in certificate chain (_ssl.c:1076)’)))

2022-06-29T11:53:54.165260825Z

2022-06-29T11:53:54.165262945Z During handling of the above exception, another exception occurred:

2022-06-29T11:53:54.165265228Z

2022-06-29T11:53:54.165267340Z Traceback (most recent call last):

2022-06-29T11:53:54.165269609Z File “enet2mqtt.py”, line 165, in

2022-06-29T11:53:54.165277337Z bridge = Enet2MqttBridge(enet_client, args.mqtt_host, args.mqtt_port, args.mqtt_user, args.mqtt_passwd)

2022-06-29T11:53:54.165279797Z File “enet2mqtt.py”, line 62, in init

2022-06-29T11:53:54.165282132Z self.enet_connect()

2022-06-29T11:53:54.165284353Z File “enet2mqtt.py”, line 66, in enet_connect

2022-06-29T11:53:54.165286621Z self.enet.get_account()

2022-06-29T11:53:54.165288811Z File “/enet.py”, line 126, in get_account

2022-06-29T11:53:54.165291129Z return self.request(URL_MANAGEMENT, “getAccount”)

2022-06-29T11:53:54.165293469Z File “/enet.py”, line 38, in request

2022-06-29T11:53:54.165295777Z response = self._session.post(“http://%s%s” % (self.hostname, url), json=req)

2022-06-29T11:53:54.165298156Z File “/usr/local/lib/python3.7/site-packages/requests/sessions.py”, line 577, in post

2022-06-29T11:53:54.165300521Z return self.request(‘POST’, url, data=data, json=json, **kwargs)

2022-06-29T11:53:54.165302810Z File “/usr/local/lib/python3.7/site-packages/requests/sessions.py”, line 529, in request

2022-06-29T11:53:54.165311894Z resp = self.send(prep, **send_kwargs)

2022-06-29T11:53:54.165314186Z File “/usr/local/lib/python3.7/site-packages/requests/sessions.py”, line 667, in send

2022-06-29T11:53:54.165316601Z history = [resp for resp in gen]

2022-06-29T11:53:54.165322500Z File “/usr/local/lib/python3.7/site-packages/requests/sessions.py”, line 667, in

2022-06-29T11:53:54.165325312Z history = [resp for resp in gen]

2022-06-29T11:53:54.165327583Z File “/usr/local/lib/python3.7/site-packages/requests/sessions.py”, line 245, in resolve_redirects

2022-06-29T11:53:54.165329988Z **adapter_kwargs

2022-06-29T11:53:54.165332187Z File “/usr/local/lib/python3.7/site-packages/requests/sessions.py”, line 645, in send

2022-06-29T11:53:54.165334577Z r = adapter.send(request, **kwargs)

2022-06-29T11:53:54.165336817Z File “/usr/local/lib/python3.7/site-packages/requests/adapters.py”, line 517, in send

2022-06-29T11:53:54.165339167Z raise SSLError(e, request=request)

2022-06-29T11:53:54.165341497Z requests.exceptions.SSLError: HTTPSConnectionPool(host=‘192.168.178.90’, port=443): Max retries exceeded with url: /jsonrpc/management (Caused by SSLError(SSLCertVerificationError(1, ‘[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: self-signed certificate in certificate chain (_ssl.c:1076)’)))

Dear @Jeroenterh ,

I also have an enet server here but unfortunately I cannot connect it. Could you please tell me what kind of enet server you have? And which version you have?
Or do you have some data what you have filled in? Is HTTPS enabled on your server?

1 Like

Hi @Th0masDB, we (@Thetmar and I) have been able to workaround the HTTPS issue (see my github here for the changes), but unfortunately that only brought us to the next error.

The HTTPS request works, but the enet server now returns HTTP error 405:

29-Jun-22 22:26:52 - http://192.168.178.90:80 "POST /jsonrpc/management HTTP/1.1" 302 0
/usr/local/lib/python3.7/site-packages/urllib3/connectionpool.py:1050: InsecureRequestWarning: Unverified HTTPS request is being made to host '192.168.178.90'. Adding certificate verification is strongly advised. See: https://urllib3.readthedocs.io/en/1.26.x/advanced-usage.html#ssl-warnings
  InsecureRequestWarning,
29-Jun-22 22:26:52 - https://192.168.178.90:443 "GET /jsonrpc/management HTTP/1.1" 405 372

Bij netwerk kun je HTTPS uitzetten. Zou dit tijdelijk aanraden.

English: I would switch off your HTTPS. Because I do not have a workaround (yet).

I think your solution is in here: https://stackoverflow.com/questions/27835619/urllib-and-ssl-certificate-verify-failed-error?answertab=trending#tab-top

Unfortunately, I am not home until tomorrow. So I cannot work on it until tomorrow, I apologize for the inconvenience.

Hello @Th0masDB,

No problem that you are not at home. I’m just very curious how @Jeroenterh got it working without any problems. Maybe a different firmware version? You can’t change that many settings in the enet server.

Turning off Https was in any case not an option. @MischaBoender has adapted the code and has been testing but unfortunately we are not getting any devices out of the enet server.

HTTPS is working now, but script is failing with retrieving devices from the ENET server.

1 Like

For @hostrup, @MagnusN and me it also works out of the box. I think we all do not have HTTPS enabled on the enet server. When I get home I will also test it with HTTPS on.

I have the same software version btw.

Could you share your logs? Because I can’t seem to reproduce it… My enet server would not switch to HTTPS mode for some reason.

Hello @Th0masDB,

Sorry for my late response but I was sick for a few days.
From which device would you like to receive the log? @MischaBoender and I have been working for hours but I don’t know if everything is working properly at the moment.

The tricky thing is that you are running the same version of the controller. This makes it an even stranger problem.

1 Like

Hi All!
Nice to see all the work done on the enet server.
I still run my “own” version on a very simple docker container - on my linux server.
I can confirm that i dont use https to connect - only http.
My software version of the enet server is 2.3.1 - and hardware version 2.

Best regards Ronni

2 Likes

Heyhey! I just got my enet server to switch to https. And for me, it just works…
What I think is your problem now because I can’t think of something else, is that you guys have other devices than me, like switches. You can verify this with this tool: https://github.com/lawrencebensaid/enet-api Compare it with the list in enet.py. Because I had a kind of similar problem without the https problem.