Logic Machine Forum
Polling status - Printable Version

+- Logic Machine Forum (https://forum.logicmachine.net)
+-- Forum: LogicMachine eco-system (https://forum.logicmachine.net/forumdisplay.php?fid=1)
+--- Forum: Scripting (https://forum.logicmachine.net/forumdisplay.php?fid=8)
+--- Thread: Polling status (/showthread.php?tid=153)



Polling status - FatMax - 02.12.2015

I´m scratching my head a bit concerning what to do if there is a fire alarm. Obviously, it´s fairly easy to turn off things that need to be turned off.

My concern regards lights. Is there a way, in a script, to poll every lights current status and save that state if the group address for the firearm goes true? 

The scenario would be this:

Fire alarm goes off. Every appliance turns off and all lights go to 100%. 3 minutes after the fire alarm has been reset, the lights go back to the state they were in before the fire alarm went off.

I´m not even sure if this is what people do when it comes to KNX and fire alarms...


RE: Polling status - gjniewenhuijse - 03.12.2015

(02.12.2015, 22:45)FatMax Wrote: I´m scratching my head a bit concerning what to do if there is a fire alarm. Obviously, it´s fairly easy to turn off things that need to be turned off.

My concern regards lights. Is there a way, in a script, to poll every lights current status and save that state if the group address for the firearm goes true? 

The scenario would be this:

Fire alarm goes off. Every appliance turns off and all lights go to 100%. 3 minutes after the fire alarm has been reset, the lights go back to the state they were in before the fire alarm went off.

I´m not even sure if this is what people do when it comes to KNX and fire alarms...

what we do:
- connect all devices to a scene
- when firealarm on: save scene - turn lights on / blinds up
- when firealarm off: call scene


RE: Polling status - FatMax - 04.12.2015

(03.12.2015, 09:03)gjniewenhuijse Wrote:
(02.12.2015, 22:45)FatMax Wrote: I´m scratching my head a bit concerning what to do if there is a fire alarm. Obviously, it´s fairly easy to turn off things that need to be turned off.

My concern regards lights. Is there a way, in a script, to poll every lights current status and save that state if the group address for the firearm goes true? 

The scenario would be this:

Fire alarm goes off. Every appliance turns off and all lights go to 100%. 3 minutes after the fire alarm has been reset, the lights go back to the state they were in before the fire alarm went off.

I´m not even sure if this is what people do when it comes to KNX and fire alarms...

what we do:
- connect all devices to a scene
- when firealarm on: save scene - turn lights on / blinds up
- when firealarm off: call scene

Thanks for the tip! Haven't worked too much with scenes yet. What you are saying is that you can save scenes on the fly with KNX, and not have to pre-program these in ETS?


RE: Polling status - gjniewenhuijse - 04.12.2015

(04.12.2015, 05:55)FatMax Wrote:
(03.12.2015, 09:03)gjniewenhuijse Wrote:
(02.12.2015, 22:45)FatMax Wrote: I´m scratching my head a bit concerning what to do if there is a fire alarm. Obviously, it´s fairly easy to turn off things that need to be turned off.

My concern regards lights. Is there a way, in a script, to poll every lights current status and save that state if the group address for the firearm goes true? 

The scenario would be this:

Fire alarm goes off. Every appliance turns off and all lights go to 100%. 3 minutes after the fire alarm has been reset, the lights go back to the state they were in before the fire alarm went off.

I´m not even sure if this is what people do when it comes to KNX and fire alarms...

what we do:
- connect all devices to a scene
- when firealarm on: save scene - turn lights on / blinds up
- when firealarm off: call scene

Thanks for the tip! Haven't worked too much with scenes yet. What you are saying is that you can save scenes on the fly with KNX, and not have to pre-program these in ETS?

Yes thats possible, send 0..127 for calling scene 1..128 and send 128..255 to save scene 1..128. If you use scene 1 you can use to send 0 and 128.


RE: Polling status - admin - 04.12.2015

Or you can make a script to save/recall values of all objects mapped to a certain tag. Map this script to a binary object, where ON saves tagged object values and OFF recalls saved values.
Code:
value = event.getvalue()

-- save states
if value then
  objects = grp.tag('my_object_tag')
  store = {}

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

  storage.set('my_objects', store)
-- restore states
else
  store = storage.get('my_objects', {})

  for addr, value in pairs(store) do
    grp.write(addr, value)
  end
end



RE: Polling status - FatMax - 04.12.2015

Excellent inputs! Thank you so much guys :-)


RE: Polling status - TranVanHieu - 30.08.2023

(04.12.2015, 07:26)admin Wrote: Or you can make a script to save/recall values of all objects mapped to a certain tag. Map this script to a binary object, where ON saves tagged object values and OFF recalls saved values.
Code:
value = event.getvalue()

-- save states
if value then
  objects = grp.tag('my_object_tag')
  store = {}

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

  storage.set('my_objects', store)
-- restore states
else
  store = storage.get('my_objects', {})

  for addr, value in pairs(store) do
    grp.write(addr, value)
  end
end
Sorry, Can you tell me more about the above code? I don't understand how to apply it yet.

Thanks!


RE: Polling status - admin - 30.08.2023

This script is obsolete. Scenes should be used instead. Current values for a given scene can be saved from a script: https://openrb.com/docs/lua.htm#scene.savelive


RE: Polling status - TranVanHieu - 30.08.2023

(30.08.2023, 07:58)admin Wrote: This script is obsolete. Scenes should be used instead. Current values for a given scene can be saved from a script: https://openrb.com/docs/lua.htm#scene.savelive

Sorry, I don't know much about Lua. Can you give me an example?
Thank!


RE: Polling status - admin - 30.08.2023

Create a scene named Test scene and add objects that you want to control with it.
Then create a 1-bit object an map event script to it. When writing ON (true) it will save current object values that are assigned to this scene. When writing OFF (false) it will run the scene.

Code:
value = event.getvalue()
name = 'Test scene'

if value then
  scene.savelive(name)
else
  scene.run(name)
end



RE: Polling status - TranVanHieu - 30.08.2023

(30.08.2023, 09:22)admin Wrote: Create a scene named Test scene and add objects that you want to control with it.
Then create a 1-bit object an map event script to it. When writing ON (true) it will save current object values that are assigned to this scene. When writing OFF (false) it will run the scene.

Code:
value = event.getvalue()
name = 'Test scene'

if value then
  scene.savelive(name)
else
  scene.run(name)
end

Yes, I will try following your instructions!

Thank!