This forum uses cookies
This forum makes use of cookies to store your login information if you are registered, and your last visit if you are not. Cookies are small text documents stored on your computer; the cookies set by this forum can only be used on this website and pose no security risk. Cookies on this forum also track the specific topics you have read and when you last read them. Please confirm that you accept these cookies being set.

Thermostat
#1
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'
  )
})
Reply
#2
See this: https://forum.logicmachine.net/showthrea...7#pid40967
Reply
#3
(Yesterday, 08:53)admin Wrote: See this: https://forum.logicmachine.net/showthrea...7#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!
Reply
#4
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.
Reply
#5
(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?
Reply
#6
Wait for the next Visu version. It will be easier to implement it there.
Reply


Forum Jump: