If the result of the transform is just a number with no units or extra spaces then you can use a Number. Otherwise you need to use a String or parse it there non number parts using a Rule.
Perhaps, but as as far as one can tell in that screenshot there could be a space before or after the 230 or there could be some HTML tags which would be hidden in the browser.
For display it is enough. But I need to make some rules for comparison of number values.
If Pow2_Power is greater as high trigger value = daikin is on, if Pow2_Power is below low trigger value= daikin is off.
How to convert string value to number please ?
Can it be done with REGEX g´transformation or converting rule should be created ?
Thanks.
Like I said above, if what JSONPATH($.data) is just a number with no spaces or non-number characters then just change the Item type to Number.
Number Pow2_Voltage ...
If not, you will need a Rule that triggers when Pow2_Voltage changes, strips off the extraneous characters using String.split or a regex transform and updates the value of the Number Pow2_Voltage_Proxy Item.
// Sonoff via MQTT
Group Sonoff_POW
Switch Sonoff_POW_Switch "Power switch" <energy> (Sonoff_POW) { channel="mqtt:topic:mosquitto:sonoffpow2:relay/0" }
Number Sonoff_POW_Load "Power load [%.1f W]" <energy> (Sonoff_POW) { channel="mqtt:topic:mosquitto:sonoffpow2:power" }
Number Sonoff_POW_Voltage "Voltage [%.1f V]" <energy> (Sonoff_POW) { channel="mqtt:topic:mosquitto:sonoffpow2:voltage" }
Number Sonoff_POW_Current "Current [%.3f A]" <energy> (Sonoff_POW) { channel="mqtt:topic:mosquitto:sonoffpow2:current" }
Number Sonoff_POW_Apparent "Apparent [%.0f VAr]" <energy> (Sonoff_POW) { channel="mqtt:topic:mosquitto:sonoffpow2:apparent" }
Number Sonoff_POW_Energy "Energy [%.3f kWh]" <energy> (Sonoff_POW) { channel="mqtt:topic:mosquitto:sonoffpow2:energy" }
Number Sonoff_POW_Factor "Factor [%.0f]" <energy> (Sonoff_POW) { channel="mqtt:topic:mosquitto:sonoffpow2:factor" }
Things:
Bridge mqtt:broker:mosquitto "embedded-mqtt-broker" [ host="RPi_IP", port=1883, secure=false, username="", password="" ]
{
Thing topic sonoffpow2 {
Channels:
Type switch : switch "Power relay" [ stateTopic="ESPURNA-CA45ED/data", commandTopic="ESPURNA-CA45ED/relay/0/set", transformationPattern="JSONPATH:$.relay/0" ]
Type number : voltage "Line voltage" [ stateTopic="ESPURNA-CA45ED/data", transformationPattern="JSONPATH:$.voltage"]
Type number : power "Power load" [ stateTopic="ESPURNA-CA45ED/data", transformationPattern="JSONPATH:$.power"]
Type number : apparent "Power apparent" [ stateTopic="ESPURNA-CA45ED/data", transformationPattern="JSONPATH:$.apparent"]
Type number : current "Line current" [ stateTopic="ESPURNA-CA45ED/data", transformationPattern="JSONPATH:$.current"]
Type number : factor "Line factor" [ stateTopic="ESPURNA-CA45ED/data", transformationPattern="JSONPATH:$.factor"]
Type number : energy "Energy today" [ stateTopic="ESPURNA-CA45ED/data", transformationPattern="JSONPATH:$.energy"]
}
}