Hello!
I would like to read a part of a string, which I get via MQTT, into a number, which should then be stored in a database. Unfortunately I can’t find anything really suitable.
The string is prepared as follows:
Type string : Temperature "Temperature" [ stateTopic="tele/sonoff_mini_61/SENSOR", transformationPattern="JSONPATH:$.BMP280.Temperature" ]
Andb this is why I recommend using the UI it REST APai to define Thing. There it is simple and obvious, just select Number for the Channel type… All I can offer is that it’s possible. I couldn’t tell you how.
Hi,
as I struggled for hours to find the right expression to compare a number received as MQTT-string-item with another number in a rule, here the final solution:
item:
String FensterkontaktEBatterie "Batterie" {channel="mqtt:topic:....
var Warnschwelle = 95
rule:
....
if ( Float::parseFloat(FensterkontaktEBatterie.state.toString) < Warnschwelle )
{...