So I am trying to use node-red to read my gmail account, parse a status summary message I get every day from my utility company, then ultimately use the openhab2-out filter to send a status update to my item. The ridiculous problem I’m having is that the “payload” field for the openhab2-out filter will literally put whatever text is in the field out into the REST API. I have tried setting msg.payload (in node red) to the desired float value, but I always get a “State could not be parsed” error. The only thing that “works” is if I actually type out the desired value into that field i.e. payload = 3.2 which it will happily accept. What am I missing here? Below is the error output from the console, as well as a screenshot of the “payload” field I’m talking about. Typing an actual number in there will work, but I’d like to be able to specify the variable i.e. ‘foo’ and have the filter know that ‘foo’ is actually 3.2 and send a bloody 3.2!
6 Aug 01:31:10 - [warn] [openhab2-out:updateElectricDaily] response error '{"statusCode":400,"body":"{\"error\":{\"message\":\"State could not be parsed: msg.payload\",\"http-code\":400}}","headers":{"connection":"close","content-type":"application/json","content-encoding":"UTF-8","content-length":"78","server":"Jetty(9.4.20.v20190813)"},"request":{"uri":{"protocol":"http:","slashes":true,"auth":"openhabian:XXXXXXXX","host":"localhost:8080","port":"8080","hostname":"localhost","hash":null,"search":null,"query":null,"pathname":"/rest/items/Utility_Electric_Daily/state","path":"/rest/items/Utility_Electric_Daily/state","href":"http://openhabian:XXXXXXXXX@localhost:8080/rest/items/Utility_Electric_Daily/state"},"method":"PUT","headers":{"authorization":"Basic b3BlbmhhYmlhbjoxNDNjb2xsZWVu","content-length":11}}}' on 'http://openhabian:XXXXXXXX@localhost:8080/rest/items/Utility_Electric_Daily/state'