Hi ALl,
Im using Zwave2Mqtt. Have some door sensors and they also send temperature.
Homekit now complain about a Value:
ValueError: C is not a recognized temperature unit.
sensor.node_13_temperature:
value_id: 101-49-1-1
node_id: 101
class_id: 49
type: decimal
genre: user
instance: 1
index: 1
label: Air Temperature
units: C
help: Air Temperature Sensor Value
read_only: true
write_only: false
min: 0
max: 0
is_polled: false
value: 17.8
lastUpdate: 1588642402824
unit_of_measurement: C
friendly_name: Frontdoor Temp
device_class: temperature
templates:
icon_color: >-
if (state > 38) return 'rgb(181,14,2)'; if (state > 32) return
'rgb(214,18,4)'; if (state > 27) return 'rgb(255,0,0)'; if (state > 21)
return 'rgb(255,150,0)'; if (state > 16) return 'rgb(255,204,0)'; if (state
> 10) return 'rgb(0,255,0)'; if (state > 4) return 'rgb(4,181,4)'; if (state
> -1) return 'rgb(0,170,217)'; if (state > -7) return 'rgb(0,0,255)'; if
(state > -12) return 'rgb(121,24,196)'; if (state > -18) return
'rgb(176,0,189)'; if (state > -23) return 'rgb(189,0,107)'; return
'rgb(0,0,0)';
icon_color: 'rgb(255,204,0)'
But when I check in Zwave2Mqtt I see this JSON payload:
{
"type": "sensor",
"object_id": "temperature_air",
"discovery_payload": {
"value_template": "{{ value_json.value }}",
"device_class": "temperature",
"unit_of_measurement": "C",
"state_topic": "homeassistant/diningroom/door_imac/49/1/1",
"json_attributes_topic": "homeassistant/diningroom/door_imac/49/1/1",
"device": {
"identifiers": [
"zwave2mqtt_0xf2a6b7f2_node100"
],
"manufacturer": "FIBARO System",
"model": "FGDW002 Door Opening Sensor 2 (0x1000)",
"name": "diningroom-door_imac",
"sw_version": "Unknown"
},
"name": "diningroom-door_imac_temperature_air",
"unique_id": "zwave2mqtt_0xf2a6b7f2_100-49-1-1"
},
"discoveryTopic": "sensor/diningroom-door_imac/temperature_air/config",
"values": [
"49-1-1"
],
"persistent": true,
"id": "sensor_temperature_air"
}
There is no “units: C” but the correct “unit_of_measurement” part
In my customize file I have add some extra things
sensor.node_13_temperature:
friendly_name: "Door iMac Temp"
templates:
icon_color: >-
if (state > 38) return 'rgb(181,14,2)';
if (state > 32) return 'rgb(214,18,4)';
if (state > 27) return 'rgb(255,0,0)';
if (state > 21) return 'rgb(255,150,0)';
if (state > 16) return 'rgb(255,204,0)';
if (state > 10) return 'rgb(0,255,0)';
if (state > 4) return 'rgb(4,181,4)';
if (state > -1) return 'rgb(0,170,217)';
if (state > -7) return 'rgb(0,0,255)';
if (state > -12) return 'rgb(121,24,196)';
if (state > -18) return 'rgb(176,0,189)';
if (state > -23) return 'rgb(189,0,107)';
return 'rgb(0,0,0)';
Also nothing that will change the class of the device entity.
How can I solve this? The “Units C” break the option to show this entity in Homekit.
If nothing can do, I have to create a sensor template that show the temperature and put that one in Homekit, but thats only a workaround, I don’t like create more sensors if not needed