bgbraga / homeassistant-apsystems

An APsystems Sensor for Home Assistant
Apache License 2.0
21 stars 13 forks source link

Error in System Log uppon start-up #11

Open WorldOfMaze opened 1 year ago

WorldOfMaze commented 1 year ago

I have installed the repository via HACS, created the sensor, checked the config, and restart HASS. I am getting two errors:

Logger: homeassistant.components.sensor
Source: /usr/local/lib/python3.10/asyncio/events.py:80
Integration: Sensor (documentation, issues)
First occurred: 4:09:42 PM (1 occurrences)
Last logged: 4:09:42 PM

Setup of sensor platform apsystems is taking over 10 seconds.

and

Logger: homeassistant.components.sensor
Source: custom_components/apsystems/sensor.py:207
Integration: Sensor (documentation, issues)
First occurred: 4:09:34 PM (5 occurrences)
Last logged: 4:09:43 PM

apsystems: Error on device update!
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 446, in _async_add_entity 
    await entity.async_device_update(warning=False)
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 702, in async_device_update
    await task
  File "/config/custom_components/apsystems/sensor.py", line 146, in async_update
    ap_data = await self._fetcher.data()
  File "/config/custom_components/apsystems/sensor.py", line 253, in data
    await self.run()
  File "/config/custom_components/apsystems/sensor.py", line 221, in run
    browser = await self.login()
  File "/config/custom_components/apsystems/sensor.py", line 207, in login
    browser.select_form(nr=0)
  File "/usr/local/lib/python3.10/site-packages/mechanize/_mechanize.py", line 628, in select_form
    raise BrowserStateError("not viewing HTML")
mechanize._mechanize.BrowserStateError: not viewing HTML

Any ideas how to fix this?

Thanks.

skelgaard commented 1 year ago

your using an outdated version, use my forked version instead of this one

WorldOfMaze commented 1 year ago

Thank you, @skelgaard. Once I updated the sensor, everything works like a champ.