After much trial and error I have managed to get MQTT 2.4 updating a string item,
- Added a MQTT broker Thing pointing to my mosquittto mq
- Added a MQTT generic Thing using the Thing from 1 as the bridge
- Added a Channel to (2) selecting the MQ topic I want to catch
- Linked (3) to the item I want to receive the value
in the events log with a string item an no transformation I see
test_solar changed from NULL to <msg><time>2018-12-24 16:03:21</time><tmpr>20.2</tmpr><ch1><watts>00672</watts></ch1><ch2><watts>00028</watts></ch2></msg>
If I then add XPATH transformation on the channel definition XPATH:/msg/ch1/watts/text() I get
`test_solar changed from 2018-12-24 16:03:2120.20067200028 to 00658
… however I want the item to be a Number. If I just change the item type to number then I get
Tried to set invalid state 00658 (StringType) on item test_solar of type NumberItem, ignoring it
so I changed the XPATH to XPATH:/msg/ch1/watts/number(text()) which according to an online XPATH tester should return a Double=‘658’ but instead I get
Executing the XPATH-transformation failed: transformation throws exceptions
Can someone enlighten me on how to convert my string of numbers to an actual number ?
Thanks in advance