J1mbo / homebridge-TH10-Switch

MIT License
0 stars 0 forks source link

TH10 jason temperature error #1

Closed campanel54 closed 8 months ago

campanel54 commented 8 months ago

Not sure why this is happening. Moved my server from one iMac to an iMac Mini. Worked fine on the iMac?

[11/10/2023, 8:31:42 AM] [TH1] Invalid json received from device collecting temperature data:{"StatusSNS":{"Time":"2023-11-10T14:31:42","SI7021":{"Temperature":8.3,"Humidity":73.8,"DewPoint":3.9},"TempUnit":"C"}} [11/10/2023, 8:31:42 AM] [TH1] TypeError: Cannot read properties of undefined (reading 'Temperature') at Request._callback (/usr/local/lib/node_modules/homebridge-th10-switch/index.js:270:99) at Request.self.callback (/usr/local/lib/node_modules/homebridge-th10-switch/node_modules/request/request.js:185:22) at Request.emit (node:events:514:28) at Request. (/usr/local/lib/node_modules/homebridge-th10-switch/node_modules/request/request.js:1154:10) at Request.emit (node:events:514:28) at IncomingMessage. (/usr/local/lib/node_modules/homebridge-th10-switch/node_modules/request/request.js:1076:12) at Object.onceWrapper (node:events:628:28) at IncomingMessage.emit (node:events:526:35) at endReadableNT (node:internal/streams/readable:1408:12) at processTicksAndRejections (node:internal/process/task_queues:82:21)

campanel54 commented 8 months ago

Ignore, turned out I modified the code years ago to work with my sensor.
diff homebridge-th10-switch/index.js orig-homebridge-th10-switch/index.js 221,225c221 < // var temperature = (parseFloat(sonoff_reply.StatusSNS.SI7021.Temperature - 32)/1.8); < var temperature = (parseFloat(sonoff_reply.StatusSNS.SI7021.Temperature)); < var humidity = parseFloat(sonoff_reply.StatusSNS.SI7021.Humidity); < var dewpoint = parseFloat(sonoff_reply.StatusSNS.SI7021.DewPoint); < accessory.log("temp C = " + temperature + " humidity = " + humidity + " dewpoint = " + dewpoint);

          var temperature = parseFloat(sonoff_reply.StatusSNS.DS18B20.Temperature);

227,228d222 < accessory.state.humidity = humidity; < accessory.state.dewpoint = dewpoint; 276c270 < accessory.log('Could not convert data to number (' + sonoff_reply.StatusSNS.SI7021.Temperature + ')');

          accessory.log('Could not convert data to number (' + sonoff_reply.StatusSNS.DS18B20.Temperature + ')');