Page 3 of 3
Re: Can somebody help me with a function, please?
Posted: Fri Jan 16, 2015 3:12 pm
by Mastiff
Some weird sequencing of messages here, but I have it running now, and I'm expanding to include the conversion into rooms.

Re: Can somebody help me with a function, please?
Posted: Fri Jan 16, 2015 3:17 pm
by Mastiff
Oh, btw I have put the conversion in a startup script, like this:
Code: Select all
eg.globals.Romkonvertering = {43008:"WC", 13312:"Gjesterom", 45056:"Treningsrom"}
And then I call it like this:
Code: Select all
#Find ID for sensor
Sensor = eg.eventString.split(' ')
print (Sensor)
VikingID = int(Sensor[4])
#Room conversion
Rom = eg.globals.Romkonvertering[VikingID]
print (VikingID)
print (Rom)
This gives me the correct results for the rooms that I have put into the table. The rest gives an error, of course. There's no working function for them. But at least I can get the rest of my workday done now without scratching my head and pulling my hair with a tweezer (biker style with shaved head and goatee).

Re: Can somebody help me with a function, please?
Posted: Fri Jan 16, 2015 3:21 pm
by krambriw
Thank God, it's Friday!
Good luck
Just one little final advice; think about that you make the conversion table dead simple to maintain because one day when you (or the future new house owner) changes the batteries in the sensors, they will get a new ID and your script will not work until this has been corrected...
Re: Can somebody help me with a function, please?
Posted: Fri Jan 16, 2015 3:24 pm
by Mastiff
Thanks! ANd exactly! That's why I want to put that in one single table, so it's not necessary to mess with more than one script!
