tonesto7 / homebridge-smartthings

SmartThings Homebridge Plugin
384 stars 768 forks source link

[Feature Request] Allow devices to be manually classified as thermostats #341

Open HammerAce42 opened 4 years ago

HammerAce42 commented 4 years ago

Is your feature request related to a problem? Please describe.

I use a SmartApp which enables SmartThings to control Flair Pucks and Vents (flair.co). The Smartapp in question does not set the device type for a puck as a thermostat (developer explains why here) even though the pucks have a set point that can be specified. Right now, they only appear in homekit as temperature and humidity sensors.

Describe the solution you'd like

I'd like to be able to surface the pucks as thermostats in homekit so I can adjust the set point.

Describe alternatives you've considered

Right now I have to control individual vents in homekit (I have configured them to appear as fans), but this is less than ideal when trying to achieve a specific temperature in a room.

tonesto7 commented 4 years ago

@HammerAce42 In the latest SmartApp there is an input named Device Data Viewer. Please select one of the pucks and share with me all the data that is reported

HammerAce42 commented 4 years ago

Unfortunately I see an error when trying to view device data for the pucks (and the vents - other non Flair devices don’t cause this error)

{"error":true,"type":"java.lang.NumberFormatException","message":"An unexpected error occurred."}

tonesto7 commented 4 years ago

I just pushed out an updated SmartApp version with tweaks to help handle any errors and at least show some data.

It will log any errors in the IDE logs

HammerAce42 commented 4 years ago

That fixed it. Here is the output from the device data viewer:

