Hello there!
After trying out openHAB for a few days I must say I had no idea what I’ve been missing until now. Realizing that, I’m slowly getting aware about that migrating all my LUA scripts that I had in another HA system will take me more than a few days. It’s quite slow in the beginning since every small step takes like ages. Even a simple IF statement is a challenge now, but I’m sure it will improve.
I’d like to take the opportunity to ask you guys in case you’d like to help me a bit.
In LUA I used to create tables for configuration data as this example:
twilightDevices = {
['Civil Twilight'] = {['enabled'] = true, ['sensorType'] = 'civil_twilight'},
['Nautical Twilight'] = {['enabled'] = true, ['sensorType'] = 'nautical_twilight'},
['Astronomical Twilight'] = {['enabled'] = true, ['sensorType'] = 'astronomical_twilight'}
}
It’s just an example, I’m sure you get my point.
Anyway, then I could easily loop through my table in the following manner:
for dDev, devConfig in pairs(twilightDevices) do
if devConfig.enabled then
-- Do something here
end
end
It’s just a simple key value pair Map. I have actually tried to figure out how to do the same thing in Xtend but I haven’t found much useful examples of this. Maybe you have an idea and like to share how this is best done in Xtend?
Cheers!