tonesto7 / homebridge-smartthings

SmartThings Homebridge Plugin
385 stars 770 forks source link

[Feature Request] Basic "sensor-like" support for home appliances #336

Open dikodahan opened 4 years ago

dikodahan commented 4 years ago

As you clearly stated, this updated plugin does not support home appliances as Homekit does not natively supports that. Cannot complaiun about that :)

As a feature request, I would ask to get a basic sensor like behavior for just ON/OFF of the home appliance. This, in turn, can at least provide a basic capability of knowing when an appliance is done, like the washer and/or dryer have completed their cycle.

From the Homebridge logs I added below your plugin clearly receives the events from the appliances so I assume a receiving Virtual Homekit ON/OFF Sensor could be tied to these events. If you need more event info I am happy to provide them and obviously test a potential implementation.

Example events from Homebridge log for starting the dryer:

[2/28/2020, 10:53:04 am] [SmartThings-v2] INFO: [Device Event]: (Dryer) [DRYERJOBSTATE] is drying
[2/28/2020, 10:53:04 am] [SmartThings-v2] INFO: [Device Event]: (Dryer) [TIMESTRING] is 00:48:00 Remaining
[2/28/2020, 10:53:04 am] [SmartThings-v2] INFO: [Device Event]: (Dryer) [COMPLETIONTIME] is 2020-02-28T16:41:03.947Z
[2/28/2020, 10:53:04 am] [SmartThings-v2] INFO: [Device Event]: (Dryer) [MACHINESTATE] is run

In the logs I can clearly see that it polls the appliance every minute (sample of polling events):

[2/28/2020, 12:17:02 pm] [SmartThings-v2] INFO: [Device Event]: (Dryer) [COMPLETIONTIME] is 2020-02-28T17:36:02.206Z
[2/28/2020, 12:17:02 pm] [SmartThings-v2] INFO: [Device Event]: (Dryer) [TIMESTRING] is 00:19:00 Remaining`

These are the completion events of the job:

[2/28/2020, 1:21:49 pm] [SmartThings-v2] INFO: [Device Event]: (Dryer) [COMPLETIONTIME] is 2020-02-28T18:21:49.311Z
[2/28/2020, 1:21:49 pm] [SmartThings-v2] INFO: [Device Event]: (Dryer) [DRYERJOBSTATE] is finished
[2/28/2020, 1:22:19 pm] [SmartThings-v2] INFO: [Device Event]: (Dryer) [DRYERJOBSTATE] is none
[2/28/2020, 1:22:20 pm] [SmartThings-v2] INFO: [Device Event]: (Dryer) [COMPLETIONTIME] is 2020-02-28T19:37:19.918Z
[2/28/2020, 1:22:20 pm] [SmartThings-v2] INFO: [Device Event]: (Dryer) [TIMESTRING] is 01:15:00 Remaining
[2/28/2020, 1:22:20 pm] [SmartThings-v2] INFO: [Device Event]: (Dryer) [MACHINESTATE] is stop

Perhaps using the [MACHINESTATE] run/stop events is a simple and generic enough mechanism for an ON/OFF state?

This would be an awesome addition to an already awesome plugin! Appreciate the consideration!!!

jdebardi commented 4 years ago

This came up before, I asked for similar, just a switch to show if the washing machine was on or off. The problem is the different appliances have MANY capabilities (they don’t even share a common one for state!) so it’s not easy to map/condense them down to just on and off in a generic way.

The best option that should be generic enough to all Samsung washer/dryers would be to link the HomeKit switch to the remote control state (on the basis that at the end of a cycle it always disabled remote control automatically and most users enable it when starting a cycle so they can monitor progress).

Feb 28 16:24:17 jose-stick homebridge[28372]: [2/28/2020, 4:24:17 PM] [SmartThings] Change Event: (Washing machine) [REMOTECONTROLENABLED] is true Feb 28 16:24:30 jose-stick homebridge[28372]: [2/28/2020, 4:24:30 PM] [SmartThings] Change Event: (Washing machine) [REMOTECONTROLENABLED] is false

Much as I really want this, I would fully understand @tonesto7 reluctance to support it.

jdebardi commented 4 years ago

I say that, machineState might be the same across all Samsung devices My washer has it as does your dryer and shows either “run” or “stop”

jdebardi commented 4 years ago

The other way around it (which is what I have done), is to create a virtual switch, then a SmartThings (New app) automation turn it on/off based on the washer/dryer state. The virtual switch can then be displayed in Homebridge.

dikodahan commented 4 years ago

The other way around it (which is what I have done), is to create a virtual switch, then a SmartThings (New app) automation turn it on/off based on the washer/dryer state. The virtual switch can then be displayed in Homebridge.

Can you please share a reference to the configuration?

tonesto7 commented 4 years ago

I have an idea on how to add support for these but take the effort off me to support. I’m thinking about building a Config file structure that allows you guys to define custom capabilities and attributes for switches and maybe contact sensors to start.

I just need some time to think it through then implement

dikodahan commented 3 years ago

Hey @tonesto7 Any potential updates on this capability as a switch?

ttopholm commented 3 years ago

This would be a really nice feature...

So far I have issued homebridge-cmdswitch2 to call a script (the state script), that use a personal token to access the smartthing api, and get the machine state for my washer... it works like a charm... but would be nice to have it as plugin...