{
    "name": "Puck",
    "basename": "My Puck Device",
    "deviceid": [redacted],
    "status": "ONLINE",
    "manufacturer": "Unknown",
    "model": "My Puck Device",
    "deviceNetworkId": [redacted],
    "lastActivity": null,
    "capabilities": [
        "Actuator",
        "Battery",
        "Health Check",
        "Polling",
        "Refresh",
        "Relative Humidity Measurement",
        "Sensor",
        "Temperature Measurement"
    ],
    "commands": [
        "autoMode",
        "awayDeferToRooms",
        "awayOffOnly",
        "awaySmartAway",
        "getBattery",
        "getHumidity",
        "getPressure",
        "getPuckInfo",
        "getPuckReadings",
        "getPuckStates",
        "getRoom",
        "getStructure",
        "getTemperature",
        "getZone",
        "getZonesList",
        "homeAwayAutoHome",
        "homeAwayThirdPartyHome",
        "levelDown",
        "levelUp",
        "manualMode",
        "ping",
        "poll",
        "produceSummaryReport",
        "refresh",
        "setDesiredTemp",
        "setPuck",
        "setPuckHumidityOffset",
        "setPuckImage",
        "setPuckInactive",
        "setPuckScale",
        "setPuckTempOffset",
        "setPuckText",
        "setRoom",
        "setRoomActive",
        "setRoomAirReturn",
        "setRoomAwayMode",
        "setRoomFrozenPipePetProtect",
        "setRoomHumidityAwayMax",
        "setRoomHumidityAwayMin",
        "setRoomLevel",
        "setRoomPreHeatPrecool",
        "setRoomPucksInactive",
        "setRoomSetpoint",
        "setRoomTempAwayMax",
        "setRoomTempAwayMin",
        "setRoomType",
        "setRoomUserDesiredTemp",
        "setStructure",
        "setStructureAwayMode",
        "setStructureHomeAwayMode",
        "setStructureSetpointMode",
        "setpointDeferToRooms",
        "setpointEvenness",
        "setpointEvennessActive"
    ],
    "customflags": [

    ],
    "attributes": {
        "DeviceWatch-DeviceStatus": null,
        "DeviceWatch-Enroll": null,
        "ZoneData": null,
        "battery": 100,
        "beaconIntervalMs": 4095,
        "beaconSightingsData": null,
        "bluetoothTxPowerMw": "500",
        "buttonPushes": 0,
        "changeSet": null,
        "checkInterval": 3600,
        "createdAt": "2019-06-28 18:46:59 PDT",
        "desiredTemperature": 68.0,
        "desiredTemperatureDisplay": "68",
        "dieTemperature": 3332.0,
        "dispTtlMs": null,
        "dropRate": 1.027,
        "firmwareB": "0",
        "firmwareS": "132",
        "firmwareW": "118",
        "healthStatus": null,
        "humidity": 59
    },
    "eventHistory": [
        "Sat Dec 21 05:55:29 UTC 2019 | [rmHoldUntil] | (2019-12-20 21:55:29)",
        "Sat Dec 21 05:55:28 UTC 2019 | [dieTemperature] | (3332.0 F)",
        "Sat Dec 21 05:55:28 UTC 2019 | [temperature] | (60.9 F)",
        "Sat Dec 21 05:55:28 UTC 2019 | [rssi] | (-62)",
        "Sat Dec 21 05:55:28 UTC 2019 | [pressure] | (100182 Pa)",
        "Sat Dec 21 05:53:48 UTC 2019 | [rmHoldUntil] | (2019-12-20 21:53:48)",
        "Sat Dec 21 05:53:47 UTC 2019 | [dieTemperature] | (3350.0 F)",
        "Sat Dec 21 05:53:47 UTC 2019 | [temperature] | (61.0 F)",
        "Sat Dec 21 05:53:47 UTC 2019 | [rssi] | (-63)",
        "Sat Dec 21 05:53:46 UTC 2019 | [pressure] | (100177 Pa)",
        "Sat Dec 21 05:53:46 UTC 2019 | [puckTemperature] | (61.0 F)",
        "Sat Dec 21 05:48:10 UTC 2019 | [rmHoldUntil] | (2019-12-20 21:48:10)",
        "Sat Dec 21 05:48:09 UTC 2019 | [dieTemperature] | (3367.0 F)",
        "Sat Dec 21 05:48:09 UTC 2019 | [temperature] | (61.1 F)",
        "Sat Dec 21 05:48:09 UTC 2019 | [rssi] | (-62)",
        "Sat Dec 21 05:48:09 UTC 2019 | [pressure] | (100181 Pa)",
        "Sat Dec 21 05:48:09 UTC 2019 | [puckTemperature] | (61.2 F)",
        "Sat Dec 21 05:41:09 UTC 2019 | [rmHoldUntil] | (2019-12-20 21:41:08)",
        "Sat Dec 21 05:41:08 UTC 2019 | [light] | (2)",
        "Sat Dec 21 05:41:08 UTC 2019 | [dieTemperature] | (3385.0 F)"
    ]
}
tonesto7 commented 4 years ago

@HammerAce42 It's crazy that this device handler doesn't support any of the native smartthings thermostat attributes and commands.

This would be a purely unique device to support and I will need to think about how to handle it because I don't have the time to develop for a device I can't test on and using to debug is going to be very time-consuming. Can you look and see if there is a Flair Vent homebridge plugin?

tonesto7 commented 4 years ago

@HammerAce42 Are you using Yves handler and SmartApp?

HammerAce42 commented 4 years ago

