Help with alexa home node to automate diy spa bath heater with sonoff th16 temperature controlled relay

I have the knowledge to develop this flow on all issues apart from getting node red to get the temp from ewelink to compare the temp against the temp of the set temp value stored in alexa, I have already got alexa to speak the temp of the water no problem, I have alexa setting the aim temp no problem, I just cant get a flow working that compares the current temp against the set target temp, I can control the frequency and anything else involved after, like when to heat and when not to heat,
I have read what i can on global context, objects and arrays but it still has not clicked in my head on how to compare the get and set temp so i can heat or not accordingly,
Thanks in advance and yes my full stop key has stopped working so I apologise for the commas i have replaced them with,

I take it these are standard sonoff devices, not flashed.

If so you can use node-red-contrib-ewelink to poll temp and the device listener may report temp.

yeah i got that far no problem, I just need help with the flow for compoaring the set tgemp against the actual temp so i can turn the heater on in the flow when temp is below target and turn off when above target temp, The flow gets this info from the alexa home node from a thermostat sensor i have created on the home skill device setup

Currently I have Alexa announce the temp every 60 seconds, from the bathroom echo only, I plan to have alexa only announcing when a significant temp change has been sensed, This is within my capabilities , What i cant do is compare the polling temp info every 60 seconds with the settemperaturetargetrequest that alexa sends as a msg payload command with the 60 seconds poll to then switch the relay to required state I am sure its a small flow with a few change and combine nodes but i cant grasp the logic around this issue

Have a look at node-red-contrib-ramp-thermostat.

If that does not help, then provide an example of your flow and inputs, then we can give more advise.

[edit]

here is a simple comparison, it has a deadband so once it reaches set point it has to fall below dead band value to turn off, this is to stop any oscillation.

[{"id":"20c65ac1.91d14e","type":"inject","z":"57675e72.26a0d8","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"20.9","payloadType":"num","x":130,"y":480,"wires":[["f9f5ce00.7a0ed8"]]},{"id":"f9f5ce00.7a0ed8","type":"change","z":"57675e72.26a0d8","name":"","rules":[{"t":"set","p":"payload","pt":"msg","to":"payload >= $flowContext(\"setpoint\")  ? \t1 \t: payload < $flowContext(\"setpoint\") - $flowContext(\"deadband\") ? \t0 ","tot":"jsonata"}],"action":"","property":"","from":"","to":"","reg":false,"x":340,"y":480,"wires":[["cdd63e01.c0bf2"]]},{"id":"f4ce440d.f28448","type":"inject","z":"57675e72.26a0d8","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"20.7","payloadType":"num","x":120,"y":440,"wires":[["f9f5ce00.7a0ed8"]]},{"id":"9d934a44.69583","type":"inject","z":"57675e72.26a0d8","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"21","payloadType":"num","x":110,"y":520,"wires":[["f9f5ce00.7a0ed8"]]},{"id":"5c062863.e01be8","type":"inject","z":"57675e72.26a0d8","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"21.5","payloadType":"num","x":127.33332824707031,"y":558.6666870117188,"wires":[["f9f5ce00.7a0ed8"]]},{"id":"cdd63e01.c0bf2","type":"switch","z":"57675e72.26a0d8","name":"","property":"payload","propertyType":"msg","rules":[{"t":"istype","v":"number","vt":"number"}],"checkall":"true","repair":false,"outputs":1,"x":410,"y":540,"wires":[["7fa11ff4.ea97b8"]]},{"id":"7fa11ff4.ea97b8","type":"rbe","z":"57675e72.26a0d8","name":"","func":"rbe","gap":"","start":"","inout":"out","property":"payload","x":550,"y":540,"wires":[["3f5a851.f4bdffa"]]},{"id":"3f5a851.f4bdffa","type":"debug","z":"57675e72.26a0d8","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","statusVal":"","statusType":"auto","x":600,"y":480,"wires":[]},{"id":"2ca75c14.eefb4c","type":"inject","z":"57675e72.26a0d8","name":"set set point","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"21","payloadType":"num","x":160,"y":360,"wires":[["da712b9f.7a0588"]]},{"id":"da712b9f.7a0588","type":"change","z":"57675e72.26a0d8","name":"","rules":[{"t":"set","p":"setpoint","pt":"flow","to":"21","tot":"num"},{"t":"set","p":"deadband","pt":"flow","to":"0.2","tot":"num"}],"action":"","property":"","from":"","to":"","reg":false,"x":330,"y":360,"wires":[[]]}]

Already tried ramp thermo, Its not really any use, Its a Alexa integration and a lack of knowledge of java and jsonata that is my downfall, The flow I have so far uses alexa home skill to set up a virtual device "bath water", My th16 is powered from another sonoff called bath pump, reason for this is if the bath heater is to power on while the bath pump is not circulating the spa experience then the heater {which is a modified electric shower} would over heat, When i tell alexa to turn on bath water alexa announces the temp from th16 every 30 seconds and turns on the bath circulation pump, Alexa speaks the variable temp from the bathroom echo only, This all needs tidying up but its not really any use until i can set the aim temp by alexa and leave the flow to automate turning on the heater depending on what aim temp is set and what temp the th16 is returning for the water
[{"id":"dee23e45.11ce5","type":"tab","label":"Flow 2","disabled":false,"info":""},{"id":"a928712a.5e54e","type":"ewelink-temperature","z":"dee23e45.11ce5","name":"","deviceId":"10007c2879","auth":"eb3b6077.50435","x":940,"y":260,"wires":[["e02d7e6e.1649b"]]},{"id":"522b459f.88006c","type":"debug","z":"dee23e45.11ce5","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","statusVal":"","statusType":"auto","x":350,"y":40,"wires":[]},{"id":"a45b36d7.03eca","type":"function","z":"dee23e45.11ce5","name":"","func":"msg.payload = { \"type\": \"speakAtVolume\", \n \"payload\": { \"type\": \"regular\", \n \"text\": \"temperature is \" + msg.payload + \" degrees c\",\n \"volume\": 40, \n \"devices\": \"Bathroom input\" }\n }\nreturn msg;\n","outputs":1,"noerr":0,"initialize":"","finalize":"","x":330,"y":380,"wires":[["741d4d74.a13b54","3e7cad97.cdbbc2"]]},{"id":"741d4d74.a13b54","type":"alexa-remote-routine","z":"dee23e45.11ce5","name":"","account":"149ea61b.2e576a","routineNode":{"type":"custom","payload":{"type":"msg","value":"payload"}},"x":640,"y":380,"wires":[[]]},{"id":"e02d7e6e.1649b","type":"change","z":"dee23e45.11ce5","name":"","rules":[{"t":"set","p":"payload","pt":"msg","to":"payload.temperature","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":340,"y":320,"wires":[["a45b36d7.03eca"]]},{"id":"5652d37b.7c833c","type":"alexa-home","z":"dee23e45.11ce5","conf":"2cd25a0f.b3e5b6","device":"115907","acknoledge":true,"name":"Bath water","topic":"","x":110,"y":160,"wires":[["a0f6ba62.2973c8"]]},{"id":"a0f6ba62.2973c8","type":"switch","z":"dee23e45.11ce5","name":"","property":"payload","propertyType":"msg","rules":[{"t":"true"},{"t":"false"}],"checkall":"false","repair":false,"outputs":2,"x":310,"y":160,"wires":[["522b459f.88006c","a1375a6e.4de788","f46d4d8f.46a56"],["93c9d635.9fe8c8","ddbe3188.122bd","e0375cb1.4298a"]]},{"id":"a1375a6e.4de788","type":"msg-resend","z":"dee23e45.11ce5","interval":"26","intervalUnit":"secs","maximum":"100","bytopic":false,"clone":false,"firstDelayed":false,"addCounters":false,"waitForResend":false,"highRate":true,"outputCountField":"","outputMaxField":"","name":"","x":630,"y":240,"wires":[["a928712a.5e54e"]]},{"id":"93c9d635.9fe8c8","type":"debug","z":"dee23e45.11ce5","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","statusVal":"","statusType":"auto","x":350,"y":80,"wires":[]},{"id":"ddbe3188.122bd","type":"change","z":"dee23e45.11ce5","name":"","rules":[{"t":"set","p":"resend_ignore","pt":"msg","to":"true","tot":"bool"}],"action":"","property":"","from":"","to":"","reg":false,"x":820,"y":160,"wires":[["a1375a6e.4de788"]]},{"id":"f46d4d8f.46a56","type":"alexa-remote-routine","z":"dee23e45.11ce5","name":"","account":"149ea61b.2e576a","routineNode":{"type":"smarthome","payload":{"entity":"25927bde-8baa-441c-aa0e-f4d5eac5199e","action":"turnOn"}},"x":870,"y":60,"wires":[[]]},{"id":"e0375cb1.4298a","type":"alexa-remote-routine","z":"dee23e45.11ce5","name":"","account":"149ea61b.2e576a","routineNode":{"type":"smarthome","payload":{"entity":"25927bde-8baa-441c-aa0e-f4d5eac5199e","action":"turnOff"}},"x":880,"y":120,"wires":[[]]},{"id":"3e7cad97.cdbbc2","type":"debug","z":"dee23e45.11ce5","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","statusVal":"","statusType":"auto","x":470,"y":440,"wires":[]},{"id":"eb3b6077.50435","type":"ewelink-credentials"},{"id":"149ea61b.2e576a","type":"alexa-remote-account","name":"","authMethod":"proxy","proxyOwnIp":"localhost","proxyPort":"3456","cookieFile":"","refreshInterval":"7","alexaServiceHost":"alexa.amazon.co.uk","amazonPage":"amazon.co.uk","acceptLanguage":"en-UK","userAgent":"","useWsMqtt":"on","autoInit":"on"},{"id":"2cd25a0f.b3e5b6","type":"alexa-home-conf","username":"Robmak"}]

Ok with node-red-contrib-amazon-echo or node-red-contrib-virtual-smarthome, you could simply say "alexa set water temp to 25" screen shot below device is set as a dimmer. In screenshot you can see the percentage. i said "set water temp to 30" as well.

Also in node-red-contrib-alexa-remote2, you can use the event listener set to device activity. Then when you say "alexa blah blah", you can see the spoken word in msg.payload.description.summary. You would then have to parse out the temp.