How to add integration in Devices? Name Error
renarena opened this issue · 22 comments
What exactly have i to put into the form fields?
No matter what i fill in i get an error.
I used real IP addresses (192.168...) for grocy + mqtt, api key and mqtt user
There is a checkbox with no name.
But the integration stays red .
Logger: custom_components.shopping_list_with_grocy
Source: custom_components/shopping_list_with_grocy/apis/shopping_list_with_grocy.py:323
Integration: Shopping List with Grocy (documentation, issues)
First occurred: 11:13:28 (157 occurrences)
Last logged: 14:49:55
Unexpected error fetching None data: [Errno -2] Name does not resolve
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/helpers/update_coordinator.py", line 225, in _async_refresh
self.data = await self._async_update_data()
File "/config/custom_components/shopping_list_with_grocy/__init__.py", line 158, in _async_update_data
return await self.api.retrieve_data()
File "/config/custom_components/shopping_list_with_grocy/apis/shopping_list_with_grocy.py", line 420, in retrieve_data
await self.update_refreshing_status("ON")
File "/config/custom_components/shopping_list_with_grocy/apis/shopping_list_with_grocy.py", line 323, in update_refreshing_status
self.client.connect(self.mqtt_server, self.mqtt_port)
File "/usr/local/lib/python3.10/site-packages/paho/mqtt/client.py", line 914, in connect
return self.reconnect()
File "/usr/local/lib/python3.10/site-packages/paho/mqtt/client.py", line 1044, in reconnect
sock = self._create_socket_connection()
File "/usr/local/lib/python3.10/site-packages/paho/mqtt/client.py", line 3685, in _create_socket_connection
return socket.create_connection(addr, timeout=self._connect_timeout, source_address=source)
File "/usr/local/lib/python3.10/socket.py", line 824, in create_connection
for res in getaddrinfo(host, port, 0, SOCK_STREAM):
File "/usr/local/lib/python3.10/socket.py", line 955, in getaddrinfo
for res in _socket.getaddrinfo(host, port, family, type, proto, flags):
socket.gaierror: [Errno -2] Name does not resolve
Logger: homeassistant.config_entries
Source: config_entries.py:807
First occurred: 14:37:07 (4 occurrences)
Last logged: 14:48:40
Config entry 'ShoppingListWithGrocy' for shopping_list_with_grocy integration not ready yet: [Errno -2] Name does not resolve; Retrying in background
Config entry 'ShoppingListWithGrocy' for shopping_list_with_grocy integration not ready yet: 'ascii' codec can't encode character '\xe4' in position 29: ordinal not in range(128); Retrying in background
Config entry 'ShoppingListWithGrocy' for shopping_list_with_grocy integration not ready yet: Cannot connect to host 192.168.1.222:102 ssl:default [Connect call failed ('192.168.1.222', 102)]; Retrying in background```
'\xe4' means ä
Hello @renarena
As mentioned in the documentation, if you want to use an ip with a port, you have to put https://your-ip:your-port (so in your case https://192.168.1.222:102) and uncheck the verify SSL checkbox.
If the checkbox as no name, try a force refresh (Ctrl + Shift + R), it should force your frontend to refresh translations.
The unnamed checkbox is below the mqtt fields
Found a typo in port number
Now i get a warning, integration still red.
Logger: homeassistant.config_entries
Source: config_entries.py:1113
First occurred: 16:10:52 (3 occurrences)
Last logged: 16:26:31
Config entry 'ShoppingListWithGrocy' for shopping_list_with_grocy integration not ready yet: 192.168.1.222:9192/api/system/db-changed-time; Retrying in background
Hummm, I'll check for the empty checkbox, it shouldn't be there.
For your Grocy url, like mentioned above, please add https:// in front of your ip address. It has to be an url.
As for your MQTT IP address, I'm surprised you're not using default value 127.0.0.1, because of what I understand here, you're using the MQTT integration from Home Assistant.... So try with 127.0.0.1.
Finaly, remove the port in MQTT - IP address field, the port is set right below this field
oh, sorry, had it there before. Now i again have the [Errno -2] Name does not resolve
could you try to access in a browser https://192.168.1.222:9192 ?
Also, don't forget to modify the MQTT ip address
i have no https and http://192.168.1.222:9192/ is working fine
Yeah, I know, you CAN'T have valid https with just an ip, especialy with a local one (192.168.x.x) BUT, this is why there is the checkbox to skip certificate SSL validation.
So please, try to go to https://192.168.1.222:9192/api
I pushed an update for the missing translation BTW
And also, the access with local IP address was introduced and confirmed working in issue #1 (comment)
Do i have to check the unnamed box or not?
Is it a HA restriction for integration config not being editable?
Do i have to check the unnamed box or not?
You don't, it's just if you want the entire list of your products being in the main sensor as custom attribute.
Is it a HA restriction for integration config not being editable?
Yes, it requires us to implement another flow to edit config. Not all modules have that, if in my TODO list for a future update
could you try to access in a browser https://192.168.1.222:9192/ ?
SSL_ERROR_RX_RECORD_TOO_LONG
Logger: homeassistant.config_entries
Source: config_entries.py:807
First occurred: 16:10:16 (3 occurrences)
Last logged: 17:17:27
Config entry 'ShoppingListWithGrocy' for shopping_list_with_grocy integration not ready yet: 192.168.1.222:9192/api/system/db-changed-time; Retrying in background
Config entry 'ShoppingListWithGrocy' for shopping_list_with_grocy integration not ready yet: [Errno -2] Name does not resolve; Retrying in background
Config entry 'ShoppingListWithGrocy' for shopping_list_with_grocy integration not ready yet: Cannot connect to host 192.168.1.222:9192 ssl:default [[SSL: WRONG_VERSION_NUMBER] wrong version number (_ssl.c:997)]; Retrying in background
http://192.168.1.222:9192/api#/System/get_system_db_changed_time does work, with https not.
This is very strange... It's working fine on my side and as mentioned previously, it was working also for #1
for SSL_ERROR_RX_RECORD_TOO_LONG, it's related to Firefox of what I can see, maybe try with another browser?
Is everything up to date on your HomeAssistant, including a good configuration with MQTT (try to use MQTT explorer on windows to connect to your MQTT server), and Grocy addon?
I'll try to check later and comeback with a fix
Home Assistant 2022.12.8
Supervisor 2022.11.2
Operating System 9.4
Frontend 20221213.1 - latest
MQTT Explorer is working
Chromium says ERR_SSL_PROTOCOL_ERROR
i have no https configured or used anywhere related to HA (there is a self certified Cert for proxmox)
Hey @renarena , I took some time to test with the same configuration as yourself, and it's working fine. To try to help you as much as I can, this is an example of the config I used:
As you can see, it works A+ :
In your grocy module configuration in Home Assistant, be sure to uncheck the ssl option:
you told me to use https ;-)
Using 127.0.0.1 for mqtt rather then http:192.168.1.222 seems to work better.
But now i get
Logger: homeassistant.components.mqtt.discovery
Source: components/mqtt/discovery.py:110
Integration: MQTT (documentation, issues)
First occurred: 27. Dezember 2022 um 17:21:38 (5 occurrences)
Last logged: 10:03:13
Received message on illegal discovery topic 'homeassistant/sensor/shopping_list_with_grocy_currysoße_tute/state/config'. The topic contains not allowed characters. For more information see https://www.home-assistant.io/docs/mqtt/discovery/#discovery-topic
seems like ß is not replaced by ss
you told me to use https ;-)
As I said, "I took some time to test with the same configuration as yourself", so I tested without https to be sure it was working as expected ^^
Ok, it's great, so the integration is now working! It's just an issue with specific characters :) I'll try to see if I can find a way to sanitize that, and one I'll push the update, you should have all your products
@renarena I pushed a version 0.3.0 to deal with umlauts, it should fix your issue. I also implemented a config flow and updated the documentation.
Now all your products should work as expected
Thank you very much, the ability to change config is very good :-)
But still red integration:
Dieser Fehler wurde von einer benutzerdefinierten Integration verursacht
Logger: custom_components.shopping_list_with_grocy
Source: custom_components/shopping_list_with_grocy/apis/shopping_list_with_grocy.py:76
Integration: Shopping List with Grocy (documentation, issues)
First occurred: 17:08:43 (11 occurrences)
Last logged: 17:14:04
Unexpected error fetching None data: 'ascii' codec can't encode character '\xe4' in position 29: ordinal not in range(128)
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/helpers/update_coordinator.py", line 225, in _async_refresh
self.data = await self._async_update_data()
File "/config/custom_components/shopping_list_with_grocy/__init__.py", line 160, in _async_update_data
return await self.api.retrieve_data()
File "/config/custom_components/shopping_list_with_grocy/apis/shopping_list_with_grocy.py", line 451, in retrieve_data
await self.parse_products(final_data)
File "/config/custom_components/shopping_list_with_grocy/apis/shopping_list_with_grocy.py", line 184, in parse_products
self.encode_base64(product_picture)
File "/config/custom_components/shopping_list_with_grocy/apis/shopping_list_with_grocy.py", line 76, in encode_base64
message_bytes = message.encode("ascii")
UnicodeEncodeError: 'ascii' codec can't encode character '\xe4' in position 29: ordinal not in range(128)
Maybe add a yaml snipped to documentation for excluding all the sensors from recorder.
I pushed an update (v.0.3.2) to try to fix your issue. Could you give it a try once it's available on your side please?
Finally its working!
Yeah!! Thank you for your patience :) Have fun with that module! Have a great day!