Total Newbie, How do I set my Climate temperature from Alexa

Hi I have added to NodeRed a Amazon Echo Hub and a device called Thermostat.

Alexa has found the device, when I ask Alexa to set Thermostat to 20 this is the message from the Thermostat

on: true
bri: 52
percentage: 20
hue: 0
sat: 254
xy: array[2]
ct: 199
rgb: array[3]
colormode: "ct"
meta: object
payload: "on"
deviceid: "35c1ba2dc3fdf6"
topic: "thermostat"
_msgid: "c66dddf2d193866f"

How do I pass just the Percentage onto my call services node as a Temperature Value?

Sorry for such a simple question, Regards Dave

At its most basic, to do the process you describe you need to wire that node to your call service node.

Look up how to use moustache templates here: Call Service Tips and Tricks | node-red-contrib-home-assistant-websocket (zachowj.github.io)

You need to figure out how to put the value from ‘percentage’ into the data your call services node uses to tell the thermostat to update… That page has everything you need to figure THAT part out.

But the bigger question - If Alexa told the thermo to do 20 and it did it you’re done - But you’re trying to do something else with the number - what are you ACTUALLY trying to do?

While the topic says thermostat, those are attributes from a light. I’d guess a light is misconfigured in mqtt and is sending it’s message on the thermostat topic.

1 Like

Hi many thanks for taking the time to reply,

Yes I believe the Emulated Hue & in NodeRed the Hue Hub don’t know about thermostats they only know about lights, unless you know otherwise and point me in the right direction.

Regards Dave

Yes, the node you are using emulates a Philips Hue bridge so every entity is handled as a light.

I use it to control my thermostat. It is configured to simply call a script. The script confirms the requested temperature (received via percentage) is within a reasonable range before it attempts to set the thermostat’s temperature. This step could have been performed in Node-Red but I chose to have it in a script.

Thanks for the reply, just trying to get the 20 value from the output of the Alexa Node into my call service node.

I have looked at that page but I am none the wiser

I am used to witting code in assembler or C, so sorry, just hasnt clicked with me yet.

Re Dave

I dont have emulated hue but since it’s a light I assume a light service call with brightness data would be the way to set it.

{
    "brightness_pct": 20
}

It may also be just brightness instead of brightness_pct

I have now installed node-red-contrib-actionflows and get my Echo to send temperature readings.

I am nearly there, I have put the code below in a Function Node.

var tt = {payload: msg.payload.targetTemperature}

msg.payload = { data: {  "entity_id": "climate.downstairs_lounge", "temperature": 18 } }

return msg

I can extract the temperature from the Payload in the first line into a variable called tt.

I do I insert that into my send line, in place of the hard coded 18

If I just put tt there I get an error

"Call-service error. expected float for dictionary value @ data['temperature']"

Regards, Dave