custom-components / sensor.avfallsor

Simple sensor for avfallsor
MIT License
8 stars 6 forks source link

next pickup eq null #3

Closed Oldolo closed 4 years ago

Oldolo commented 4 years ago

Not all bins get updated pickup date. Waste seems to update, but metal, and paper does not.

I can see the last updated time is being updated, but the next pickup is set to null.

Running newest version of HA and the custom compnent. Installed via HACS and configured in integration.

I see the following error when I restart HA

Error while setting up platform avfallsor
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 150, in _async_setup_platform
    await asyncio.wait_for(asyncio.shield(task), SLOW_SETUP_MAX_WAIT)
  File "/usr/local/lib/python3.7/asyncio/tasks.py", line 442, in wait_for
    return fut.result()
  File "/config/custom_components/avfallsor/sensor.py", line 76, in async_setup_platform
    await data.update()
  File "/config/custom_components/avfallsor/sensor.py", line 176, in update
    await self._update()
  File "/config/custom_components/avfallsor/sensor.py", line 172, in _update
    self._data = parse_tomme_kalender(text)
  File "/config/custom_components/avfallsor/utils.py", line 86, in parse_tomme_kalender
    tomme_day = tommeday_soup.split(":")[1].strip()
AttributeError: 'NoneType' object has no attribute 'split'
Hellowlol commented 4 years ago

Thanks for the report. Parsing of sites tend to break because of changes in the html. What adresse is this on? (Dont need to your adress, just close enough so i get the correct tømme kalender)

Oldolo commented 4 years ago

id=257377&kommune=Kristiansand

Hellowlol commented 4 years ago

Thanks, the page seems to have the info i need. How have you setup the sensor? Yaml or the webui? Can you ensble debug logging?

I want to check what URL the sensor uses. It tries to be clever, sometimes it too clever for its own good. 🤔

Oldolo commented 4 years ago

It is setup with webui. I think I added street ID and municipality. Also deselected bio. (not sure how to verify that)

Found out that I had a misconfiguration in yaml too... I had added the platform without any configuration. I removed this and the first error I stated this issue with disappeared. So now I only have the issue where I dont get updated pickup date on paper and metal.

2020-01-08 10:20:08 INFO (MainThread) [custom_components.avfallsor.sensor] Fetching stuff for AvfallSorData
2020-01-08 10:20:08 DEBUG (MainThread) [custom_components.avfallsor.sensor] Fetching data from https://avfallsor.no/tommekalender/?id=257377&kommune=Kristiansand
Skeletorjus commented 4 years ago

Seeing the same issue. HACS, added via integrations.

2020-01-08 10:47:12 INFO (MainThread) [homeassistant.setup] Setup of domain avfallsor took 0.0 seconds.
2020-01-08 10:47:12 DEBUG (MainThread) [homeassistant.core] Bus:Handling <Event component_loaded[L]: component=avfallsor>
2020-01-08 10:47:32 INFO (MainThread) [homeassistant.components.sensor] Setting up sensor.avfallsor
2020-01-08 10:47:32 INFO (MainThread) [custom_components.avfallsor.sensor] Fetching stuff for AvfallSorData
2020-01-08 10:47:32 DEBUG (MainThread) [custom_components.avfallsor.sensor] Fetching data from https://avfallsor.no/tommekalender/?id=255940&kommune=Kristiansand
2020-01-08 10:47:33 DEBUG (MainThread) [homeassistant.core] Bus:Handling <Event state_changed[L]: entity_id=sensor.avfallsor_metal_255939, old_state=None, new_state=<state sensor.avfallsor_metal_255939=unknown; next garbage pickup=None, attribution=avfallsør, last update=2020-01-08T11:47:33.924417+01:00, unit_of_measurement=days, friendly_name=avfallsor_metal_255939, icon=mdi:bottle-wine @ 2020-01-08T10:47:33.928779+01:00>>
2020-01-08 10:47:33 DEBUG (MainThread) [homeassistant.core] Bus:Handling <Event state_changed[L]: entity_id=sensor.avfallsor_bio_255939, old_state=None, new_state=<state sensor.avfallsor_bio_255939=1; next garbage pickup=2020-01-09T01:00:00+01:00, attribution=avfallsør, last update=2020-01-08T11:47:33.924417+01:00, unit_of_measurement=days, friendly_name=avfallsor_bio_255939, icon=mdi:trash-can @ 2020-01-08T10:47:33.933204+01:00>>
2020-01-08 10:47:33 DEBUG (MainThread) [homeassistant.core] Bus:Handling <Event state_changed[L]: entity_id=sensor.avfallsor_paper_255939, old_state=None, new_state=<state sensor.avfallsor_paper_255939=unknown; next garbage pickup=None, attribution=avfallsør, last update=2020-01-08T11:47:33.924417+01:00, unit_of_measurement=days, friendly_name=avfallsor_paper_255939, icon=mdi:recycle @ 2020-01-08T10:47:33.936282+01:00>>
2020-01-08 10:47:33 DEBUG (MainThread) [homeassistant.core] Bus:Handling <Event state_changed[L]: entity_id=sensor.avfallsor_plastic_255939, old_state=None, new_state=<state sensor.avfallsor_plastic_255939=unknown; next garbage pickup=None, attribution=avfallsør, last update=2020-01-08T11:47:33.924417+01:00, unit_of_measurement=days, friendly_name=avfallsor_plastic_255939, icon=mdi:trash-can @ 2020-01-08T10:47:33.939555+01:00>>
2020-01-08 10:47:33 DEBUG (MainThread) [homeassistant.core] Bus:Handling <Event state_changed[L]: entity_id=sensor.avfallsor_mixed_255939, old_state=None, new_state=<state sensor.avfallsor_mixed_255939=1; next garbage pickup=2020-01-09T01:00:00+01:00, attribution=avfallsør, last update=2020-01-08T11:47:33.924417+01:00, unit_of_measurement=days, friendly_name=avfallsor_mixed_255939, icon=mdi:trash-can @ 2020-01-08T10:47:33.942341+01:00>>
2020-01-08 10:47:35 DEBUG (MainThread) [homeassistant.core] Bus:Handling <Event hacs/repository[L]: id=1337, action=registration, repository=custom-components/sensor.avfallsor, repository_id=None>
Hellowlol commented 4 years ago

Can you check if the latest update fixes your issue?

Skeletorjus commented 4 years ago

Working here! Thanks!

Oldolo commented 4 years ago

Working here too! Thanks for quick help! :)