Retrieve thermostat setpoint in a scene trigger

Hello,
I don’t quite see how to pass the setpoint of the "Gladys

I don’t know if this can solve the problem, but to retrieve a value it’s with {{

Thanks @tiboys for the answer.

If I have a thermostat that is referenced in gladys:
image
the syntax is correct: {{ Thermostat maison }}

I don’t know if I’m talking nonsense but it seems to me that to use the {{ , you first need the action « retrieve the latest state »…\n\nAnd so it can’t do it on a trigger!

I tested it and honestly it seems complicated, actually I couldn’t do it.

So we have to create a scene to retrieve the sensor’s last state and then, we have access to the value in another scene. But then what’s the name of the value?

EDIT : I think I pretty much found my question here : Utiliser la fonctionnalité d'un device comme valeur dans "Continuer seulement si" et "Changement d'état" - #4 par guim31

Hi @Fabic :slight_smile: I’ve moved the topic to a new thread.

It’s not possible to retrieve a value from a scene trigger.

What would you use it for? Maybe it can be done another way

Hello @pierre-gilles,

I thought I could implement the « room thermostat » function with Gladys, that is to turn an appliance off or on based on the temperature and the thermostat setpoint.

For that, in my view the simplest solution was to « trigger » a scene in this way:
If variable temperature is less than the value of setpoint then action (with handling of hysteresis by a condition)

After reading the documentation you can do it like @b3n.0 in this post Utiliser la fonctionnalité d'un device comme valeur dans "Continuer seulement si" et "Changement d'état" - #6 par Tlse-vins but with a time-based trigger (which is less clean).

Maybe the easiest for now is to go through Node-RED via MQTT?

Otherwise, what’s stopping you from doing this:

You put an arbitrary condition in the trigger.

Here I put WHEN « temperature » is less than 120°C, which will always be true (unless you live in an oven)

And then you put your logic, and it will always be executed

@pierre-gilles , I think he wants to compare the room temperature to the setpoint temperature.
But the setpoint is not just a value that you set in your scene but the value of the thermostat object that you developed.

Yes, that’s right

Indeed, it should work by adding a « retrieve the last state » of the setpoint and then injecting it as a value

Yes, but precisely that’s not supported right now!

With @b3n.0’s trick it will work though: Utiliser la fonctionnalité d'un device comme valeur dans "Continuer seulement si" et "Changement d'état" - #7 par b3n.0

Well, in the end I ended up with a Node-RED connected to Gladys via MQTT and it works really well. As a bonus, a modification of the setpoint at night if it’s a Tempo red day:

[{"id":"7be11ef3ccc79547","type":"tab","label":"Regul chauffage","disabled":false,"info":"","env":[]},{"id":"00c5cce50b84dd0b","type":"change","z":"7be11ef3ccc79547","name":"","rules":[{"t":"set","p":"vartemp","pt":"global","to":"payload.AM2301.Temperature","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":430,"y":380,"wires":[["5dcfdfd8a863da79"]]},{"id":"5a697c78a69d9724","type":"change","z":"7be11ef3ccc79547","name":"","rules":[{"t":"set","p":"varconsigne","pt":"global","to":"payload","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":440,"y":460,"wires":[["5dcfdfd8a863da79"]]},{"id":"5dcfdfd8a863da79","type":"change","z":"7be11ef3ccc79547","name":"","rules":[{"t":"set","p":"payload","pt":"msg","to":"$globalContext(\"vartemp\")-$globalContext(\"varconsigne\")","tot":"jsonata"},{"t":"set","p":"topic","pt":"msg","to":"","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":760,"y":400,"wires":[["69b4ef9e8f01c17c"]]},{"id":"59a48089d39711d8","type":"inject","z":"7be11ef3ccc79547","name":"temp","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"22","payloadType":"num","x":150,"y":380,"wires":[["00c5cce50b84dd0b"]]},{"id":"ccaab92a746fe040","type":"inject","z":"7be11ef3ccc79547","name":"consigne","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"21","payloadType":"num","x":160,"y":540,"wires":[["5a697c78a69d9724"]]},{"id":"69b4ef9e8f01c17c","type":"switch","z":"7be11ef3ccc79547","name":"hysteresis","property":"payload","propertyType":"msg","rules":[{"t":"lt","v":"0","vt":"num"},{"t":"gt","v":"0.3","vt":"num"}],"checkall":"true","repair":false,"outputs":2,"x":990,"y":400,"wires":[["dc951c01368595ce"],["5bc434c29dca52c2"]]},{"id":"ea617ed9c13c0a8d","type":"debug","z":"7be11ef3ccc79547","name":"debug 15","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","statusVal":"","statusType":"auto","x":1460,"y":320,"wires":[]},{"id":"6739c40be43d3488","type":"mqtt in","z":"7be11ef3ccc79547","name":"consigne","topic":"topic gladys thermostat","qos":"2","datatype":"auto-detect","broker":"ca0557c2.d52418","nl":false,"rap":true,"rh":0,"inputs":0,"x":140,"y":480,"wires":[["083fe666d0024601","5a697c78a69d9724"]]},{"id":"ace5a1d0a89dff2d","type":"mqtt out","z":"7be11ef3ccc79547","name":"","topic":"topic gladys chauffage","qos":"0","retain":"false","respTopic":"","contentType":"","userProps":"","correl":"","expiry":"","broker":"ca0557c2.d52418","x":1500,"y":380,wires":[]},{"id":"dc951c01368595ce","type":"change","z":"7be11ef3ccc79547","name":"","rules":[{"t":"set","p":"payload","pt":"msg","to":"1","tot":"num"}],"action":"","property":"","from":"","to":"","reg":false,"x":1200,"y":340,"wires":[["ace5a1d0a89dff2d","ea617ed9c13c0a8d"]]},{"id":"5bc434c29dca52c2","type":"change","z":"7be11ef3ccc79547","name":"","rules":[{"t":"set","p":"payload","pt":"msg","to":"0","tot":"num"}],"action":"","property":"","from":"","to":"","reg":false,"x":1200,"y":440,"wires":[["ace5a1d0a89dff2d","ea617ed9c13c0a8d"]]},{"id":"083fe666d0024601","type":"debug","z":"7be11ef3ccc79547","name":"debug 16","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","statusVal":"","statusType":"auto","x":400,"y":320,"wires":[]},{"id":"0c8130f2f9645336","type":"mqtt in","z":"7be11ef3ccc79547","name":"temp","topic":"capteur température","qos":"0","datatype":"auto-detect","broker":"ca0557c2.d52418","nl":false,"rap":true,"rh":0,"inputs":0,"x":130,"y":320,"wires":[["00c5cce50b84dd0b","083fe666d0024601"]]},{"id":"b693e20d6c67348b","type":"comment","z":"7be11ef3ccc79547","name":"Relais on/off si température\u003cconsigne","info":"","x":170,"y":260,"wires":[]},{"id":"00142a0f421ec69e","type":"comment","z":"7be11ef3ccc79547","name":"Consigne spéciale nuit jour rouge","info":"","x":150,"y":620,"wires":[]},{"id":"366c8f9d1d101463","type":"cronplus","z":"7be11ef3ccc79547","name":"22h","outputField":"payload","timeZone":"","persistDynamic":false,"commandResponseMsgOutput":"output1","outputs":1,"options":[{"name":"schedule1","topic":"topic1","payloadType":"default","payload":"","expressionType":"cron","expression":"0 0 22 * * * *","location":"","offset":"0","solarType":"all","solarEvents":"sunrise,sunset"}],"x":120,"y":680,"wires":[["4b22112740b52e12"]]},{"id":"99ea54f88f5d8c41","type":"debug","z":"7be11ef3ccc79547","name":"debug 18","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","statusVal":"","statusType":"auto","x":1140,"y":660,"wires":[]},{"id":"4b22112740b52e12","type":"change","z":"7be11ef3ccc79547","name":"couleur du jour","rules":[{"t":"set","p":"payload","pt":"msg","to":"couleurjour","tot":"global"}],"action":"","property":"","from":"","to":"","reg":false,"x":450,"y":720,"wires":[["1bd1509583558337","99ea54f88f5d8c41"]]},{"id":"1bd1509583558337","type":"switch","z":"7be11ef3ccc79547","name":"si jour rouge","property":"payload","propertyType":"msg","rules":[{"t":"eq","v":"RED","vt":"str"},{"t":"neq","v":"RED","vt":"str"}],"checkall":"true","repair":false,"outputs":2,"x":720,"y":720,"wires":[["99ea54f88f5d8c41","c8e04a4de0c117e3"],["8fa24f5c0fb9d604"]]},{"id":"da765ecac0e3f39e","type":"mqtt out","z":"7be11ef3ccc79547","name":"vers consigne gladys","topic":"topic gladys consigne","qos":"","retain":"","respTopic":"","contentType":"","userProps":"","correl":"","expiry":"","broker":"f3b05caa30697468","x":1180,"y":780,"wires":[]},{"id":"c8e04a4de0c117e3","type":"change","z":"7be11ef3ccc79547","name":"consigne 22°C","rules":[{"t":"set","p":"payload","pt":"msg","to":"22","tot":"num"}],"action":"","property":"","from":"","to":"","reg":false,"x":930,"y":720,"wires":[["da765ecac0e3f39e","99ea54f88f5d8c41","5a697c78a69d9724"]]},{"id":"4251162afaa2fe75","type":"inject","z":"7be11ef3ccc79547","name":"Manuel","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"","payloadType":"date","x":110,"y":740,"wires":[["4b22112740b52e12"]]},{"id":"380a3b67ae3b4754","type":"cronplus","z":"7be11ef3ccc79547","name":"6h","outputField":"payload","timeZone":"","persistDynamic":false,"commandResponseMsgOutput":"output1","outputs":1,"options":[{"name":"schedule1","topic":"topic1","payloadType":"default","payload":"","expressionType":"cron","expression":"0 0 6 * * * *","location":"","offset":"0","solarType":"all","solarEvents":"sunrise,sunset"}],"x":150,"y":820,"wires":[["8fa24f5c0fb9d604"]]},{"id":"8fa24f5c0fb9d604","type":"change","z":"7be11ef3ccc79547","name":"consigne 19°C à partir de 6h","rules":[{"t":"set","p":"payload","pt":"msg","to":"19","tot":"num"}],"action":"","property":"","from":"","to":"","reg":false,"x":920,"y":860,"wires":[["da765ecac0e3f39e","5a697c78a69d9724","99ea54f88f5d8c41"]]},{"id":"0d42db205ff2380f","type":"inject","z":"7be11ef3ccc79547","name":"Manuel","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"","payloadType":"date","x":150,"y":880,"wires":[["8fa24f5c0fb9d604"]]},{"id":"ca0557c2.d52418","type":"mqtt-broker","name":"","broker":"localhost","port":"1883","clientid":"","autoConnect":true,"usetls":false,"protocolVersion":"4","keepalive":"60","cleansession":true,"birthTopic":"","birthQos":"0","birthPayload":"","birthMsg":{},"closeTopic":"","closePayload":"","closeMsg":{},"willTopic":"","willQos":"0","willPayload":"","willMsg":{},"userProps":"","sessionExpiry":""},{"id":"f3b05caa30697468","type":"mqtt-broker","name":"","broker":"192.168.1.124","port":"1883","clientid":"","autoConnect":true,"usetls":false,"protocolVersion":"4","keepalive":"60","cleansession":true,"birthTopic":"","birthQos":"0","birthPayload":"","birthMsg":{},"closeTopic":"","closeQos":"0","closePayload":"","closeMsg":{},"willTopic":"","willQos":"0","willPayload":"","willMsg":{},"userProps":"","sessionExpiry":""}]

Completely different topic: in Gladys the device « clic bouton » over MQTT doesn’t work on my instance. Is that normal?

Good evening,
I already use Gladys for my heating and finally looked into the « new » Thermostat developed by @pierre-gilles a few months ago.
To make it useful, I need to be able to choose a value with this thermostat, add one degree for the high setpoint and subtract one degree for the low setpoint (e.g. if I choose 20°C, the heating turns on at 19°C and turns off at 21°C).
So I make a scene in which I retrieve the thermostat value, send the operation via mathjs and then…
Mathjs doesn’t accept my ‹ Thermostat › variable even though it works with numbers and then…
I don’t know how to choose the result in « control a device » towards a dummy MQTT device.
Does what I’m trying to do match the problem mentioned above? Is it not supported? How off-base am I?
Edit: I saw here that @bertrandda had worked on the topic — is it better that I shelve my project and wait?

Are you testing by executing the global scene, and not by clicking the « Try » button on the HTTP request? The Try button does not send variables because it only executes that part of the scene

Indeed, at the moment this is not possible. I don’t know where @bertrandda stands on the subject, and I don’t think it’s in active development, so if you want to take the topic up, you can! :smiley:

I had something working; I just needed to write the tests. I’m trying to push the code quickly to see if it works for you.

Yes, and the error message is: ‹ Error: Syntax error in part \u0026quot; + 1\u0026quot; (char 10) ›.
My scene block looks like this :


If I put ‹ 20 › instead of the variable, it works…
As such, it’s not a big deal since the math functions will be integrated, but I’d like to know what I’m doing wrong…

[quote=« pierre-gilles, post:14, topic:8071 »]
if you want

@GBoulvin I tested it at home by creating this scene:

I start the scene and in my messages:

![Screenshot 2023-04-18 at 09.46.36|690x391](upload://rjvBeHtbYJGMrr9WIoovb4Fqz33

For your information