I am migrating my heavy lambda based DSL light control rules.
Done 90% so far.
Currently, I have some generic definitions done by JSON data inside modules disjoined from Item definitions. I would like to move the data to items file as metadata of the particular items.
I was looking and trying for 2-3h with no luck. The documentation gave me some hints, though I was not able to read any valuable data back from metadata.
My JSON test data looks as follows:
LIGHT_SETTINGS= '''
{
"testGU10L":
{
"ONOF" : 1,
"MIDI" : 7,
"ALLD" : 1,
"ILUT" : 50,
"ITLI" : "testGU10L",
"ITIL" : "iluminationTest",
"ITMO" : "motionTest"
},
"testGU10M":
{
"ONOF" : 0,
"MIDI" : 7,
"ITLI" : "testGU10M",
"ITIL" : "iluminationTest",
"ITMO" : "motionTest"
}
}
'''
LIGHT_TRIGGERS='''
{
"testGU10L":
{
"TOG" : [
["CET", "deconz:switch:d6dfbf93:ccccccfffe51c077011000:buttoneven", "2002", ""],
],
"DIM" : [
["CET", "deconz:switch:d6dfbf93:ccccccfffe51c077011000:buttoneven", "2001", ""],
],
"MOV" : [
["ITC", "motionTest", "OFF", "ON"],
]
},
"testGU10M":
{
"TOG" : [
["CET", "deconz:switch:d6dfbf93:ccccccfffe51c077011000:buttoneven", "1002", ""]
],
"DIM" : [
["CET", "deconz:switch:d6dfbf93:ccccccfffe51c077011000:buttoneven", "1001", ""]
],
"MOV" : [
["ITC", "motionTest", "OFF", "ON"]
]
}
}
'''
this should be attached to following test items:
Dimmer testGU10L "Test Lamp L [%d %%]" { channel="hue:0100:00212E00C488:6:brightness" }
Dimmer testGU10M "Test Lamp M [%d %%]" { channel="hue:0100:00212E00C488:2:brightness" }
some basic questions:
- Does it make sense to have such huge data as meta data attached to items?
- Is it feasible?
- and at last, is it readable when put in the items file?
I started with a simple meaningless example:
Dimmer testGU10L "Test Lamp L [%d %%]" { channel="hue:0100:00212E00C488:6:brightness" , alexa="Fan" [ type="oscillating", speedSteps=3 ] }
tried:
core.metadata.get_all_namespaces("testGU10L")
which delivers 2 namespaces:
[u'channel', u'alexa']
what now?
core.metadata.get_value("testGU10L", "alexa")
delivers:
Fan
and then
core.metadata.get_key_value("testGU10L", "alexa", "Fan")
gives me:
{}
tried all possible combination getting always {}