from rts2json import jsonProxy, createJsonServer import socket import xmlrpclib import json import httplib #connect to server createJsonServer('localhost:8889','','') #get temps from devices externalTemp = jsonProxy().getValue('S0','TEMP_AMB') internalTemp = jsonProxy().getValue('S2','DS1') #calc the difference diffTemp = internalTemp - externalTemp #set the fan speed based on rules if diffTemp < 0: jsonProxy().setValue('S2','MFanCon',0) elif diffTemp > 7: jsonProxy().setValue('S2','MFanCon',3) elif diffTemp > 4: jsonProxy().setValue('S2','MFanCon',2) elif diffTemp > 0: jsonProxy().setValue('S2','MFanCon',1)
The rts2json is in the RTS2 repo. Simply connect via a JSON proxy and get and set values of devices. The script is set to a 15 minute cron and adjust fans speeds accordingly.
No comments:
Post a Comment