I have 2 entities of which HA tells me I cant change any setting because they dont have a unique ID, but they do, and HA confirms it on the status page…
(Translation: CPU Package Temperature This entity (“sensor.proxmox_cpu_temperature”) does not have a unique ID, therefore its settings cannot be managed from the user interface. See documentation for more details.)
An entity’s unique_id isn’t normally displayed anywhere. What you’re seeing appears to be an attribute named unique_id.
Which integration produces sensor.proxmox_cpu_temperature? Because the integration is responsible for assigning the sensor with a unique_id value. If you used the Template integration to create the sensor then you must use its unique_id option.
I created it on the proxmox node itself
Created an sh and made it a 1 minute repeating cronjob
#!/bin/bash
# Home Assistant Settings
url_base="http://homeassistant.local:8123/api/states"
token="long-live HA token"
# Server name
srv_name="pve"
# Constants for device info
DEVICE_IDENTIFIERS='["n100_server"]'
DEVICE_NAME="Intel N100"
DEVICE_MANUFACTURER="AC8-N"
DEVICE_MODEL="N100 16 512"
# Function to send data to Home Assistant
send_to_ha() {
local sensor_name=$1
local temperature=$2
local friendly_name=$3
local icon=$4
local unique_id=$5
local url="${url_base}/${sensor_name}"
local device_info="{\"identifiers\":${DEVICE_IDENTIFIERS},\"name\":\"${DEVICE_NAME}\",\"manufacturer\":\"${DEVICE_MANUFACTURER}\",\"model\":\"${DEVICE_MODEL}\"}"
local payload="{\"state\":\"${temperature}\",\"attributes\": {\"friendly_name\":\"${friendly_name}\",\"icon\":\"${icon}\",\"state_class\":\"measurement\",\"unit_of_measurement\":\"°C\",\"device_class\":\"temperature\",\"unique_id\":\"${unique_id}\"},\"device\":${device_info}}"
curl -X POST -H "Authorization: Bearer ${token}" -H 'Content-type: application/json' --data "${payload}" "${url}"
}
# Send CPU package temperature
cpu_temp=$(sensors | grep 'Package id 0' | awk '{print $4}' | sed 's/+//;s/°C//')
send_to_ha "sensor.${srv_name}_cpu_temperature" "${cpu_temp}" "CPU Package Temperature" "mdi:cpu-64-bit" "${srv_name}_cpu_temp"
# Send Chipset temperature (adjust device if necessary)
chipset_temp=$(sensors | grep 'temp1:' | awk '{print $2}' | sed 's/+//;s/°C//')
if [[ $chipset_temp != "" ]]; then
send_to_ha "sensor.${srv_name}_chipset_temperature" "${chipset_temp}" "Chipset Temperature" "mdi:chip" "${srv_name}_chipset_temp"
fi
# Send NVMe/SSD composite temperature (adjust device if necessary)
nvme_temp=$(sensors | grep 'Composite' | head -1 | awk '{print $2}' | sed 's/+//;s/°C//')
if [[ $nvme_temp != "" ]]; then
send_to_ha "sensor.${srv_name}_nvme_temperature" "${nvme_temp}" "NVMe/SSD Temperature" "mdi:harddisk" "${srv_name}_nvme_temp"
fi
# Send GPU temperature (adjust device if necessary)
gpu_temp=$(sensors | grep 'GPU Temp' | awk '{print $2}' | sed 's/+//;s/°C//')
if [[ $gpu_temp != "" ]]; then
send_to_ha "sensor.${srv_name}_gpu_temperature" "${gpu_temp}" "GPU Temperature" "mdi:gpu" "${srv_name}_gpu_temp"
fi
You can’t create entities with unique_id through that API. You can just create entities. Unique_id is not an attribute on the entity, it’s something that can identify the entity when HA starts up. HA will take that unique_id assign it to the entity registry, then it’s available for UI editing. When going through "http://homeassistant.local:8123/api/states", you completely bypass the entity registry. Making it impossible to edit via the UI.
This line is creating unique_id as an attribute. That’s why it appears in the entity’s attributes and isn’t the entity’s unique identifier (which gets stored in a hidden JSON file and isn’t displayed in the UI). That’s why the error message complains the entity doesn’t have a unique_id.
local payload="{\"state\":\"${temperature}\",\"attributes\": {\"friendly_name\":\"${friendly_name}\",\"icon\":\"${icon}\",\"state_class\":\"measurement\",\"unit_of_measurement\":\"°C\",\"device_class\":\"temperature\",\"unique_id\":\"${unique_id}\"},\"device\":${device_info}}"
^^^^^^^^^^
Perhaps you can modify your shell script to periodically publish the temperature value to an MQTT topic. Then create an MQTT Sensor subscribed to that topic. An MQTT Sensor can be assigned a unique_id.