@tonesto7, yes, the handler and SmartApp I am using were authored by Yves or yracine (if that's what you mean). The specific components are:

Device handlers: My Flair Vent, My Puck Device Smartapp: MyFlairServiceMgr

I checked and there is no Flair homebridge plugin :(

I fully understand that custom device support is a pain. Is it possible to make it somewhat generic enough by just allowing the desiredTemperature field for a ST device to be exposed to Homebridge? Or is even the desiredTemperature not a standard attribute?

tonesto7 commented 4 years ago

Truth is that this device isn't even selectable as a thermostat under any ST apps.

I wonder why Yves didn't make this translate any of the commands or attributes to a native format. He's usually pretty adamant about supporting native functions.

Either way, the only native attributes I see are battery and humidity. Maybe reach out to Yves and request he adds support for native thermostat functionality it will happen much sooner than me adding it in :(

HammerAce42 commented 4 years ago

I've left a note for Yves to reconsider his decision to not surface pucks as thermostats here.

Thanks for taking the time to look into this!

HammerAce42 commented 4 years ago

Ok, so Yves added the setpoint as a thermostat attribute and after that update, the Smartthings app UI does indeed look different with an easier ability to set temperature setpoint. However, the device still show up as only a sensor in Homekit (I have removed and readded the pucks to ensure that wasn't the issue).

Here is the new output from the device data viewer:

{
    "name": "Lower Level Puck",
    "basename": "My Puck Device",
    "deviceid": [redacted],
    "status": "ONLINE",
    "manufacturer": "Unknown",
    "model": "My Puck Device",
    "deviceNetworkId": [redacted],
    "lastActivity": null,
    "capabilities": [
        "Actuator",
        "Battery",
        "Health Check",
        "Polling",
        "Refresh",
        "Relative Humidity Measurement",
        "Sensor",
        "Temperature Measurement",
        "Thermostat Setpoint"
    ],
    "commands": [
        "autoMode",
        "awayDeferToRooms",
        "awayOffOnly",
        "awaySmartAway",
        "getBattery",
        "getHumidity",
        "getPressure",
        "getPuckInfo",
        "getPuckReadings",
        "getPuckStates",
        "getRoom",
        "getStructure",
        "getTemperature",
        "getZone",
        "getZonesList",
        "homeAwayAutoHome",
        "homeAwayThirdPartyHome",
        "levelDown",
        "levelUp",
        "manualMode",
        "ping",
        "poll",
        "produceSummaryReport",
        "refresh",
        "setDesiredTemp",
        "setPuck",
        "setPuckHumidityOffset",
        "setPuckImage",
        "setPuckInactive",
        "setPuckScale",
        "setPuckTempOffset",
        "setPuckText",
        "setRoom",
        "setRoomActive",
        "setRoomAirReturn",
        "setRoomAwayMode",
        "setRoomFrozenPipePetProtect",
        "setRoomHumidityAwayMax",
        "setRoomHumidityAwayMin",
        "setRoomLevel",
        "setRoomPreHeatPrecool",
        "setRoomPucksInactive",
        "setRoomSetpoint",
        "setRoomTempAwayMax",
        "setRoomTempAwayMin",
        "setRoomType",
        "setRoomUserDesiredTemp",
        "setStructure",
        "setStructureAwayMode",
        "setStructureHomeAwayMode",
        "setStructureSetpointMode",
        "setpointDeferToRooms",
        "setpointEvenness",
        "setpointEvennessActive"
    ],
    "customflags": [

    ],
    "attributes": {
        "DeviceWatch-DeviceStatus": null,
        "DeviceWatch-Enroll": null,
        "ZoneData": null,
        "battery": 100,
        "beaconIntervalMs": 4095,
        "beaconSightingsData": null,
        "bluetoothTxPowerMw": "500",
        "buttonPushes": 0,
        "changeSet": null,
        "checkInterval": 3600,
        "createdAt": "2019-06-28 18:46:59 PDT",
        "desiredTemperature": 70.0,
        "desiredTemperatureDisplay": "70",
        "dieTemperature": 3175.0,
        "dispTtlMs": null,
        "dropRate": 1.027,
        "firmwareB": "0",
        "firmwareS": "132",
        "firmwareW": "118",
        "healthStatus": null,
        "humidity": 57
    },
    "eventHistory": [
        "Tue Dec 24 19:11:59 UTC 2019 | [rmHoldUntil] | (2019-12-24 11:11:58)",
        "Tue Dec 24 19:11:58 UTC 2019 | [dieTemperature] | (3175.0 F)",
        "Tue Dec 24 19:11:58 UTC 2019 | [temperature] | (57.6 F)",
        "Tue Dec 24 19:11:58 UTC 2019 | [pressure] | (100610 Pa)",
        "Tue Dec 24 19:11:58 UTC 2019 | [dropRate] | (1.027)",
        "Tue Dec 24 19:11:58 UTC 2019 | [puckTemperature] | (57.6 F)",
        "Tue Dec 24 19:09:48 UTC 2019 | [rmHoldUntil] | (2019-12-24 11:09:47)",
        "Tue Dec 24 19:09:48 UTC 2019 | [light] | (47)",
        "Tue Dec 24 19:09:47 UTC 2019 | [dieTemperature] | (3157.0 F)",
        "Tue Dec 24 19:09:47 UTC 2019 | [pressure] | (100614 Pa)",
        "Tue Dec 24 19:03:38 UTC 2019 | [rmHoldUntil] | (2019-12-24 11:03:38)",
        "Tue Dec 24 19:03:38 UTC 2019 | [light] | (42)",
        "Tue Dec 24 19:02:03 UTC 2019 | [rmHoldUntil] | (2019-12-24 11:02:03)",
        "Tue Dec 24 19:02:03 UTC 2019 | [light] | (48)",
        "Tue Dec 24 19:02:02 UTC 2019 | [dieTemperature] | (3175.0 F)",
        "Tue Dec 24 19:02:02 UTC 2019 | [thermostatSetpoint] | (70.0 F)",
        "Tue Dec 24 19:02:02 UTC 2019 | [pressure] | (100623 Pa)",
        "Tue Dec 24 18:54:33 UTC 2019 | [rmHoldUntil] | (2019-12-24 10:54:32)",
        "Tue Dec 24 18:54:32 UTC 2019 | [light] | (29)",
        "Tue Dec 24 18:54:32 UTC 2019 | [dieTemperature] | (3210.0 F)"
    ]
}

Just in case it's related, I have also been encountering this bug, but that's been happening since before this recent update from Yves.

tonesto7 commented 4 years ago

Looking at this I'm still not seeing the required attributes/commands for setting the setThermostatSetPoint

HammerAce42 commented 4 years ago

Ah, what are the attributes/commands that should be made available? I'll ask Yves to see if he can implement those specifically.

Thanks.

HammerAce42 commented 4 years ago

@tonesto7, friendly ping on this. Thanks!

HammerAce42 commented 4 years ago

I realized I hadn't updated all the components that Yves had sent. After doing that, the data device viewer does explicitly indicate a 'setThermostatSetpoint' capability, but it still doesn't show up in Homekit as a Thermostat. Any ideas?

{
    "name": "Lower Level Puck",
    "basename": "My Puck Device",
    "deviceid": "[redacted]",
    "status": "ONLINE",
    "manufacturer": "Unknown",
    "model": "My Puck Device",
    "deviceNetworkId": "[redacted]",
    "lastActivity": null,
    "capabilities": [
        "Actuator",
        "Battery",
        "Health Check",
        "Polling",
        "Refresh",
        "Relative Humidity Measurement",
        "Sensor",
        "Temperature Measurement",
        "Thermostat Setpoint"
    ],
    "commands": [
        "autoMode",
        "awayDeferToRooms",
        "awayOffOnly",
        "awaySmartAway",
        "getBattery",
        "getHumidity",
        "getPressure",
        "getPuckInfo",
        "getPuckReadings",
        "getPuckStates",
        "getRoom",
        "getStructure",
        "getTemperature",
        "getZone",
        "getZonesList",
        "homeAwayAutoHome",
        "homeAwayThirdPartyHome",
        "levelDown",
        "levelUp",
        "manualMode",
        "ping",
        "poll",
        "produceSummaryReport",
        "refresh",
        "setDesiredTemp",
        "setPuck",
        "setPuckHumidityOffset",
        "setPuckImage",
        "setPuckInactive",
        "setPuckScale",
        "setPuckTempOffset",
        "setPuckText",
        "setRoom",
        "setRoomActive",
        "setRoomAirReturn",
        "setRoomAwayMode",
        "setRoomFrozenPipePetProtect",
        "setRoomHumidityAwayMax",
        "setRoomHumidityAwayMin",
        "setRoomLevel",
        "setRoomPreHeatPrecool",
        "setRoomPucksInactive",
        "setRoomSetpoint",
        "setRoomTempAwayMax",
        "setRoomTempAwayMin",
        "setRoomType",
        "setRoomUserDesiredTemp",
        "setStructure",
        "setStructureAwayMode",
        "setStructureHomeAwayMode",
        "setStructureSetpointMode",
        "setThermostatSetpoint",
        "setpointDeferToRooms",
        "setpointEvenness",
        "setpointEvennessActive"
    ],
    "customflags": [

    ],
    "attributes": {
        "DeviceWatch-DeviceStatus": null,
        "DeviceWatch-Enroll": null,
        "ZoneData": null,
        "battery": 100,
        "beaconIntervalMs": 4095,
        "beaconSightingsData": null,
        "bluetoothTxPowerMw": "500",
        "buttonPushes": 0,
        "changeSet": null,
        "checkInterval": 3600,
        "createdAt": "2019-06-28 18:46:59 PDT",
        "desiredTemperature": 66.0,
        "desiredTemperatureDisplay": "66",
        "dieTemperature": 3210.0,
        "dispTtlMs": null,
        "dropRate": 1.027,
        "firmwareB": "0",
        "firmwareS": "132",
        "firmwareW": "118",
        "healthStatus": null,
        "humidity": 57
    },
    "eventHistory": [
        "Tue Feb 18 01:48:32 UTC 2020 | [rmHoldUntil] | (2020-02-17 17:48:31)",
        "Tue Feb 18 01:48:32 UTC 2020 | [stActive] | (true)",
        "Tue Feb 18 01:48:31 UTC 2020 | [light] | (4)",
        "Tue Feb 18 01:48:31 UTC 2020 | [dieTemperature] | (3210.0 F)",
        "Tue Feb 18 01:48:31 UTC 2020 | [thermostatSetpoint] | (66.0 F)",
        "Tue Feb 18 01:48:31 UTC 2020 | [desiredTemperatureDisplay] | (66 F)",
        "Tue Feb 18 01:48:31 UTC 2020 | [desiredTemperature] | (66.0 F)",
        "Tue Feb 18 01:48:30 UTC 2020 | [pressure] | (102432 Pa)",
        "Tue Feb 18 01:48:30 UTC 2020 | [updatedAt] | (2020-02-17 17:43:01 PST)",
        "Tue Feb 18 01:48:30 UTC 2020 | [dropRate] | (1.027)",
        "Tue Feb 18 01:48:30 UTC 2020 | [puckTemperature] | (58.8 F)",
        "Tue Feb 18 01:42:20 UTC 2020 | [stHomeAwayMode] | (ThirdParty)",
        "Tue Feb 18 01:42:15 UTC 2020 | [stHomeAwayMode] | (Autohome)",
        "Tue Feb 18 01:42:09 UTC 2020 | [rmHoldUntil] | (2020-02-17 17:42:09)",
        "Tue Feb 18 01:42:09 UTC 2020 | [rmCurrentTemperature] | (58.9 F)",
        "Tue Feb 18 01:42:09 UTC 2020 | [rmCurrentTemperatureDisplay] | (59 F)",
        "Tue Feb 18 01:42:09 UTC 2020 | [dieTemperature] | (3245.0 F)",
        "Tue Feb 18 01:42:09 UTC 2020 | [temperature] | (58.8 F)",
        "Tue Feb 18 01:42:09 UTC 2020 | [pressure] | (102434 Pa)",
        "Tue Feb 18 01:42:09 UTC 2020 | [light] | (5)"
    ]
}