mampfes / hacs_waste_collection_schedule

Home Assistant integration framework for (garbage collection) schedules
MIT License
988 stars 631 forks source link

[Bug]: Sensor can't be created #2578

Open Triskelen opened 2 weeks ago

Triskelen commented 2 weeks ago

I Have A Problem With:

Sensor configuration

What's Your Problem

i added following code to my configuration.yaml

  - platform: waste_collection_schedule
    name: AFVAL
    value_template: 'in {{value.daysTo}} days'
    source_index: [0, 1]
    details_format: upcoming
    count: 1
    types:
      - Restafval
      - PMD
      - Papier en Karton

and it does not create a sensor

Source (if relevant)

No response

Logs

Logger: homeassistant.components.sensor
Bron: helpers/entity_platform.py:364
integratie: Sensor (documentatie, problemen)
Eerst voorgekomen: 22:57:33 (1 gebeurtenissen)
Laatst gelogd: 22:57:33

Error while setting up waste_collection_schedule platform for sensor
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 364, in _async_setup_platform
    await asyncio.shield(awaitable)
  File "/config/custom_components/waste_collection_schedule/sensor.py", line 131, in async_setup_platform
    api = hass.data[DOMAIN].get("YAML_CONFIG")
          ~~~~~~~~~^^^^^^^^
KeyError: 'waste_collection_schedule'

Relevant Configuration

  - platform: waste_collection_schedule
    name: AFVAL
    value_template: 'in {{value.daysTo}} days'
    source_index: [0, 1]
    details_format: upcoming
    count: 1
    types:
      - Restafval
      - PMD
      - Papier en Karton

Checklist Source Error

Checklist Sensor Error

Required

Triskelen commented 2 weeks ago

removed the type from the sensor data get following error:

`Logger: homeassistant.components.sensor Bron: helpers/entity_platform.py:364 integratie: Sensor (documentatie, problemen) Eerst voorgekomen: 23:10:00 (1 gebeurtenissen) Laatst gelogd: 23:10:00

Error while setting up waste_collection_schedule platform for sensor Traceback (most recent call last): File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 364, in _async_setup_platform await asyncio.shield(awaitable) File "/config/custom_components/waste_collection_schedule/sensor.py", line 131, in async_setup_platform api = hass.data[DOMAIN].get("YAML_CONFIG")


KeyError: 'waste_collection_schedule'`
5ila5 commented 2 weeks ago

I could only think of tow possibilities that would throw this.

  1. You did not configure any source. You always need to configure a source, You can see a list of all sources in the README. In Supported Service Providers you can find a list of all known supported regions/service providers grouped by country. You can follow the link to get detailed documentation on how to configure the respective source. For more general Documentation take a look here
  2. You have a broken installation: Try unistnalling -> restart HA -> reinstall WCS -> restart HA
Triskelen commented 2 weeks ago

all my calendar items are set so i think the source is set correctly. i just followed the list of instructions to set it up i did not add it to my configuration.yaml since it was installed using the gui

ill try to reinstall it

5ila5 commented 2 weeks ago

You cannot add YAML configured sensors to Sources created with the GUI as described in the GUI Limitations section here.

You can create sensors from the GUI using the Customize button next to your configured source.

There currently is no way to create a sensor accessing different GUI sources. So if you need source_index: [0, 1] You need to use the YAML source configuration. I want to resolve this by bringing the multiple sources wrapper to the GUI, but I haven't done this yet. And we probably need to taggle some fundamentals first to get a good user experience