briis / meteobridge

The Meteobridge Integration adds support for retrieving current weather data from a Meteobridge datalogger connected to a local Weather Station.
MIT License
14 stars 5 forks source link

'Unknown Error' when trying to connect to Meteobridge Nano #16

Closed blew1234 closed 2 years ago

blew1234 commented 2 years ago

Im struggling with the update to the new version. I followed the instructions, but I keep getting an 'Unknown Error' error when I attempt to start the new integration. Ive checked that I don't have any traces of the old version still present. I checked the Host logs, and I get the following:

2021-11-29 17:20:07 ERROR (MainThread) [aiohttp.server] Error handling request Traceback (most recent call last): File "/usr/local/lib/python3.9/site-packages/aiohttp/web_protocol.py", line 422, in _handle_request resp = await self._request_handler(request) File "/usr/local/lib/python3.9/site-packages/aiohttp/web_app.py", line 499, in _handle resp = await handler(request) File "/usr/local/lib/python3.9/site-packages/aiohttp/web_middlewares.py", line 119, in impl return await handler(request) File "/usr/src/homeassistant/homeassistant/components/http/security_filter.py", line 60, in security_filter_middleware return await handler(request) File "/usr/src/homeassistant/homeassistant/components/http/forwarded.py", line 98, in forwarded_middleware return await handler(request) File "/usr/src/homeassistant/homeassistant/components/http/request_context.py", line 24, in request_context_middleware return await handler(request) File "/usr/src/homeassistant/homeassistant/components/http/ban.py", line 78, in ban_middleware return await handler(request) File "/usr/src/homeassistant/homeassistant/components/http/auth.py", line 138, in auth_middleware return await handler(request) File "/usr/src/homeassistant/homeassistant/components/http/view.py", line 135, in handle result = await result File "/usr/src/homeassistant/homeassistant/components/config/config_entries.py", line 157, in post return await super().post(request, flow_id) File "/usr/src/homeassistant/homeassistant/components/http/data_validator.py", line 62, in wrapper result = await method(view, request, *args, **kwargs) File "/usr/src/homeassistant/homeassistant/helpers/data_entry_flow.py", line 110, in post result = await self._flow_mgr.async_configure(flow_id, data) File "/usr/src/homeassistant/homeassistant/data_entry_flow.py", line 246, in async_configure result = await self._async_handle_step(flow, cur_step["step_id"], user_input) File "/usr/src/homeassistant/homeassistant/data_entry_flow.py", line 320, in _async_handle_step result: FlowResult = await getattr(flow, method)(user_input) File "/config/custom_components/meteobridge/config_flow.py", line 58, in async_step_user await meteobridge.initialize() File "/usr/local/lib/python3.9/site-packages/pymeteobridgedata/api.py", line 76, in initialize data = await self._process_request_result(result, FIELDS_STATION) File "/usr/local/lib/python3.9/site-packages/pymeteobridgedata/api.py", line 295, in _process_request_result return ast.literal_eval(data) File "/usr/local/lib/python3.9/ast.py", line 62, in literal_eval node_or_string = parse(node_or_string, mode='eval') File "/usr/local/lib/python3.9/ast.py", line 50, in parse return compile(source, filename, mode, flags, File "", line 1 {'mac': 'B8:D8:12:60:5B:50', 'swversion': 5.2, 'platform': 'VOCORE2', 'station': 'Vantage', 'timezone': 'Europe/London', 'uptime': 1874, 'ip': XXX.XXX.XXX.XXX', 'elevation': --} ^ SyntaxError: unexpected EOF while parsing

Can you help me with this? I am guessing this is something wrong my end, but i can't see the issue looking at the above.

Many thanks!

briis commented 2 years ago

It seems I expect some values that are not setup on your system. Please change USERNAME, PASSWORD and IP_ADDRESS in the below string to your own Meteobridge data, and then copy the line to a Web Browser and post the result here.

http://USERNAME:PASSWORD@IP_ADDRESS/cgi-bin/template.cgi?template=[mbsystem-mac:--];[mbsystem-swversion:--];[mbsystem-platform:--];[mbsystem-station:--];[mbsystem-timezone:--];[mbsystem-uptime:--];[mbsystem-ip:--];[mbsystem-altitude:--]

blew1234 commented 2 years ago

Apologies for the late reply and thank you for your response.

I have tried what you asked above, and it enters into a loop where it is asking for my username and password, which I type in, but it doesn't accept and just asks for it again (it doesn't say it's wrong, it just cycles back).

I have tried the password separately via a normal log in to the nano, and it lets me in fine.

briis commented 2 years ago

Are you sure you remember the : between username and password? And the @ between password and ip address?

Basically this is the same call I use to retrieve data, so it should work.

blew1234 commented 2 years ago

Right - operator error! Apologies

B8:D8:12:60:5B:50;5.2;VOCORE2;Vantage;Europe/London;845;192.168.242.65;--

briis commented 2 years ago

From that, I can see you have not entered the height above sea level for your station. Go to the Meteobridge Nano, and then select Station and Settings. Here you must enter the Altitude of your station, and then click save. Wait a minute and then try and run the above command again.

blew1234 commented 2 years ago

Done

B8:D8:12:60:5B:50;5.2;VOCORE2;Vantage;Europe/London;1582;192.168.242.65;76.0

briis commented 2 years ago

Good. Now could you try and start the integration in Home Assistant again. Just go to the Integration page, and click the 3 dots in the lower right corner, and select Reload. Then let us see if there are still errors.

blew1234 commented 2 years ago

It's working! Brilliant! Thank you so much.

Was it the lack of altitude which was causing the issue?

briis commented 2 years ago

Yes. Altitude is also important for the Meteobridge Station as some of the Values you see are based on Weather Math, which sometimes requires the altitude of the Station to be correct. I also use it in a few formulas for this. The next version has a check for the missing altitude, so it would still run, just missing some values.