Controll thermostat and bulb color using alexa by virtual smart home

Hello automation friends :slight_smile:,

Iam a bloody beginner using node red and want to automate some stuff. Mainly I want to use it for voice assistant alexa.

So I already configured the simple on and off for bulbs, climate and so on, but I dont can configure the light changing ones or set a temperature for the thermostat.

Just a small screenshot from my config:

image

image

image

I would be really happy, if someone can tell me, how I can configure this for temperature changing and colors / brightness for my lights.

Thank you
Br
Schmandre

Not all thermostat’s accept on/off. You may need to set the mode to heat, cool or off.

Service climate.turn_on

Turn climate device on. This is only supported if the climate device supports being turned off.

Thank you for your hint.

So my thermostat can do on/off. But the question was, how can I advise to set temperature to 20°C, or how can I activate a light and also can set brightness to maybe 50%?

call service

another call service

1 Like

Yes, that was what I figured out in the time till today. Thanks :wink: My “problem” is, how to get the value for example “20°C” from voice command, translatet to the call service enttiy.

So if I say “Set temperature at living room to 20°C” how will the “20°C” extracted so that I can use.

You’ll need to set up conversation to create voice triggers.

As mentioned in the title, I use VHS ( node-red-contrib-virtual-smart-home (node) - Node-RED (nodered.org))

This is working for me. I already can trigger on / off, but the mentioned settings like temperature and brightness doesnt work

Connect the virtual smart home node to a debug. Set the debug drop down to complete message object, then deploy. Tell alexa to set the thermostat to 20. Copy the message that alexa sends and post it here.

Yes. For sure. Thank you for your help.

Climate 20°C

20.2.2024, 17:54:25node: debug 1
msg.payload : Object
object
temperature: 0
scale: "CELSIUS"
targetTemperature: 20
targetScale: "CELSIUS"
thermostatMode: "OFF"
powerState: "ON"
source: "alexa"
directive: "SetTargetTemperature"
name: "Ankleidezimmer Heizung"
type: "THERMOSTAT"

Light 20%

20.2.2024, 17:53:42node: debug 2
msg.payload : Object
object
powerState: "ON"
brightness: 20
source: "alexa"
directive: "SetBrightness"
name: "Ankleidezimmer Decke"
type: "DIMMABLE_LIGHT_BULB"
rawDirective: object

You’ll need to use a switch to filter the message.

image

First we would look at payload.directive

image

If you look the path is entered in the property box. payload.directive

When the message matches (SetTargetTemperature) it will come out of the top of the node. (SetBrightness) from the bottom.

You can add filters by pressing the add button. It will create another output where that message will come from.

image
image

After the switch connect to a call service.

In the data for thermostat use {{payload.targetTemperature}}
For brightness you would use {{payload.brightness}}

image

Make sure the data field is set to JSON

1 Like

I think we are on a good way. The data path just need a small change, I cant figure out atm.

So that is the error message

msg : error
"HomeAssistantError: must contain at least one of temperature, target_temp_high, target_temp_low."

How should the string be build?

//EDIT

Thinks got working… The data block must look like

{    "temperature": {{payload.targetTemperature}}}

I´ll test the rest and come back if necessary.

Thank you for your help :slight_smile: