I am trying to read a value via modbus and convert it into an Item. The modbus-tcp
binding is working, as is the ‘modbus poller’ and the ‘modbus data’.
What fails is the conversion to an Item:
[WARN ] [openhab.core.library.items.NumberItem] - Failed to update item 'OutsideTemperature' because '15.7' could not be converted to the item unit '°C'
It seems to me that ‘15.7’ is a Number (it is also a plausible outside temperature value), so why does the conversion to a temperature (Number:Temperature) fail?
Here is the modbus data definition created through the UI:
UID: modbus:data:outside_temperature:outside_temperature
label: Modbus Data Outside Temperature
thingTypeUID: modbus:data
configuration:
readValueType: int16
readTransform: default
writeTransform: default
readStart: "30009"
updateUnchangedValuesEveryMillis: 1000
writeMultipleEvenWithSingleRegisterOrCoil: false
writeMaxTries: 3
bridgeUID: modbus:poller:source:outside_temperature
location: outside
channels:
- id: number
channelTypeUID: modbus:number-type
label: Value as Number
description: Number item channel
configuration: {}
- id: switch
channelTypeUID: modbus:switch-type
label: Value as Switch
description: Switch item channel
configuration: {}
- id: contact
channelTypeUID: modbus:contact-type
label: Value as Contact
description: Contact item channel
configuration: {}
- id: dimmer
channelTypeUID: modbus:dimmer-type
label: Value as Dimmer
description: Dimmer item channel
configuration: {}
- id: datetime
channelTypeUID: modbus:datetime-type
label: Value as DateTime
description: DateTime item channel
configuration: {}
- id: string
channelTypeUID: modbus:string-type
label: Value as String
description: String item channel
configuration: {}
- id: rollershutter
channelTypeUID: modbus:rollershutter-type
label: Value as Rollershutter
description: Rollershutter item channel
configuration: {}
- id: lastReadSuccess
channelTypeUID: modbus:last-successful-read-type
label: Last Successful Read
description: Date of last read
configuration: {}
- id: lastReadError
channelTypeUID: modbus:last-erroring-read-type
label: Last Erroring Read
description: Date of last read error
configuration: {}
- id: lastWriteSuccess
channelTypeUID: modbus:last-successful-write-type
label: Last Successful Write
description: Date of last write
configuration: {}
- id: lastWriteError
channelTypeUID: modbus:last-erroring-write-type
label: Last Erroring Write
description: Date of last write error
configuration: {}
I then defined an Item:
label: Outside Temperature
type: Number:Temperature
category: ""
groupNames:
- outside
tags:
- Temperature
- Point
I linked this Item to the channel modbus:data:outside_temperature:outside_temperature:number
using a Gain-Offset Correction with offset 0 and gain 0.1 to convert the modbus integer value (e.g. 157) to a float 15.7.
(Sorry, could not find the YAML describing this in the UI anywhere.)
Since I see 15.7 displayed in the log, I am assuming that the gain-offset correction has worked.
How come the conversion to a temperature fails?