How can I extract the Value out of the following MQTT state:
“true02021-08-03T08:29:15.3646081Z02021-08-03T08:29:15.3646081Z0”
I only need the Value “true”. Can i do this with XPath expression?
What I have to insert?
How can I extract the Value out of the following MQTT state:
“true02021-08-03T08:29:15.3646081Z02021-08-03T08:29:15.3646081Z0”
I only need the Value “true”. Can i do this with XPath expression?
What I have to insert?
What else can the value be? Looks like a job for REGEX, “get string until first numeric character”.
Oh, that’s rather different. You could still REGEX as you know the values, but the “proper” way would be XPATH, yes.
XPATH is an installable add-on, so first make sure that you’ve installed it.
I suppose you could look at the docs, instead of guessing
The namespace is important here.
Example
Note that once you’ve created your channel with some guessed transformation, the binding doesn’t always recognize if you edit it later. Once you have your best guess in place, if it doesn’t seem to work, then restart the MQTT package to make sure it uses your latest edit.
Now it works!
The problem was actually the namespace.
I had to insert the transformation like this:
"/[name()=‘html’]/[name()=‘head’]/[name()=‘title’]/text()"
XPath:/[name()=‘DataValue’]/[name()=‘Value’]/[name()=‘Value’]/*[name()=‘Boolean’]/text()
Thank you very much for your help!