|
iberium
|
 |
« Reply #8 on: September 12, 2012, 06:55:01 pm » |
|
It doesn't look like the driver ever got pushed through. I went into the schema page and made the changes that it showed, all but the plug and play info where it adds itself automatically to the core. I now get the following error and then it disables itself. This is the log:
== ATTEMPT FRESH START == 1 09/12/12 12:50:11 /usr/pluto/bin/Spawn_Device.sh 148 (spawning-device) 24184 Dev: 148; Already Running list: 15,16,18,19,29,30,31,87,38,21,22,25,23,50,56,59,26,27,54, == FRESH START == 1 09/12/12 12:50:11 /usr/pluto/bin/Spawn_Device.sh 148 (spawning-device) device: 148 ip: localhost cmd_line: Generic_Serial_Device 0 09/12/12 12:50:11 148 (spawning-device) Entering 148 ========== NEW LOG SECTION ========== 1 09/12/12 12:50:12 148 (spawning-device) Starting... 1 1 09/12/12 12:50:12 148 (spawning-device) Found /usr/pluto/bin/Generic_Serial_Device RCODE: 0:require 'Ruby_Generic_Serial_Device' 1:class Command < Ruby_Generic_Serial_Device::RubyCommandWrapper 2:end 3:class Device_148 < Ruby_Generic_Serial_Device::RubySerialIOWrapper 4:#### 192 #################################################################### 5:def cmd_192(pk_pipe, pk_device_pipes, cmd=nil) 6:@returnParamArray.clear 7:data="OID4.1.1=" # Current mode of HVAC operation 8:data+="4" # Auto 9:pdp_set(data) 10:return @returnParamArray 11:end 12:#### 193 #################################################################### 13:def cmd_193(pk_pipe, cmd=nil) 14:@returnParamArray.clear 15:data="OID4.1.1=" # Current mode of HVAC operation 16:data+="1" # HVAC is not active 17:pdp_set(data) 18:return @returnParamArray 19:end 20:#### 278 #################################################################### 21:def cmd_278(value_to_assign, cmd=nil) 22:@returnParamArray.clear 23:if ((value_to_assign[0,1]=="+") || (value_to_assign[0,1]=="-")) 24: # The new setpoint is relative to the current setpoint 25: new_temp = @setpoint + value_to_assign.to_i 26:else 27: # The new setpoint is absolute 28: new_temp = value_to_assign.to_i 29:end 30: 31:data="OID4.1.5=" # Current heat setpoint in deci-degrees Fahrenheit 32:data+=celcius_to_decifarhenheit(new_temp).to_s 33:pdp_set(data) 34:return @returnParamArray 35:end 36:#### 279 #################################################################### 37:def cmd_279(onoff, cmd=nil) 38:@returnParamArray.clear 39:data="OID4.1.3=" # Current mode of fan operation 40:if onoff == "1" 41: data+="2" # Fan is always on 42:else 43: data+="1" # Auto 44:end 45:pdp_set(data) 46:return @returnParamArray 47:end 48:#### 280 #################################################################### 49:def cmd_280(onoff, cmd=nil) 50:@returnParamArray.clear 51:data="OID4.1.1=" # Current mode of HVAC operation 52:if onoff == "H" 53: data+="2" # Heat only 54:elsif onoff == "C" 55: data+="3" # Cool only 56:else 57: data+="4" # Auto 58:end 59:pdp_set(data) 60:return @returnParamArray 61:end 62:#### 350 #################################################################### 63:def cmd_350(cmd=nil) 64:@returnParamArray.clear 65:conn_.Close() 66:return @returnParamArray 67:end 68:#### 351 #################################################################### 69:def cmd_351(cmd=nil) 70:@returnParamArray.clear 71:# Check how long it has been since we queried the thermostat 72:now = Time.new 73:if ((@last_check + 300) < now) 74: # The last check was more than 5 minutes ago 75: update_state() 76:end 77:return @returnParamArray 78:end 79:#### 355 #################################################################### 80:def cmd_355(cmd=nil) 81:@returnParamArray.clear 82:# Initialize the internal state 83:@hvac_mode = 0 84:@fan_mode = 0 85:@temperature = 0 86:@setpoint = 0 87:@time=Time.at(0) 88:@last_check = Time.at(0) 89: 90:# Update the state 91:update_state() 92:return @returnParamArray 93:end 94:#### PRIVATE METHODS #################################################################### 95:def log(line) 96: # This function logs a line to the log file of the device 97: log = File.open("/var/log/pluto/" + device_.devid_.to_s + "_Generic_Serial_Device.log", "a") 98: log.puts Time.now.to_s + " (Ruby script):" + line.to_s 99: log.close 100:end 101: 102:def pdp_set(data, update=true) 103: # This function sets data via the PDP interface, 104: # and then updates the state of the thermostat (if update == true) 105: 106: # Reconnect to the device 107: conn_.Reconnect() 108: 109: # Compile authentication data 110: auth_s=device_.devdata_[114]+":"+device_.devdata_[115] 111: auth_a=Array.new; 112: auth_s.each{|c| auth_a.push(c)} 113: 114: # Compile the request 115: s = "POST /pdp HTTP/1.1\r\n" 116: s+= "Authorization: Basic "+auth_a.pack("m").chop+"\r\n" 117: s+= "Content-Length: " + (data.length+14).to_s() + "\r\n" 118: s+= "\r\n" 119: s+= data+"&submit=Submit\r\n" 120: s+= "\r\n" 121: 122: # Send the request 123: conn_.Send(s) 124: 125: # Wait for a reply 126: recv="" 127: while(true) 128: buff=conn_.Recv(256, 5000) 129: if(buff.length() == 0) 130: break 131: end 132: recv = recv + buff 133: end 134: 135: # Update the state to reflect the new situation 136: if (update) 137: update_state() 138: end 139:end 140: 141:def pdp_get(data) 142: # This function gets data via the PDP interface 143: 144: # Reconnect to the device 145: conn_.Reconnect() 146: 147: # Compile authentication data 148: auth_s=device_.devdata_[114]+":"+device_.devdata_[115] 149: auth_a=Array.new; 150: auth_s.each{|c| auth_a.push(c)} 151: 152: # Compile the request 153: s = "POST /get HTTP/1.1\r\n" 154: s+= "Authorization: Basic "+auth_a.pack("m").chop+"\r\n" 155: s+= "Content-Length: " + (data.length+1).to_s() + "\r\n" 156: s+= "\r\n" 157: s+= data 158: s+= "\r\n" 159: 160: # Send the request 161: conn_.Send(s) 162: 163: # Wait for a reply 164: recv="" 165: while(true) 166: buff=conn_.Recv(256, 5000) 167: if(buff.length() == 0) 168: break 169: end 170: recv = recv + buff 171: end 172: 173: # Parse the reply 174: r = recv.split("=") # Split along the "=" marks 175: r.delete_at(0) # The first element is the HTTP header, remove it 176: 177: results = Array.new 178: r.each do |p| 179: results.push(p.split("&")[0]) # Everything up to the ampersand is the result 180: end 181: 182: return results 183:end 184: 185:def decifarhenheit_to_celcius(cf) 186: # Converts a temperatue in deci-Farhenheit into degrees Celcius 187: return (((cf - 320)*5)/90) 188:end 189: 190:def decifarhenheit_to_decicelcius(cf) 191: # Converts a temperatue in deci-Farhenheit into deci-degrees Celcius 192: return (((cf - 320)*5)/9) 193:end 194: 195:def celcius_to_decifarhenheit(c) 196: # Converts a temperatue in degrees Celcius into deci-Farhenheit 197: return (((c*90)/5)+320) 198:end 199: 200:def update_state() 201: # This function queries the thermostat to get the most recent state 202: log("Polling thermostat for updates") 203: 204: data ="OID4.1.1=&" # Current mode of HVAC operation 205: data+="OID4.1.3=&" # Current mode of fan operation 206: data+="OID4.1.5=&" # Current heat setpoint in deci-degrees Fahrenheit 207: data+="OID4.1.13=&" # Current averaged temperature in deci-degrees Farhrenheit 208: data+="OID2.5.1=&" # System time in seconds since Jan 1, 1970 209: 210: results = pdp_get(data) 211: 212: # Get the new states 213: new_hvac_mode = results[0].to_i # 1-Off, 2-Heat, 3-Cool, 4-Auto 214: if (results[1].to_i == 1) 215: # Always on 216: new_fan_mode = 2 # On 217: else 218: # Auto/Schedule 219: new_fan_mode = 0 # Auto 220: end 221: new_setpoint = decifarhenheit_to_celcius(results[2].to_i) 222: new_temperature = decifarhenheit_to_decicelcius(results[3].to_i) 223: new_time = Time.at(results[4].to_i - Time.now.utc_offset) # Time.at creates a UTC time, wheras the thermostat reports the time in the local time zone 224: 225: # Update the state and send events when necessary 226: if (new_hvac_mode != @hvac_mode) 227: log(" New mode detected : " + new_hvac_mode.to_s) 228: if (@hvac_mode == 1) 229: # The old mode was "Off", so now the thermostat is on 230: cmd = Command.new(device_.devid_, -1001, 1, 2, 28) # On 231: SendCommand(cmd) 232: end 233: if (new_hvac_mode == 1) 234: # The new mode is "Off", so we send the Off event: 235: cmd = Command.new(device_.devid_, -1001, 1, 2, 29) # Off 236: SendCommand(cmd) 237: else 238: # We send the Thermostat mode changed event: 239: cmd = Command.new(device_.devid_, -1001, 1, 2, 78) 240: cmd.params_[30] = (new_hvac_mode - 1).to_s 241: SendCommand(cmd) 242: end 243: @hvac_mode = new_hvac_mode 244: end 245: 246: if (new_fan_mode != @fan_mode) 247: @fan_mode = new_fan_mode 248: log(" New fan mode detected : " + @fan_mode.to_s) 249: cmd = Command.new(device_.devid_, -1001, 1, 2, 79) # Fan Mode Changed 250: cmd.params_[30] = @fan_mode.to_s # Fan mode value (0,1 - Auto / LOW; 2,3 - High) 251: SendCommand(cmd) 252: end 253: 254: if (new_setpoint != @setpoint) 255: @setpoint = new_setpoint 256: log(" New temperature setpoint detected : " + @setpoint.to_s) 257: cmd = Command.new(device_.devid_, -1001, 1, 2, 27) # Thermostat Set Point Chan 258: cmd.params_[30] = @setpoint.to_s # The new set point 259: SendCommand(cmd) 260: end 261: 262: if (new_temperature != @temperature) 263: @temperature = new_temperature 264: log(" New temperature measurement detected : " + (@temperature/10.0).to_s) 265: cmd = Command.new(device_.devid_, -1001, 1, 2, 25) # Temperature changed event 266: cmd.params_[30] = (@temperature/10.0).to_s # The ambient temperature 267: SendCommand(cmd) 268: end 269: 270: # Check the latest system time 271: @time = new_time 272: if ((@time-Time.now).abs > 600) 273: # Time is out of sync for more than 10 minutes 274: log("Thermostat's time ("+@time.to_s+") is out of sync with system time ("+Time.now.to_s+"), resynchronizing") 275: data="OID2.5.1=" # Current system time in seconds since Jan 1, 1970 276: data+=(Time.now + Time.now.utc_offset).to_i.to_s # Time.to_i returns seconds since epoch in UTC, wheras the thermostat expects the time in seconds since epoch in the local time zone 277: pdp_set(data, false) 278: end 279: 280: # Record the last time the state was checked 281: @last_check = Time.now 282: 283:end 284:#### START SETTERS #################################################################### 285:def initialize() 286:super 287:@returnParamArray=Array.new 288:end 289:#### END SETTERS #################################################################### 290:end 292:Wed Sep 12 12:50:13 -0500 2012 (Ruby script):Polling thermostat for updates 01 09/12/12 12:50:13.179 Error while calling method: Cannot call class method: cmd_355 error: undefined method `+' for nil:NilClass, line: 148 backtrace: in: (eval): 148 from (eval):148:in `pdp_get' from (eval):210:in `update_state' from (eval):91:in `cmd_355' <0xb509bb70> Wed Sep 12 12:50:14 -0500 2012 (Ruby script):Polling thermostat for updates 01 09/12/12 12:50:14.964 Error while calling method: Cannot call class method: cmd_351 error: undefined method `+' for nil:NilClass, line: 148 backtrace: in: (eval): 148 from (eval):148:in `pdp_get' from (eval):210:in `update_state' from (eval):75:in `cmd_351' from (eval):148 <0xb509bb70> Wed Sep 12 12:50:16 -0500 2012 (Ruby script):Polling thermostat for updates 01 09/12/12 12:50:16.998 Error while calling method: Cannot call class method: cmd_351 error: undefined method `+' for nil:NilClass, line: 148 backtrace: in: (eval): 148 from (eval):148:in `pdp_get' from (eval):210:in `update_state' from (eval):75:in `cmd_351' from (eval):148 <0xb509bb70> Wed Sep 12 12:50:18 -0500 2012 (Ruby script):Polling thermostat for updates 01 09/12/12 12:50:19.032 Error while calling method: Cannot call class method: cmd_351 error: undefined method `+' for nil:NilClass, line: 148 backtrace: in: (eval): 148 from (eval):148:in `pdp_get' from (eval):210:in `update_state' from (eval):75:in `cmd_351' from (eval):148 <0xb509bb70> Wed Sep 12 12:50:21 -0500 2012 (Ruby script):Polling thermostat for updates 01 09/12/12 12:50:21.112 Error while calling method: Cannot call class method: cmd_351 error: undefined method `+' for nil:NilClass, line: 148 backtrace: in: (eval): 148 from (eval):148:in `pdp_get' from (eval):210:in `update_state' from (eval):75:in `cmd_351' from (eval):148 <0xb509bb70> Wed Sep 12 12:50:23 -0500 2012 (Ruby script):Polling thermostat for updates 01 09/12/12 12:50:23.166 Error while calling method: Cannot call class method: cmd_351 error: undefined method `+' for nil:NilClass, line: 148 backtrace: in: (eval): 148 from (eval):148:in `pdp_get' from (eval):210:in `update_state' from (eval):75:in `cmd_351' from (eval):148 <0xb509bb70> Wed Sep 12 12:50:25 -0500 2012 (Ruby script):Polling thermostat for updates 01 09/12/12 12:50:25.213 Error while calling method: Cannot call class method: cmd_351 error: undefined method `+' for nil:NilClass, line: 148 backtrace: in: (eval): 148 from (eval):148:in `pdp_get' from (eval):210:in `update_state' from (eval):75:in `cmd_351' from (eval):148 <0xb509bb70> Wed Sep 12 12:50:27 -0500 2012 (Ruby script):Polling thermostat for updates 01 09/12/12 12:50:27.244 Error while calling method: Cannot call class method: cmd_351 error: undefined method `+' for nil:NilClass, line: 148 backtrace: in: (eval): 148 from (eval):148:in `pdp_get' from (eval):210:in `update_state' from (eval):75:in `cmd_351' from (eval):148 <0xb509bb70> Wed Sep 12 12:50:29 -0500 2012 (Ruby script):Polling thermostat for updates 01 09/12/12 12:50:29.274 Error while calling method: Cannot call class method: cmd_351 error: undefined method `+' for nil:NilClass, line: 148 backtrace: in: (eval): 148 from (eval):148:in `pdp_get' from (eval):210:in `update_state' from (eval):75:in `cmd_351' from (eval):148 <0xb509bb70> Wed Sep 12 12:50:31 -0500 2012 (Ruby script):Polling thermostat for updates 01 09/12/12 12:50:31.303 Error while calling method: Cannot call class method: cmd_351 error: undefined method `+' for nil:NilClass, line: 148 backtrace: in: (eval): 148 from (eval):148:in `pdp_get' from (eval):210:in `update_state' from (eval):75:in `cmd_351' from (eval):148 <0xb509bb70> Wed Sep 12 12:50:33 -0500 2012 (Ruby script):Polling thermostat for updates 01 09/12/12 12:50:33.333 Error while calling method: Cannot call class method: cmd_351 error: undefined method `+' for nil:NilClass, line: 148 backtrace: in: (eval): 148 from (eval):148:in `pdp_get' from (eval):210:in `update_state' from (eval):75:in `cmd_351' from (eval):148 <0xb509bb70> Wed Sep 12 12:50:35 -0500 2012 (Ruby script):Polling thermostat for updates 01 09/12/12 12:50:35.376 Error while calling method: Cannot call class method: cmd_351 error: undefined method `+' for nil:NilClass, line: 148 backtrace: in: (eval): 148 from (eval):148:in `pdp_get' from (eval):210:in `update_state' from (eval):75:in `cmd_351' from (eval):148 <0xb509bb70> Wed Sep 12 12:50:37 -0500 2012 (Ruby script):Polling thermostat for updates 01 09/12/12 12:50:37.405 Error while calling method: Cannot call class method: cmd_351 error: undefined method `+' for nil:NilClass, line: 148 backtrace: in: (eval): 148 from (eval):148:in `pdp_get' from (eval):210:in `update_state' from (eval):75:in `cmd_351' from (eval):148 <0xb509bb70> Wed Sep 12 12:50:39 -0500 2012 (Ruby script):Polling thermostat for updates 01 09/12/12 12:50:39.434 Error while calling method: Cannot call class method: cmd_351 error: undefined method `+' for nil:NilClass, line: 148 backtrace: in: (eval): 148 from (eval):148:in `pdp_get' from (eval):210:in `update_state' from (eval):75:in `cmd_351' from (eval):148 <0xb509bb70> Wed Sep 12 12:50:41 -0500 2012 (Ruby script):Polling thermostat for updates 01 09/12/12 12:50:41.462 Error while calling method: Cannot call class method: cmd_351 error: undefined method `+' for nil:NilClass, line: 148 backtrace: in: (eval): 148 from (eval):148:in `pdp_get' from (eval):210:in `update_state' from (eval):75:in `cmd_351' from (eval):148 <0xb509bb70> Wed Sep 12 12:50:43 -0500 2012 (Ruby script):Polling thermostat for updates 01 09/12/12 12:50:43.489 Error while calling method: Cannot call class method: cmd_351 error: undefined method `+' for nil:NilClass, line: 148 backtrace: in: (eval): 148 from (eval):148:in `pdp_get' from (eval):210:in `update_state' from (eval):75:in `cmd_351' from (eval):148 <0xb509bb70> Wed Sep 12 12:50:45 -0500 2012 (Ruby script):Polling thermostat for updates 01 09/12/12 12:50:45.640 Error while calling method: Cannot call class method: cmd_351 error: undefined method `+' for nil:NilClass, line: 148 backtrace: in: (eval): 148 from (eval):148:in `pdp_get' from (eval):210:in `update_state' from (eval):75:in `cmd_351' from (eval):148 <0xb509bb70>
|