I have task on which I want to receive some msg via TCP/IP on port 8037 and then value of this msg will be used on Home Assistant + at the same time I need to forward this msg to WAN, so that also native app of OilFox will receive data.
Current flow:
Current status is that I receive data, but I have problem with extracting "value" from received msg + I also do not know how to forward original msg to WAN via port 80.
[{"id":"caae2049.f90ed","type":"tab","label":"TCPIP_OilFox","disabled":false,"info":""},{"id":"60de048b.3f9e4c","type":"tcp in","z":"caae2049.f90ed","name":"","server":"server","host":"","port":"8037","datamode":"stream","datatype":"buffer","newline":"","topic":"","base64":false,"x":80,"y":40,"wires":[["632203b6.d3214c","a06215a7.ff18c8","24443d9c.0c5022"]]},{"id":"632203b6.d3214c","type":"json","z":"caae2049.f90ed","name":"","property":"payload","action":"","pretty":true,"x":270,"y":40,"wires":[["a06215a7.ff18c8"]]},{"id":"a06215a7.ff18c8","type":"debug","z":"caae2049.f90ed","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","statusVal":"","statusType":"auto","x":490,"y":200,"wires":[]},{"id":"24443d9c.0c5022","type":"tcp out","z":"caae2049.f90ed","host":"metering.prod.oilfox.io","port":"80","beserver":"client","base64":false,"end":true,"name":"","x":340,"y":280,"wires":[]}]
So, when I will extract value from msg I know how to export data to HA, because I'm already using Node-RED to HA pluging via "entity" on other Flows.
So on short:
-need to export value data from received msg
-need to export battery data from received msg
-need to forward original received msg (port 8037) to WAN (port 80) - (this is because I re-routed internal device on static IP via NAT destination / source rule)
msg received (non-raw):
27. 10. 2020 14:51:30node: 632203b6.d3214c
msg : string[26]
"Ignored non-object payload"
27. 10. 2020 14:51:31node: a06215a7.ff18c8
msg.payload : buffer[956]
buffer[956]
POST /v1/meter HTTP/1.1
Host: metering.prod.oilfox.io
User-Agent: ESP8266HTTPClient
Connection: close
Accept-Encoding: identity;q=1,chunked;q=0.1,*;q=0
Content-Type: application/json
Content-Length: 744
{"token":"00000000-0000-0000-0000-000000000000","hwid":"<RESTRICTED>","value":12.5575,"battery":778,"version":"176.OF_PROD","temperature":20.125,"serialNumber":"<RESTRICTED>","measurements":[[12.5575,21.14229,29.8816,30.12197,39.58241,39.99448,58.76082,62.10889,79.29562,96.46519,129
27. 10. 2020 14:51:35node: 632203b6.d3214c
msg : string[26]
"Ignored non-object payload"
27. 10. 2020 14:51:36node: a06215a7.ff18c8
msg.payload : buffer[212]
buffer[212]
GET /v1/firmware/get-latest-version?hwid=<RESTRICTED>&v=176.OF_PROD HTTP/1.1
Host: metering.prod.oilfox.io
User-Agent: ESP8266HTTPClient
Connection: close
Accept-Encoding: identity;q=1,chunked;q=0.1,*;q=0
Can anybody help me regarding that?
Thank you and sorry if there is some mistake - this is my first post to Node-RED..