1) Look at the syntax I have corrected for your definitions (no additional parenthesis needed, that is just creating a tuple and we want a string !!!)
2) The keyword 'eval' is used to execute a string content, this is where it gets fired to the RFXtrx
3) If you split this code into two scripts I'm sure it will work the same
Code: Select all
#####Definitions
#Testrom
eg.globals.Ovnpaa_Testrom = "_AC(u'Anslut 1 p\xe5', u'AC', u'012e77fe', u'1', u'on', u'0', None)"
eg.globals.Ovnav_Testrom = "_AC(u'Anslut 1 av', u'AC', u'012e77fe', u'1', u'off', u'0', None)"
def OvnPaa(var1):
const1 = 'eg.plugins.RFXtrx.send'
#const2 = 'Ovnpaa_'
#const3 = ')'
#ovn = const1+const2+var1+const3
ovn = const1+var1
print(ovn)
eval(ovn)
eg.globals.OvnPaa = OvnPaa #Adding the function to eg.globals
######Calling script
eg.globals.Rom = 'Testrom'
#print (eg.globals.Rom )
if eg.globals.Rom == 'Testrom':
eg.globals.OvnPaa (eg.globals.Ovnpaa_Testrom)