howanghk / homebridge-ewelink

Homebridge plugin to control Sonoff relays with OEM firmware
MIT License
81 stars 46 forks source link

Sonoff TH16 temp Min not low enough #38

Open ghost opened 4 years ago

ghost commented 4 years ago

Got the Sonoff TH16 with AM2301 sensor working in homebridge, but it's registering as a thermostat and won't go below 32 degrees (don't know if it's Celsius or Fahrenheit. Is there a config setting to set that?). The temp sensor is good for -55C to 125C. Humidity in homebridge is accurate. EweLink app is accurate for both temp and humidity. Otherwise nice work!

Edit: It's got to be an issue with it marking the device as a thermostat instead of a Switch with Temp/Humidity sensor. It's getting temp in Celsius, and then setting "thermostat" to 0C, which is why it's displaying 32F in homebridge.

Logs: [7/14/2019, 8:13:07 PM] [Garage Freezer] Requesting power state for [Garage Freezer] [7/14/2019, 8:13:07 PM] [Garage Freezer] Requesting current temperature for [Garage Freezer] [7/14/2019, 8:13:07 PM] [Garage Freezer] Requesting current humidity for [Garage Freezer] [7/14/2019, 8:13:07 PM] [Garage Freezer] Requesting current humidity for [Garage Freezer] [7/14/2019, 8:13:07 PM] [Garage Freezer] Requesting current temperature for [Garage Freezer] [7/14/2019, 8:13:07 PM] [Garage Freezer] getCurrentHumidity: 62 [7/14/2019, 8:13:07 PM] [Garage Freezer] setting humidity: 62 [7/14/2019, 8:13:07 PM] [Garage Freezer] setting humidity: 62 [7/14/2019, 8:13:07 PM] [Garage Freezer] getCurrentTemperature: -20 [7/14/2019, 8:13:07 PM] [Garage Freezer] setting temperature: 0 [7/14/2019, 8:13:07 PM] [Garage Freezer] setting temperature: 0 [7/14/2019, 8:13:07 PM] [Garage Freezer] getCurrentTemperature: -20 [7/14/2019, 8:13:07 PM] [Garage Freezer] setting temperature: 0 [7/14/2019, 8:13:07 PM] [Garage Freezer] setting temperature: 0 [7/14/2019, 8:13:07 PM] [Garage Freezer] API reported that [Garage Freezer] is Off

Homekit Reports: Manufacturer TH16 Model PSA-BHA-GL (15) Firmware 2.6

ghost commented 4 years ago

Pulled the sensor out of the freezer and verified it's bottomed out at 0C. Once it was above freezing the numbers started updating. F in Homekit and C in homebridge.

howanghk commented 4 years ago

Hi @TheUglyKorean, as I don't have a TH-16, I cannot verify, debug nor fix your problem. Support for TH-16 was contributed by marcelo-paredes. As you can see from the source code, we don't put min/max limit on the temperature. I afraid it is a limitation from HomeKit.

This project is open source and have a relaxed license that you are free to modify the code and share your work. You can look into the source code, it's written in Javascript which is fairly easy to understand and write. It would be great if you can fix the problem in code, and contribute the fix to this project. Thanks!