iklein99 / homebridge-smartthings

This is a plugin to Homebridge to connect your Smartthings network into Apple Home Kit.
Apache License 2.0
150 stars 52 forks source link

Thermostat support #120

Open jplwoodward opened 1 year ago

jplwoodward commented 1 year ago

Describe The Bug: Though the correct current temperature is displayed in the Home app, the Home app also says "This accessory is not responding"

Logs: [1/12/2023, 1:35:25 PM] [Smartthings New] Basement Thermostat returned bad value for status [1/12/2023, 1:35:25 PM] [Smartthings New] Bad status from Basement Thermostat

Plugin Config:

"name": "Smartthings New", "BaseURL": "https://api.smartthings.com/v1/", "AccessToken": "5a1efda3-5c88-4527-a6d2-a733c8bb25f5", "GarageDoorMaxPoll": 40, "PollLocksSeconds": 0, "PollDoorsSeconds": 0, "PollSensorsSeconds": 5, "PollSwitchesAndLightsSeconds": 10, "IgnoreDevices": [ "MAIN Virtual Devices", "FR Pendant", "FR Outer", "FR Inner", "Wyze Plug", "FR Sconces ON random", "FR Sconces OFF random", "Bedroom ON random", "Bedroom OFF random", "Laundry Leak", "Boiler Leak", "Water Heater Leak" ], "_bridge": { "username": "0E:10:B6:52:36:06", "port": 41029 }, "platform": "HomeBridgeSmartThings" },

jsdecarie commented 1 year ago

In my case the wrong thermostats state is reported. When the thermostats is in idle state (not heating), the thermostats showing "off" state. (All is fine in SmartThings )

Other than that, great addition!!!!

Thank you,

iklein99 commented 1 year ago

Guys, give 1.4.22 a try. Fixed some issues. Let me know.

jplwoodward commented 1 year ago

Same issue after this update:

[1/13/2023, 11:26:12 AM] [Smartthings New] Basement Thermostat returned bad value for status [1/13/2023, 11:26:12 AM] [Smartthings New] Bad status from Basement Thermostat [1/13/2023, 11:26:16 AM] [Smartthings New] Basement Thermostat returned bad value for status [1/13/2023, 11:26:16 AM] [Smartthings New] Bad status from Basement Thermostat [1/13/2023, 11:26:16 AM] [Smartthings New] Poll failure on Basement Thermostat [1/13/2023, 11:26:21 AM] [Smartthings New] Basement Thermostat returned bad value for status [1/13/2023, 11:26:21 AM] [Smartthings New] Bad status from Basement Thermostat [1/13/2023, 11:26:21 AM] [Smartthings New] Poll failure on Basement Thermostat

On Jan 13, 2023, at 11:18 AM, iklein99 @.***> wrote:

Guys, give 1.4.22 a try. Fixed some issues. Let me know.

— Reply to this email directly, view it on GitHub https://github.com/iklein99/homebridge-smartthings/issues/120#issuecomment-1382076707, or unsubscribe https://github.com/notifications/unsubscribe-auth/ARBGBGUN7GO6ON2AAPKRZ5LWSF56DANCNFSM6AAAAAATZSLMSU. You are receiving this because you authored the thread.

iklein99 commented 1 year ago

I’d like to see the detailed logs.

Can you do the following for me?

Purge your log file (go to the logs screen and click the trashcan). Put homebridge into debug mode (setting screen) Restart homebridge Let it run for a bit (however long it takes for you to see these errors) Download the log file (from the log file screen) Reset the debug flag Restart homebridge

Email the log file to me directly at @. @.>

On Jan 13, 2023, at 11:28 AM, jplwoodward @.***> wrote:

Same issue after this update:

[1/13/2023, 11:26:12 AM] [Smartthings New] Basement Thermostat returned bad value for status [1/13/2023, 11:26:12 AM] [Smartthings New] Bad status from Basement Thermostat [1/13/2023, 11:26:16 AM] [Smartthings New] Basement Thermostat returned bad value for status [1/13/2023, 11:26:16 AM] [Smartthings New] Bad status from Basement Thermostat [1/13/2023, 11:26:16 AM] [Smartthings New] Poll failure on Basement Thermostat [1/13/2023, 11:26:21 AM] [Smartthings New] Basement Thermostat returned bad value for status [1/13/2023, 11:26:21 AM] [Smartthings New] Bad status from Basement Thermostat [1/13/2023, 11:26:21 AM] [Smartthings New] Poll failure on Basement Thermostat

On Jan 13, 2023, at 11:18 AM, iklein99 @.***> wrote:

Guys, give 1.4.22 a try. Fixed some issues. Let me know.

— Reply to this email directly, view it on GitHub https://github.com/iklein99/homebridge-smartthings/issues/120#issuecomment-1382076707, or unsubscribe https://github.com/notifications/unsubscribe-auth/ARBGBGUN7GO6ON2AAPKRZ5LWSF56DANCNFSM6AAAAAATZSLMSU. You are receiving this because you authored the thread.

— Reply to this email directly, view it on GitHub https://github.com/iklein99/homebridge-smartthings/issues/120#issuecomment-1382087917, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABG55EUWS6CB47YP7FN5H5LWSF7EJANCNFSM6AAAAAATZSLMSU. You are receiving this because you commented.

iklein99 commented 1 year ago

Sorry, can you actually send me the complete file that you downloaded to iklein99@comcast.net? The log didn't include the error.

iklein99 commented 1 year ago

