Advertisement
Guest User

multilua

a guest
Jul 28th, 2018
133
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 5.43 KB | None | 0 0
  1. 1:
  2.  
  3. commandArray = {}
  4.  
  5. local aircoValueModeSK = io.popen('/home/pi/airco.sh 192.168.0.60 get mode') -- runs command
  6. local aircoValueModeSKval = aircoValueModeSK:read("*a") -- read output of command
  7. local aircoValueModeSKval2 = tonumber(aircoValueModeSKval)
  8. if aircoValueModeSKval2 == 4 then
  9. commandArray['UpdateDevice'] = "738|0|10"
  10. elseif aircoValueModeSKval2 == 3 then
  11. commandArray['UpdateDevice'] = "738|0|50"
  12. elseif aircoValueModeSKval2 == 2 then
  13. commandArray['UpdateDevice'] = "738|0|40"
  14. elseif aircoValueModeSKval2 == 1 then
  15. commandArray['UpdateDevice'] = "738|0|20"
  16. elseif aircoValueModeSKval2 == 0 then
  17. commandArray['UpdateDevice'] = "738|0|30"
  18. end
  19.  
  20. return commandArray
  21.  
  22. 2:
  23.  
  24. commandArray = {}
  25.  
  26. local aircoValueModeZK = io.popen('/home/pi/airco.sh 192.168.0.61 get mode') -- runs command
  27. local aircoValueModeZKval = aircoValueModeZK:read("*a") -- read output of command
  28. local aircoValueModeZKval2 = tonumber(aircoValueModeZKval)
  29. if aircoValueModeZKval2 == 4 then
  30. commandArray['UpdateDevice'] = "741|0|50"
  31. elseif aircoValueModeZKval2 == 3 then
  32. commandArray['UpdateDevice'] = "741|0|40"
  33. elseif aircoValueModeZKval2 == 2 then
  34. commandArray['UpdateDevice'] = "741|0|30"
  35. elseif aircoValueModeZKval2 == 1 then
  36. commandArray['UpdateDevice'] = "741|0|20"
  37. elseif aircoValueModeZKval2 == 0 then
  38. commandArray['UpdateDevice'] = "741|0|10"
  39. end
  40.  
  41. return commandArray
  42.  
  43. 3:
  44.  
  45. commandArray = {}
  46.  
  47. local f = assert(io.popen('/home/pi/airco.sh 192.168.0.60 get power', 'r'))
  48. local aircoValuePowerSK = assert(f:read('*a'))
  49. f:close()
  50. os.execute('curl "http://192.168.0.126:8080/json.htm?type=command&param=udevice&idx=716&nvalue=1&svalue=" .. aircoValuePowerSK')
  51.  
  52. return commandArray
  53.  
  54. 4:
  55.  
  56. commandArray = {}
  57.  
  58. local f = assert(io.popen('/home/pi/airco.sh 192.168.0.61 get power', 'r'))
  59. local aircoValuePowerZK = assert(f:read('*a'))
  60. f:close()
  61. os.execute('curl "http://192.168.0.126:8080/json.htm?type=command&param=udevice&idx=715&nvalue=1&svalue=" .. aircoValuePowerZK')
  62.  
  63. return commandArray
  64.  
  65. 5:
  66.  
  67. commandArray = {}
  68.  
  69. local aircoValueSetpointSK = io.popen('/home/pi/airco.sh 192.168.0.60 get setpoint') -- runs command
  70. local aircoValueSetpointSKval = aircoValueSetpointSK:read("*a") -- read output of command
  71. local aircoValueSetpointSKval2 = tonumber(aircoValueSetpointSKval)
  72. if aircoValueSetpointSKval2 == 250 then
  73. commandArray['UpdateDevice'] = "747|0|60"
  74. elseif aircoValueSetpointSKval2 == 240 then
  75. commandArray['UpdateDevice'] = "747|0|50"
  76. elseif aircoValueSetpointSKval2 == 230 then
  77. commandArray['UpdateDevice'] = "747|0|40"
  78. elseif aircoValueSetpointSKval2 == 220 then
  79. commandArray['UpdateDevice'] = "747|0|30"
  80. elseif aircoValueSetpointSKval2 == 210 then
  81. commandArray['UpdateDevice'] = "747|0|20"
  82. elseif aircoValueSetpointSKval2 == 200 then
  83. commandArray['UpdateDevice'] = "747|0|10"
  84. end
  85.  
  86. return commandArray
  87.  
  88. 6:
  89.  
  90. commandArray = {}
  91.  
  92. local aircoValueSetpointZK = io.popen('/home/pi/airco.sh 192.168.0.61 get setpoint') -- runs command
  93. local aircoValueSetpointZKval = aircoValueSetpointZK:read("*a") -- read output of command
  94. local aircoValueSetpointZKval2 = tonumber(aircoValueSetpointZKval)
  95. if aircoValueSetpointZKval2 == 250 then
  96. commandArray['UpdateDevice'] = "746|0|60"
  97. elseif aircoValueSetpointZKval2 == 240 then
  98. commandArray['UpdateDevice'] = "746|0|50"
  99. elseif aircoValueSetpointZKval2 == 230 then
  100. commandArray['UpdateDevice'] = "746|0|40"
  101. elseif aircoValueSetpointZKval2 == 220 then
  102. commandArray['UpdateDevice'] = "746|0|30"
  103. elseif aircoValueSetpointZKval2 == 210 then
  104. commandArray['UpdateDevice'] = "746|0|20"
  105. elseif aircoValueSetpointZKval2 == 200 then
  106. commandArray['UpdateDevice'] = "746|0|10"
  107. end
  108.  
  109. return commandArray
  110.  
  111. 7:
  112.  
  113. commandArray = {}
  114.  
  115. local aircoValueSpeedSK = io.popen('/home/pi/airco.sh 192.168.0.60 get speed') -- runs command
  116. local aircoValueSpeedSKval = aircoValueSpeedSK:read("*a") -- read output of command
  117. local aircoValueSpeedSKval2 = tonumber(aircoValueSpeedSKval) * 10
  118. commandArray['UpdateDevice'] = "735|0|" .. tostring(aircoValueSpeedSKval2) .. "|"
  119.  
  120. return commandArray
  121.  
  122. 8:
  123.  
  124. commandArray = {}
  125.  
  126. local aircoValueSpeedZK = io.popen('/home/pi/airco.sh 192.168.0.61 get speed') -- runs command
  127. local aircoValueSpeedZKval = aircoValueSpeedZK:read("*a") -- read output of command
  128. local aircoValueSpeedZKval2 = tonumber(aircoValueSpeedZKval) * 10
  129. commandArray['UpdateDevice'] = "740|0|" .. tostring(aircoValueSpeedZKval2) .. "|"
  130.  
  131. return commandArray
  132.  
  133. 9:
  134.  
  135. commandArray = {}
  136.  
  137. local aircoValueVaneSK = io.popen('/home/pi/airco.sh 192.168.0.60 get vane') -- runs command
  138. local aircoValueVaneSKval = aircoValueVaneSK:read("*a") -- read output of command
  139. local aircoValueVaneSKval2 = tonumber(aircoValueVaneSKval)
  140. if aircoValueVaneSKval2 == 10 then
  141. commandArray['UpdateDevice'] = "737|0|50"
  142. else
  143. aircoValueVaneSKval2 = aircoValueVaneSKval2 * 10
  144. commandArray['UpdateDevice'] = "737|0|" .. tostring(aircoValueVaneSKval2) .. "|"
  145. end
  146.  
  147. return commandArray
  148.  
  149. 10:
  150.  
  151. commandArray = {}
  152.  
  153. local aircoValueVaneZK = io.popen('/home/pi/airco.sh 192.168.0.61 get vane') -- runs command
  154. local aircoValueVaneZKval = aircoValueVaneZK:read("*a") -- read output of command
  155. local aircoValueVaneZKval2 = tonumber(aircoValueVaneZKval)
  156. if aircoValueVaneZKval2 == 10 then
  157. commandArray['UpdateDevice'] = "739|0|50"
  158. else
  159. aircoValueVaneZKval2 = aircoValueVaneZKval2 * 10
  160. commandArray['UpdateDevice'] = "739|0|" .. tostring(aircoValueVaneZKval2) .. "|"
  161. end
  162.  
  163. return commandArray
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement