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.

Restore Settings on Power Up into KNX System
#1
Hi,
I have KNX thermostats that do not retain settings on power up.

I want to be able, upon power up, to restore all selected settings to these thermostats and the rest of the system.
As I understand, LM Objects are retentive. However, upon power up thermostats may resend their statuses on bus and thus stored settings inside LM Objects will be changed.

The KNX power supply is in UPS. However, power outages usually have long duration.

So, to sum up. As a solution I thought of this solution:
Use a conventional ton delay timer powered directly from the net and connect its relay to a KNX input (closed contact -> true and vise versa). Then when power fails on edje down I will receive false with which I will store settings into storage during UPS back up. Then if power outage lasts for enough time as UPS will be shut down on power restore LM will boot and then after let’s say 3 minutes delay I will receive a true that will restore and write everything from storage memory.
Due to complexity of this solution, I would like to ask if this is already solved…

Thanks in advance!
Reply
#2
You can use init script in LM. Add a short delay via os.sleep() and then resend values to the KNX bus: https://forum.logicmachine.net/showthrea...7#pid11677
Reply
#3
(04.03.2024, 11:55)admin Wrote: You can use init script in LM. Add a short delay via os.sleep() and then resend values to the KNX bus: https://forum.logicmachine.net/showthrea...7#pid11677

Thanks admin. I have thought about it but what if thermostats send their new statuses during os.sleep time? Devices will boot together. Similarly, if os.sleep time is set to zero how to ensure that no telegrams from both parts co-exist at the same time on the bus?
Reply
#4
Can you disable sending thermostat status on power up?

If not then you can use your monitoring solution via KNX input. Not an ideal solution but should work in most cases.

When power is ON (event value = true), the storage is cleared but only if LM has been running for at least 3 minutes.
When power is OFF (event value = false), all object values with thermostat tag are saved into storage.

Event script:
Code:
value = event.getvalue()
tag = 'thermostat'

if value then
  uptime = os.monotonictime()

  if uptime > 3 * 60 then
    storage.delete(tag)
  end
else
  values = {}
  objects = grp.tag(tag)

  for _, object in ipairs(objects) do
    values[ object.address ] = object.value
  end

  storage.set(tag, values)
end

Init script, adjust delay as needed.
Code:
os.sleep(30)

tag = 'thermostat'
values = storage.get(tag)

if values then
  for address, value in pairs(values) do
    grp.write(address, value)
    os.sleep(0.1)
  end

  storage.delete(tag)
end
Reply
#5
(04.03.2024, 15:02)admin Wrote: Can you disable sending thermostat status on power up?

If not then you can use your monitoring solution via KNX input. Not an ideal solution but should work in most cases.

When power is ON (event value = true), the storage is cleared but only if LM has been running for at least 3 minutes.
When power is OFF (event value = false), all object values with thermostat tag are saved into storage.

Event script:
Code:
value = event.getvalue()
tag = 'thermostat'

if value then
  uptime = os.monotonictime()

  if uptime > 3 * 60 then
    storage.delete(tag)
  end
else
  values = {}
  objects = grp.tag(tag)

  for _, object in ipairs(objects) do
    values[ object.address ] = object.value
  end

  storage.set(tag, values)
end

Init script, adjust delay as needed.
Code:
os.sleep(30)

tag = 'thermostat'
values = storage.get(tag)

if values then
  for address, value in pairs(values) do
    grp.write(address, value)
    os.sleep(0.1)
  end

  storage.delete(tag)
end

This is a really old installation (and hardware) we are involved in and there isn't really much we can do.

Thanks for the help and code admin.
Reply
#6
I just realize that TON timer could be omitted - if you agree - as the delay it inserts, is just to clear storage memory if power up is made before UPS shutdown.

Code:
value = event.getvalue()
tag = 'thermostat'

if value then   
   uptime = os.monotonictime()  
 
   if uptime > 3 * 60 then     
      storage.delete(tag)  
    end
else  
...

So, instead of the TON Timer, we can use a simple contact like "On-Off Switch" or similar (MCB, etc.) that will be always electrically closed. I mean that we are concerned only about the edge down part of the monitored input. Thus, "value == true" part of code needs to be removed.

In my opinion clearing the storage memory in this part of code is not important as it will be overwritten when needed...
Reply
#7
You can simply use a 230V relay connected to a KNX binary input to monitor external power. Clearing storage is needed. Otherwise if LM is rebooted for any other reason than UPS power loss then old thermostat values will be restored.
Reply
#8
(05.03.2024, 06:10)admin Wrote: You can simply use a 230V relay connected to a KNX binary input to monitor external power. Clearing storage is needed. Otherwise if LM is rebooted for any other reason than UPS power loss then old thermostat values will be restored.
Reboot "for other reason" scenario never crossed my mind. However using the simple relay, that is, without introducing time delay for value true will ignore event script in case BA2.2 (see attachment).

So, in order to use a simple relay contact we could either resend digital input value cyclically in the bus or use a flag to store that power failure actually happened, every time power gets cut. This flag will be checked (if true) in the start-up script in order to resend values and then it will be (always) reset.



.pdf   POWER UP DIAGRAM.pdf (Size: 80.34 KB / Downloads: 17)
Reply


Forum Jump: