Code Monkey home page Code Monkey logo

lacrosse_view's People

Contributors

icebotyt avatar sourcery-ai-bot avatar uglycoyote avatar

Stargazers

 avatar  avatar  avatar  avatar

Watchers

 avatar

lacrosse_view's Issues

Error 401 on Get Sensor

Request

Could we please get the device_id printed out as part of the "Failed to get sensor..." error message?

raise HTTPError(f"Failed to get sensor, status code: {str(response.status)}")

Problem Observed

Started by configuring LaCrosse View integration in Home Assistant. Input the username and password. Then it kept failing with error message: Failed to get sensor, status code: 401

Full error log from Home Assistant:

2022-12-18 17:49:23.416 ERROR (MainThread) [homeassistant.components.lacrosse_view] Unexpected error fetching LaCrosse View data: Failed to get sensor, status code: 401
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/components/lacrosse_view/coordinator.py", line 63, in _async_update_data
sensors = await self.api.get_sensors(
File "/usr/local/lib/python3.10/site-packages/lacrosse_view/__init__.py", line 242, in get_sensors
raise HTTPError(
lacrosse_view.HTTPError: Failed to get sensor, status code: 401
The above exception was the direct cause of the following exception:
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 "/usr/src/homeassistant/homeassistant/components/lacrosse_view/coordinator.py", line 70, in _async_update_data
raise ConfigEntryNotReady from error
homeassistant.exceptions.ConfigEntryNotReady: Failed to get sensor, status code: 401

Troubleshooting

Tracing down through the code, it looks like this library gets all the way through retrieving the location data, then starts trying to iterate through the device list. (Meaning all the authentication and API calls worked so far.)

for device in data.get("items"):

But then inside that loop, it hits a non-200 response code and errors out completely.

raise HTTPError(f"Failed to get sensor, status code: {str(response.status)}")

I know I have ~7 devices in my list, but other than scripting this out myself, there's no information at all about which device failed or succeeded. Could we please get the device_id printed out as part of the error message?

Bonus

Perhaps this logic could be improved so that 1 device failing doesn't stop the rest from returning data?

Error 503 on logout

This is awesome! I have it working and I get the sensor data but the logout code is crashing with HTTP 503.

Exception has occurred: HTTPError
Failed to logout, status code: 503
  File "/home/mike/weather/lacrosse_view/__init__.py", line 261, in logout
    raise HTTPError(f"Failed to logout, status code: {str(response.status)}")
  File "/home/mike/weather/GetWeather.py", line 37, in get_data
    await api.logout()
  File "/home/mike/weather/GetWeather.py", line 39, in <module>
    asyncio.run(get_data())

just curious if you get this as well, and whether you know if there's a solution.

FYI 503 is Service Unavailable https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/503

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.