I am configuring an OpenHasp Plate as a thermostat similar to the example given in Openhasp:
But I would like to be able to manage the thermostatic valves of 9 rooms with this plate. I could of course repeat the whole logic 9 times, each on a different page of the plate, but that would make the yaml file in Homeassistant very long and a nightmare to maintain. So I had the idea to create a variable and 9 buttons. The buttons (button matrix in OpenHasp) would set the variable according to the selected button, and the thermostat logic would then use this variable to access the correct thermostatic valve and adjust it accordingly, something like the image below:
I just had a look at the documentation, it’s pretty good on how to set and update the variables but there’s not much on how to use them, but from this:
Seeing the link you mention in your reply, we might be talking about something different. In HACS there are 2 integrations that can be used to create variables. One is called Variables (the one by snarky-snark) and the other is called variables+history by wibias/rogro82
For no specific reason (I didn’t study their differences very much) I decided to use the latter one.
I also just realised that my code examples have an error: the working examples use quotes which I did not show in my previous post:
{% if state_attr(states('variable.thermroom'),"temperature") is not none %}
{{ state_attr(states('variable.thermroom'),"temperature") | int * 10 }}
That said, of the 4 choices you mention, only the first one works.
After that, I also tried out the service call to climate.set_temperature in the developer tools services editor and your first suggestion
is the one that works. By using the “variables” integration from HACS, defining a variable this way:
variable:
thermroom:
value: 'climate.trv_room1'
creates an entity “variable.thermroom” whose state is “climate.trv_room1”
Thanks for the help… this was one step forward in my intent of having a multi-thermostat screen on an openHasp plate. Next step is choosing which valve’s values are displayed on the thermostat gauge depending on which button in the button-matrix has been pressed.
I will open another topic because I am struggling with the yaml/jinja2 combination which is rather new to me and I don’t succeed to grasp its rather weird (at least to me) indentation and spacing rules…