core: Platform rest does not generate unique IDs

The problem

upon reloading Rest entities via the yaml menu,(eg after a config change, or adding a new sensor) below error is returned.

All rest sensor entities in my config have a unique_id. Somehow the error seems to indicate the system wants to re-create these.

What version of Home Assistant Core has the issue?

2023.3.6

What was the last working version of Home Assistant Core?

No response

What type of installation are you running?

Home Assistant OS

Integration causing the issue

Sensor , sensor rest

Link to integration documentation on our website

https://www.home-assistant.io/integrations/sensor.rest https://www.home-assistant.io/integrations/sensor

Diagnostics information

No response

Example YAML snippet

rest:

  - resource: !secret solar_forecast_api
    scan_interval: 86400
    sensor:

      - unique_id: solar_forecast_estimate_watt_hours_day
        name: Solar Forecast estimate watt hours day
        icon: mdi:calendar-today
        unit_of_measurement: Wh
        value_template: >
          {% set today = now().strftime('%Y-%m-%d') %}
          {{value_json.result.watt_hours_day[today]}}
        json_attributes_path: "$.result"
        json_attributes: watt_hours_day

      - unique_id: solar_forecast_estimate_message
        name: Solar Forecast estimate message
        icon: mdi:message-text-outline
        value_template: >
          {% set type = value_json.message.type %}
          {{type if type == 'success' else value_json.message.text}}
        json_attributes_path: "$.message"
        json_attributes:
          - code
          - type
          - text
          - info
          - ratelimit

Anything in the logs that might be useful for us?

Logger: homeassistant.components.sensor
Source: helpers/entity_platform.py:540 
Integration: Sensor (documentation, issues) 
First occurred: 09:03:25 (11 occurrences) 
Last logged: 09:03:27

Platform rest does not generate unique IDs. ID solar_forecast_estimate_watt_hours_day already exists - ignoring sensor.solar_forecast_estimate_watt_hours_day
Platform rest does not generate unique IDs. ID solar_forecast_estimate_message already exists - ignoring sensor.solar_forecast_estimate_message
Platform rest does not generate unique IDs. ID maan_astronomy already exists - ignoring sensor.maan_astronomy
Platform rest does not generate unique IDs. ID knmi_waarschuwingen_nb already exists - ignoring sensor.knmi_waarschuwingen_nb
Platform rest does not generate unique IDs. ID knmi_waarschuwingen_basis already exists - ignoring sensor.knmi_waarschuwingen_basis

Additional information

No response

About this issue

  • Original URL
  • State: open
  • Created a year ago
  • Reactions: 8
  • Comments: 16 (2 by maintainers)

Most upvoted comments

I have found these error message go away if I don’t specify a unique_id for REST sensors.

Getting the same error. Platform unifiprotect does not generate unique IDs. ID 68D79AE131A9_0 already exists - ignoring camera.cam_m_high As a result, the camera live image does not work. Deleting the integration and readding it, has not solved the issue.

HA Core 2023.12.4

Same for me. Version 2023.10.1

Also experiencing this on 2023.10.1. Pulling my hair out trying to figure out why my REST sensors and then saw this ignored message in the log! Removing the unique_id creates duplicates each time the REST sensors reload.