Re: How do I create a variable from another variable?
Posted: Sat Jan 17, 2015 8:43 pm
Besides you had some typos, I think you are getting tired
, I did adjust the addresses. I put all into one script for the time and it works here, it actually fires the command in RFXtrx (and I see that captured by the TellStickDuo)
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
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)