So, the issue is that the device is reporting 'null' for humidity: "relativeHumidityMeasurement": { "humidity": { "value": null, "unit": "%", "timestamp": "2020-09-22T18:27:14.874Z" } }, Which is not expected. (It's also interesting that the timestamp for that is back in 2020). The device reports support for humidity measurement, but is not providing a valid response. Other than an annoying error message in the log, it won't have an impact to the operation of the device. It should still show up, but it will not provide a valid humidity measurement.

jplwoodward commented 1 year ago

The device does not measure relative humidity. The code I had sent you a while ago checked for this:

// My thermostats's status states that it supports Relative Humidity, but reports only the value null,
// so we test that value before registering the services to get it.

   this.refreshStatus().then((success) => {
        if (!success) {
            this.online = false;
            this.log.error(`Could not get device status for ${this.name}`);
            return reject(new this.platform.api.hap.HapStatusError(-70402 /* SERVICE_COMMUNICATION_FAILURE */ ))
        }
    var value;
    if (accessory.context.device.components[0].capabilities.find(c => c.id === 'relativeHumidityMeasurement')) {
            value = this.deviceStatus.status.relativeHumidityMeasurement.humidity.value;
            if (value !== undefined && value !== null) {
                 this.service.getCharacteristic(platform.Characteristic.CurrentRelativeHumidity)
                    .onGet(this.getCurrentRelativeHumidity.bind(this));
            }
    }

With your current code, it shows up, but says it is not responding. - John

On Jan 13, 2023, at 12:15 PM, iklein99 @.***> wrote:

So, the issue is that the device is reporting 'null' for humidity: "relativeHumidityMeasurement": { "humidity": { "value": null, "unit": "%", "timestamp": "2020-09-22T18:27:14.874Z" } }, Which is not expected. (It's also interesting that the timestamp for that is back in 2020). The device reports support for humidity measurement, but is not providing a valid response. Other than an annoying error message in the log, it won't have an impact to the operation of the device. It should still show up, but it will not provide a valid humidity measurement.

— Reply to this email directly, view it on GitHub https://github.com/iklein99/homebridge-smartthings/issues/120#issuecomment-1382155224, or unsubscribe https://github.com/notifications/unsubscribe-auth/ARBGBGWFBLQJXOWZVT4HHWLWSGESRANCNFSM6AAAAAATZSLMSU. You are receiving this because you authored the thread.

iklein99 commented 1 year ago

I understand. Right now, I’m not checking every reported capability from every device to see if we get a valid response, other than when the status is checked. I can look at a better way of doing this, but I don’t want to do it just for termostat humidity. That’s too much of a hack. It will solve your issue but not a good solution across the board. I’ll look at it when I can.

On Jan 13, 2023, at 12:26 PM, jplwoodward @.***> wrote:

The device does not measure relative humidity. The code I had sent you a while ago checked for this:

// My thermostats's status states that it supports Relative Humidity, but reports only the value null, // so we test that value before registering the services to get it.

this.refreshStatus().then((success) => { if (!success) { this.online = false; this.log.error(Could not get device status for ${this.name}); return reject(new this.platform.api.hap.HapStatusError(-70402 / SERVICE_COMMUNICATION_FAILURE / )) } var value; if (accessory.context.device.components[0].capabilities.find(c => c.id === 'relativeHumidityMeasurement')) { value = this.deviceStatus.status.relativeHumidityMeasurement.humidity.value; if (value !== undefined && value !== null) { this.service.getCharacteristic(platform.Characteristic.CurrentRelativeHumidity) .onGet(this.getCurrentRelativeHumidity.bind(this)); } }

With your current code, it shows up, but says it is not responding. - John

On Jan 13, 2023, at 12:15 PM, iklein99 @.***> wrote:

So, the issue is that the device is reporting 'null' for humidity: "relativeHumidityMeasurement": { "humidity": { "value": null, "unit": "%", "timestamp": "2020-09-22T18:27:14.874Z" } }, Which is not expected. (It's also interesting that the timestamp for that is back in 2020). The device reports support for humidity measurement, but is not providing a valid response. Other than an annoying error message in the log, it won't have an impact to the operation of the device. It should still show up, but it will not provide a valid humidity measurement.

— Reply to this email directly, view it on GitHub https://github.com/iklein99/homebridge-smartthings/issues/120#issuecomment-1382155224, or unsubscribe https://github.com/notifications/unsubscribe-auth/ARBGBGWFBLQJXOWZVT4HHWLWSGESRANCNFSM6AAAAAATZSLMSU. You are receiving this because you authored the thread.

— Reply to this email directly, view it on GitHub https://github.com/iklein99/homebridge-smartthings/issues/120#issuecomment-1382166604, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABG55ESF2N7VWOUL5XRJMX3WSGF47ANCNFSM6AAAAAATZSLMSU. You are receiving this because you commented.

iklein99 commented 1 year ago

Good news... I found a good way to remove any sensor service once it reports an invalid value. I'll be releasing a fix soon...

jplwoodward commented 1 year ago

Makes sense! Thanks! - John

On Fri, Jan 13, 2023 at 1:42 PM iklein99 @.***> wrote:

Good news... I found a good way to remove any sensor service once it reports an invalid value. I'll be releasing a fix soon...

— Reply to this email directly, view it on GitHub https://github.com/iklein99/homebridge-smartthings/issues/120#issuecomment-1382240265, or unsubscribe https://github.com/notifications/unsubscribe-auth/ARBGBGWXCQDJQRBE2RBHKSLWSGOZPANCNFSM6AAAAAATZSLMSU . You are receiving this because you authored the thread.Message ID: @.***>

-- Sent from my iPhone.

iklein99 commented 1 year ago

Try version 1.4.23. Should detect the invalid response and remove the service. You'll see one error in the logs.

jplwoodward commented 1 year ago

Definitely an improvement!. Just one error in the log as you said. The home app still shows a humidity service exist with no value:

On Jan 16, 2023, at 3:33 PM, iklein99 @.***> wrote:

Try version 1.4.23. Should detect the invalid response and remove the service. You'll see one error in the logs.

— Reply to this email directly, view it on GitHub https://github.com/iklein99/homebridge-smartthings/issues/120#issuecomment-1384526273, or unsubscribe https://github.com/notifications/unsubscribe-auth/ARBGBGQWPTRKT4EW7CUHAC3WSWWANANCNFSM6AAAAAATZSLMSU. You are receiving this because you authored the thread.

iklein99 commented 1 year ago

You can clear that by putting the name of the device in the ignore devices list.  Then restart.  The device will be removed    Then remove it from the list and restart.   It will add it back in without the humidity. Sent from my iPhoneOn Jan 16, 2023, at 5:49 PM, jplwoodward @.***> wrote: Definitely an improvement!. Just one error in the log as you said. The home app still shows a humidity service exist with no value:

On Jan 16, 2023, at 3:33 PM, iklein99 @.***> wrote:

Try version 1.4.23. Should detect the invalid response and remove the service. You'll see one error in the logs.

— Reply to this email directly, view it on GitHub https://github.com/iklein99/homebridge-smartthings/issues/120#issuecomment-1384526273, or unsubscribe https://github.com/notifications/unsubscribe-auth/ARBGBGQWPTRKT4EW7CUHAC3WSWWANANCNFSM6AAAAAATZSLMSU. You are receiving this because you authored the thread.

—Reply to this email directly, view it on GitHub, or unsubscribe.You are receiving this because you commented.Message ID: @.***>

jplwoodward commented 1 year ago

That did not work. no change in behavior. - John

On Jan 16, 2023, at 6:56 PM, iklein99 @.***> wrote:

You can clear that by putting the name of the device in the ignore devices list. Then restart. The device will be removed Then remove it from the list and restart. It will add it back in without the humidity. Sent from my iPhoneOn Jan 16, 2023, at 5:49 PM, jplwoodward @.***> wrote: Definitely an improvement!. Just one error in the log as you said. The home app still shows a humidity service exist with no value:

On Jan 16, 2023, at 3:33 PM, iklein99 @.***> wrote:

Try version 1.4.23. Should detect the invalid response and remove the service. You'll see one error in the logs.

— Reply to this email directly, view it on GitHub https://github.com/iklein99/homebridge-smartthings/issues/120#issuecomment-1384526273, or unsubscribe https://github.com/notifications/unsubscribe-auth/ARBGBGQWPTRKT4EW7CUHAC3WSWWANANCNFSM6AAAAAATZSLMSU. You are receiving this because you authored the thread.

—Reply to this email directly, view it on GitHub, or unsubscribe.You are receiving this because you commented.Message ID: @.***> — Reply to this email directly, view it on GitHub https://github.com/iklein99/homebridge-smartthings/issues/120#issuecomment-1384680578, or unsubscribe https://github.com/notifications/unsubscribe-auth/ARBGBGSSPEVN5YBINBZC4NDWSXN2LANCNFSM6AAAAAATZSLMSU. You are receiving this because you authored the thread.

iklein99 commented 1 year ago

It worked when I tested it, but not sure what is happening. The device will first be added with the humidity sensor. After the first bad value, the service will be removed.

Try it again. After the first restart, go into Home and make sure that the thermostat is gone. Then quit Home. Remove the device from the exclusion list and restart. Wait until after you see the failure message in the logs, then go into Home and check to see if the device was added back in without humidity.

jplwoodward commented 1 year ago

Same result this time. Here are the (non-debug) logs entires from the restart:

Registering new accessory: Basement Thermostat [1/18/2023, 1:10:00 PM] [Smartthings New] Restoring existing accessory from cache: Living Room Lamps [1/18/2023, 1:10:00 PM] [Smartthings New] Restoring existing accessory from cache: X1/Fire TV Power [1/18/2023, 1:10:00 PM] [Smartthings New] Restoring existing accessory from cache: Christmas Tree [1/18/2023, 1:10:00 PM] [Smartthings New] Restoring existing accessory from cache: Front Right Bedroom [1/18/2023, 1:10:00 PM] [Smartthings New] Restoring existing accessory from cache: Fireplace [1/18/2023, 1:10:00 PM] [Smartthings New] Restoring existing accessory from cache: Front Post Light [1/18/2023, 1:10:01 PM] [Smartthings New] Basement Thermostat returned bad value for status [1/18/2023, 1:10:01 PM] [Smartthings New] Bad status from Basement Thermostat. Removing this service.

My phone is 16.1.2, and still shows the humidity as in the screenshot I sent before. My Mac is 12.2.6 (older Home version). It does not show anything that explcitly says Humidity, but does show the thermostat as 2 devices:

On Jan 18, 2023, at 8:08 AM, iklein99 @.***> wrote:

It worked when I tested it, but not sure what is happening. The device will first be added with the humidity sensor. After the first bad value, the service will be removed.

Try it again. After the first restart, go into Home and make sure that the thermostat is gone. Then quit Home. Remove the device from the exclusion list and restart. Wait until after you see the failure message in the logs, then go into Home and check to see if the device was added back in without humidity.

— Reply to this email directly, view it on GitHub https://github.com/iklein99/homebridge-smartthings/issues/120#issuecomment-1387046893, or unsubscribe https://github.com/notifications/unsubscribe-auth/ARBGBGVPMXCBWMWWPXBYS5LWS7TMXANCNFSM6AAAAAATZSLMSU. You are receiving this because you authored the thread.

llloplllop commented 1 year ago

Hi I am using heating system (Boiler) at home and connected on ST

after installing your plugin, It find a heaating system. But I can't turn on/off.. and checking the status..

"난방" is heating system in korean heating system have two status

  1. Temperature, 2. Switch for turning on the system

18/01/2023, 20:33:49] [Smartthings Plug (IK)] Missing switch status from [거실] 난방 [18/01/2023, 20:33:49] [Smartthings Plug (IK)] Missing switch status from [침실3] 난방 [18/01/2023, 20:33:58] [Smartthings Plug (IK)] Missing switch status from [침실1] 난방 [18/01/2023, 20:33:58] [Smartthings Plug (IK)] Missing switch status from [알파룸] 난방 [18/01/2023, 20:33:59] [Smartthings Plug (IK)] Missing switch status from [침실2] 난방 [18/01/2023, 20:33:59] [Smartthings Plug (IK)] Missing switch status from [거실] 난방

Date Source Type Name Value User Displayed Text
2023-01-19 5:50:17.000 오전 KST21분 전 DEVICE   temperature 23    
2023-01-19 5:27:10.000 오전 KST44분 전 DEVICE   thermostatMode off    
2023-01-19 5:01:31.000 오전 KST1시간 전 DEVICE   temperature 22    
2023-01-19 5:01:22.000 오전 KST1시간 전 DEVICE   thermostatMode heat    
2023-01-19 5:01:22.000 오전 KST1시간 전 DEVICE   temperature 21

알파룸] 난방 (Device) Events — displayed | all | from device 25 Date Source Type Name Value User Displayed Text 2023-01-19 5:50:17.000 오전 KST 21분 전 DEVICE temperature 23
2023-01-19 5:27:10.000 오전 KST 44분 전 DEVICE thermostatMode off
2023-01-19 5:01:31.000 오전 KST 1시간 전 DEVICE temperature 22
2023-01-19 5:01:22.000 오전 KST 1시간 전 DEVICE thermostatMode heat
2023-01-19 5:01:22.000 오전 KST 1시간 전 DEVICE temperature 21

iklein99 commented 1 year ago

Please follow these instructions to send me the detailed logs so I can see what is happening.
Instructions for Producing a Detailed Log.pdf

iklein99 commented 1 year ago

You need to send me the actual file you downloaded to this email address. Don't post it here as you can expose information to others...

iklein99@comcast.net

fredrile commented 1 year ago

I think I have the same problem as [llloplllop]. Device displays but cannot see status or control it. I have sent you a detail log as requested via email.

Devices are HeatIt Z-TRM3 using manufacturer drivers

[4/15/2023, 3:03:58 PM] [Smartthings Plug (IK)] Missing switch status from Hallway Thermostat [4/15/2023, 3:04:02 PM] [Smartthings Plug (IK)] Missing switch status from Bathroom Thermostat [4/15/2023, 3:04:07 PM] [Smartthings Plug (IK)] Missing switch status from Kitchen Thermostat

regg00 commented 10 months ago

+1 for this. I kind of have the same issue. I have 3 thermostat devices, same make and model, but I can only control one of them. The others only show as a temperature sensor.

I will send the logs by email in a couple of minutes.

kallekilponen commented 8 months ago

I seem to have the same problem as fredrile. My Heatit Z-TRM3 thermostats are showing up as temperature sensors and not thermostats.