LogicMachine Forum
Thermostat - Printable Version

+- LogicMachine Forum (https://forum.logicmachine.net)
+-- Forum: LogicMachine eco-system (https://forum.logicmachine.net/forumdisplay.php?fid=1)
+--- Forum: Visu (https://forum.logicmachine.net/forumdisplay.php?fid=24)
+--- Thread: Thermostat (/showthread.php?tid=6273)



Thermostat - Tanish Gill - 26.01.2026

Hello,
I have a problem with a thermostat. I want the circular slider to change color depending on the current mode (heating/cooling), but right now I have to send the status every time.
Is there a solution for this?
Code:
localbus.listen('object', '1/4/8', (value) => {
  const wrap = document.querySelector('.circularslider-fg')
  if (!wrap) return

  wrap.style.setProperty(
    '--visu-widget-active-color',
    value ? 'red' : 'blue'
  )
})



RE: Thermostat - admin - 26.01.2026

See this: https://forum.logicmachine.net/showthread.php?tid=6254&pid=40967#pid40967


RE: Thermostat - Tanish Gill - 26.01.2026

(Yesterday, 08:53)admin Wrote: See this: https://forum.logicmachine.net/showthread.php?tid=6254&pid=40967#pid40967
Hello, I will explain in more detail what is happening.
I have a system with several thermostats. Each thermostat returns its current mode status, and I want each one (using its own return address) to change color depending on whether it is in heating or cooling mode.
I have implemented this using a custom widget, where I change the addresses using the group address replacement function.
There is also another issue: when I reload the page, it does not know whether the status is heating or cooling, so it does not change color until it receives this information again.
Is there any way to solve all this?
Thank you for your help!


RE: Thermostat - admin - 26.01.2026

You need a separate script for each widget. You can't use "document.querySelector('.circularslider-fg')" because it will return only the first matching element at random.


RE: Thermostat - Tanish Gill - 26.01.2026

(Yesterday, 11:32)admin Wrote: You need a separate script for each widget. You can't use "document.querySelector('.circularslider-fg')" because it will return only the first matching element at random.
Could you give me the code for an example thermostat?


RE: Thermostat - admin - 26.01.2026

Wait for the next Visu version. It will be easier to implement it there.