Please help.
I have a thing that return 3 values in one line, i want add custom channels to thing to split values - is it possible?
Thing device m8_p34 [hostname="192.168.53.188", port="34", password="sec", refresh="5"]
String m8p34_i2c "i2c [%s]" { channel="megad:device:in:m8_p34:i2c" }
returns: temp:24.17/press:765.63/hum:39.797
I want to define custom channel “i2cTemp” with transformation rule to get first value from line:
Thing device m8_p34 [hostname="192.168.53.188", port="34", password="sec", refresh="5"]
{
Channels:
State Number : i2cTemp "Temperature" [ transformationPattern="JS:megad_i2c_1.js" ]
}
Number m8p34_i2cTemp "i2c [%.1f °C]" { channel="megad:device:in:m8_p34:i2cTemp" }
But Item m8p34_i2cTemp
is NULL
, where is mistake?
Trasformation rule:
(function(msg){
//temp:22.60/press:766.68/hum:39.463
// =====
return msg.split("/")[0].split(":")[1];
})
(input)