Logic Machine Forum
Save data to storage - 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: Save data to storage (/showthread.php?tid=400)



Save data to storage - Domoticatorino - 23.09.2016

Dear All,
I have a small problem. I have a KNX device that does keep in memory its previuos humidity setpoint what power shut down. Hence I would like to write a script in order to save the setpoint in homelynk Schneider and write it when power comes back.

I wrote this on event script on 2/4/51 address:

storage.set ('myobjectdata', '2/4/51')

Then in init script I wrote the following:

mydata = storage.get('myobjectdata')

grp.write ('2/4/51', mydata)


It seems everything works but the value sent on bus is 0% (Umidity). What is wrong?

When I save a data to storage, there is a time after that data is saved? Or the saving is immediate?

Thank you for your help.

HomeLynk firmware version is 1.3.1

Thanks.

Claudio Lauriola


RE: Save data to storage - Erwin van der Zwart - 23.09.2016

Hi Claudio,

You save now the object address as string to the storage and get back '2/4/51' as string
and you send that as value to the address. The object dont understand that so result = nothing (:

use this to save the value correct to the storage: storage.set('myobjectdata', grp.getvalue('2/4/51'))

BR,

Erwin van der Zwart


RE: Save data to storage - admin - 23.09.2016

There's no point in saving it to storage as you can just do grp.getvalue to get the latest value stored in the database, so your init script should look like this:
Code:
value = grp.getvalue('2/4/51')
grp.write ('2/4/51', value)

Database, storage and everything else is saved to the SD card each 30 minutes to prolong its lifespan.


RE: Save data to storage - Domoticatorino - 23.09.2016

Thank you but I can do the following:

Event script: eg 5/2/31

Value = grp.getvalue (5/2/31)
If value ==

Sorry

If value == 1 then
Grp.write (0/0/36 = true)
Else
End.

It does not work. Thanks.


RE: Save data to storage - Erwin van der Zwart - 23.09.2016

True (:

If you need faster time then 30 minutes, maybe you have a spare channel on a dimmer or another device where you can store your value.

Create a new groupaddress to that object and perform a grp.read to that object (somehwere in the field) during init. Make sure the read flag is enable on that object.

BR,

Erwin

Hi,

Don't use capitals in commands, 'If' 'Then' 'Else' 'End' "Grp.write' is not correct, use if, then, else, end, grp.write etc.

You can see it on the color, if a command stays black it's wrong.

Also what do you compare with '== 1' ? A bit object? You must use false and true on boolean values (bit objects)

BR,

Erwin