RESTful Sensor - unique_id

Hi,

I have a couple of Rest sensors (for temperature), and I noticed that according to the documentation the RESTful sensor should support the uniqe_id configuration variable.

But if i enter a uniqe_id for my sensor, the validation fails in the GUI (Developer Tools/Check Configuration).

Any ideas? It would be very convenient to be able to rename the entity in the gui.

Please paste the YAML config for your sensors, properly formatted with the </> button.

I have a rest sensor (sensor.rest rather than rest.sensor) with a unique_id that passes configuration checks and allows an area to be set.

There are two REST integrations, one that supports unique_id and the other that doesn’t.

Wow, this is… confusing. :slight_smile:

I am running Home Assistant OS on Raspberry Pi, nothing special.

I just added the following snippet to configuration.yaml, so i guess I am using sensor.rest?

sensor:
  - platform: rest
    resource: http://192.168.192.7/json/?sensor=ute1
    value_template: "{{ value_json.value }}"
    unit_of_measurement: "°C"
    name: "Temp Ute"
#    unique_id: "temp_ute1"
#    this line fails validation!

According to the error message, I am using sensor.rest?

This is my entire configuration.yaml. The only thing added manually is the temperature sensor.

# Loads default set of integrations. Do not remove.
default_config:

# Text to speech
tts:
  - platform: google_translate

automation: !include automations.yaml
script: !include scripts.yaml
scene: !include scenes.yaml

tellstick:
    host: core-tellstick
    port: [50800, 50801]

sensor:
  - platform: rest
    unique_id: temp_ute1
    resource: http://192.168.192.7/json/?sensor=ute1
    value_template: "{{ value_json.value }}"
    unit_of_measurement: "°C"
    name: "Temp Ute"

Edit: Sorry for the duplicate post. Forum didn´t work as I expected.

@llelundberg — I think your HA installation needs updating. unique_id appears to have been added to sensor.rest in June 2022: if your system is complaining, I’d suggest it’s older than that.

This isn’t true: they both support unique_id. From rest.sensor docs:

Yes! You are correct, I was running 2022.6.7. Upgrading to 2023.1.7 solved my problem.

Thanks!

1 Like