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

translation sensor does not work anymore #461

Closed thetux07 closed 1 year ago

thetux07 commented 1 year ago

Before you submit a new bug report, please check that

Describe the bug

the translation sensor for "today" and "tomorrow" does not work anymore have you an idea ? thank you regards

Configuration

{
  "home_assistant": {
    "installation_type": "Home Assistant OS",
    "version": "2023.4.5",
    "dev": false,
    "hassio": true,
    "virtualenv": false,
    "python_version": "3.10.10",
    "docker": true,
    "arch": "x86_64",
    "timezone": "Europe/Paris",
    "os_name": "Linux",
    "os_version": "6.1.24",
    "supervisor": "2023.04.0",
    "host_os": "Home Assistant OS 10.0",
    "docker_version": "23.0.3",
    "chassis": "embedded",
    "run_as_root": true
  },

    "garbage_collection": {
      "version": "4.10.2",
      "requirements": [
        "python-dateutil>=2.8.2"
      ]
    },
  "integration_manifest": {
    "domain": "garbage_collection",
    "name": "Garbage Collection",
    "version": "4.10.2",
    "documentation": "https://github.com/bruxy70/Garbage-Collection/",
    "issue_tracker": "https://github.com/bruxy70/Garbage-Collection/issues",
    "iot_class": "calculated",
    "integration_type": "helper",
    "dependencies": [],
    "config_flow": true,
    "codeowners": [
      "@bruxy70"
    ],
    "requirements": [
      "python-dateutil>=2.8.2"
    ],
    "is_built_in": false
  },
  "data": {
    "entity_id": "sensor.dechets_verts",
    "state": "tomorrow",
    "attributes": {
      "days": 1,
      "last_collection": null,
      "last_updated": "2023-04-20T08:59:22.447622+02:00",
      "next_date": "2023-04-21T00:00:00+02:00",
      "device_class": "garbage_collection__schedule"
    },
    "config_entry": {
      "entry_id": "a88fc74efbf7968c41d1fb61a4badffe",
      "version": 6,
      "domain": "garbage_collection",
      "title": "D\u00e9chets Verts",
      "data": {
        "unique_id": "24c595d6-d63f-47b4-a56d-74cddc49ece3",
        "hidden": false
      },
      "options": {
        "frequency": "weekly",
        "icon_normal": "mdi:trash-can",
        "icon_today": "mdi:delete-restore",
        "icon_tomorrow": "mdi:delete-circle",
        "manual_update": false,
        "verbose_state": true,
        "first_month": "jan",
        "last_month": "dec",
        "collection_days": [
          "fri"
        ],
        "period": 1,
        "first_week": 1,
        "verbose_format": "dans {days} jours",
        "date_format": "%d/%m"
      },
      "pref_disable_new_entities": false,
      "pref_disable_polling": false,
      "source": "import",
      "unique_id": null,
      "disabled_by": null
    }
  }
}

Debug logs

2023-04-20 09:19:42.311 DEBUG (MainThread) [custom_components.garbage_collection] Setting Ordures ménagères (weekly) from ConfigFlow
2023-04-20 09:19:42.311 DEBUG (MainThread) [custom_components.garbage_collection] Setting DĂ©chets recyclables (weekly) from ConfigFlow
2023-04-20 09:19:42.312 DEBUG (MainThread) [custom_components.garbage_collection] Setting DĂ©chets Verts (weekly) from ConfigFlow
2023-04-20 09:19:42.433 DEBUG (MainThread) [custom_components.garbage_collection.sensor] Creating garbage_collection calendar
2023-04-20 09:20:13.356 DEBUG (MainThread) [custom_components.garbage_collection.sensor] (DĂ©chets recyclables) Calling update
2023-04-20 09:20:13.415 DEBUG (MainThread) [custom_components.garbage_collection.sensor] (DĂ©chets recyclables) Dates loaded, firing a garbage_collection_loaded event
2023-04-20 09:20:13.416 DEBUG (MainThread) [custom_components.garbage_collection.sensor] (DĂ©chets recyclables) Looking for next collection
2023-04-20 09:20:13.416 DEBUG (MainThread) [custom_components.garbage_collection.sensor] (DĂ©chets recyclables) next_date (2023-04-20), today (2023-04-20)
2023-04-20 09:20:13.416 DEBUG (MainThread) [custom_components.garbage_collection.sensor] (DĂ©chets recyclables) Found next collection date: 20/04, that is in 0 days
2023-04-20 09:20:13.416 DEBUG (MainThread) [custom_components.garbage_collection.sensor] (DĂ©chets Verts) Calling update
2023-04-20 09:20:13.482 DEBUG (MainThread) [custom_components.garbage_collection.sensor] (DĂ©chets Verts) Dates loaded, firing a garbage_collection_loaded event
2023-04-20 09:20:13.483 DEBUG (MainThread) [custom_components.garbage_collection.sensor] (DĂ©chets Verts) Looking for next collection
2023-04-20 09:20:13.483 DEBUG (MainThread) [custom_components.garbage_collection.sensor] (DĂ©chets Verts) next_date (2023-04-21), today (2023-04-20)
2023-04-20 09:20:13.483 DEBUG (MainThread) [custom_components.garbage_collection.sensor] (DĂ©chets Verts) Found next collection date: 21/04, that is in 1 days
2023-04-20 09:20:14.556 DEBUG (MainThread) [custom_components.garbage_collection.sensor] (Ordures ménagères) Calling update
2023-04-20 09:20:14.615 DEBUG (MainThread) [custom_components.garbage_collection.sensor] (Ordures ménagères) Dates loaded, firing a garbage_collection_loaded event
2023-04-20 09:20:14.616 DEBUG (MainThread) [custom_components.garbage_collection.sensor] (Ordures ménagères) Looking for next collection
2023-04-20 09:20:14.616 DEBUG (MainThread) [custom_components.garbage_collection.sensor] (Ordures ménagères) next_date (2023-04-24), today (2023-04-20)
2023-04-20 09:20:14.616 DEBUG (MainThread) [custom_components.garbage_collection.sensor] (Ordures ménagères) Found next collection date: 24/04, that is in 4 days
github-actions[bot] commented 1 year ago

This issue has been automatically marked as stale because it has not had any activity in last 30 days. It will be closed in 5 days if no further activity occurs. Thank you for your contributions.

niighthawk commented 1 year ago

@thetux07 this is what i did to make it work

state_display: |
    [[[
      if (entity.state == 'today') return 'Aujourdhui';
      if (entity.state == 'tomorrow') return 'Demain';
    ]]]

image