bruxy70 / Garbage-Collection

🗑 Custom Home Assistant sensor for scheduling garbage collection (or other regularly re-occurring events - weekly on given days, semi-weekly or monthly)
MIT License
383 stars 90 forks source link

Can't remove Garbage_Collection entity #447

Closed mothy-tim closed 1 year ago

mothy-tim commented 1 year ago

Before you submit a new bug report, please check that

Write your question here

Hi, I removed the integration and missed the entity! How do I remove it, please? It says I can't edit it as it has no ID! Thanks, Tim

bruxy70 commented 1 year ago

If you have removed the integration, then the integration cannot help you I am afraid. I think this is a general Home Assistant question. Did you try re-installing it, removing the configured devices and uninstalling it again? Or removing the entities from the list of entities.

danielbrunt57 commented 1 year ago

I too removed the integration but had to go under the hood into HA files and manually remove the entity from /config/.storage/core.config_entries + stop HA & remove the entity from core.restore_state and then restart HA. Fortunately, I have done this before so not a big deal.

I have replaced the integration with the HA (new) native calendar integration for my garbage collection which always occurs on Wednesday, no exceptions. For recycling, I have used the HACS waste_collection_schedule integration as my Richmond site has ICS files available. I created additional templated sensors so I can still use the lovelace custom:garbage-collection-card...

image

type: grid
style: |
  ha-card {
  font-size: 8px;
  }
square: false
columns: 2
cards:
  - type: custom:garbage-collection-card
    entity: sensor.garbage
    icon_color: grey
    due_color: red
    due_1_color: yellow
    hide_date: true
    hide_days: false
    due_txt: true
    hide_on_click: false
    icon_size: 30px
    card_mod:
      class: inline-card
  - type: custom:garbage-collection-card
    entity: sensor.richmond_recycling
    hide_title: false
    icon_color: green
    due_color: red
    due_1_color: yellow
    hide_date: true
    hide_days: false
    due_txt: true
    hide_on_click: false
    icon_size: 30px
    card_mod:
      class: inline-card
waste_collection_schedule:
  sources:
    - name: ics
      calendar_title: Richmond Recycling
      args:
        url: https://recollect.a.ssl.fastly.net/api/places/8C86E114-C25F-11E2-ACE5-82EC225B0DBF/services/200/events.en.ics
      customize:
        - type: Recycling and green cart
          alias: Recycling Pickup
          icon: mdi:recycle
  day_switch_time: "11:00"
  - platform: waste_collection_schedule
    name: Recycling Collection Schedule
    details_format: appointment_types
    add_days_to: true
    types:
      - Recycling Pickup
    value_template: >
      {% if value.daysTo | int(0) > 2 %}
       2
      {% else %}
       value.daysTo
      {% endif %}
- sensor:
  - name: Recycling
    unique_id: recycling
    state: "{{ states('sensor.recycling_collection_schedule') }}"
    icon: mdi:recycle
    attributes:
      next_date: "{{ state_attr('sensor.recycling_collection_schedule', 'Recycling Pickup') }}"
      days: "{{ state_attr('sensor.recycling_collection_schedule','daysTo') }}"

  - name: Garbage
    unique_id: garbage_pickup
    state: >
      {% if state_attr("sensor.garbage","days") | int(0) > 2 %} 2
      {% else %} {{state_attr("sensor.garbage","days") }}
      {% endif %}
    icon: mdi:trash-can
    attributes:
      next_date: '{{ as_timestamp(state_attr("calendar.garbage_schedule", "start_time"))| timestamp_custom("%Y-%m-%d") }}'
      days: '{{ ((as_timestamp(state_attr("calendar.garbage_schedule","start_time")) - as_timestamp(now())) /60/1440)|round(0,"ceil")  }}'

I don't know how I would have used the native calendar solution to easily bump recycling days when there's a holiday!!! It only took me like 4-5 hours and countless reboots to get 'er done... Hope this helps someone!!

...and thank you @bruxy70 for your hard work and devotion!

mothy-tim commented 1 year ago

Thanks, @danielbrunt57, it was core.restore_state that I missed! Removing entries from there fixed the issue! Thanks also for the additional info, I have already set up waste_collection_shedule as it looks after all 3 of our collections, but will look at the garbage collection card with interest! Cheers Tim