otaviojr / node-red-contrib-smartthings

Allows you to control your devices and get their status using NodeRed
MIT License
32 stars 16 forks source link

support-mrcool-thermostat capability #81

Closed shawner18 closed 2 years ago

shawner18 commented 2 years ago

My thermostat reporting the capability of thermostatMode. The current code was sending the capability of thermostat. I was not sure if this was a global bug with all thermostats or specific to my device, so I chose to just duplicate the switch and pass the matching value for the capability. Supporting topic/capability thermostat and thermostatMode

Output from the smartthings cli. `Capabilities: ┌───┬─────────────────────────────┐ │ 1 │ switch │ │ 2 │ temperatureMeasurement │ │ 3 │ thermostatCoolingSetpoint │ │ 4 │ healthCheck │ │ 5 │ relativeHumidityMeasurement │ │ 6 │ thermostatMode │ │ 7 │ refresh │ └───┴─────────────────────────────┘ ? Enter capability index or id 6

Commands: ┌───┬───────────────────────────────────────────────────────────────────────┐ │ 1 │ heat() │ │ 2 │ auto() │ │ 3 │ setThermostatMode(mode<enum {asleep, auto, autowitheco, autowithreset │ │ │ autochangeover, autochangeoveractive, autocool, autoheat │ │ │ auxheatonly, auxiliaryemergencyheat, away, cool, custom │ │ │ dayoff, dryair, eco, emergency heat, emergencyheat │ │ │ emergencyheatactive, energysavecool, energysaveheat, fanonly │ │ │ frostguard, furnace, heat, heatingoff, home, in, manual │ │ │ moistair, off, out, resume, rush hour, rushhour, schedule │ │ │ southernaway}>) │ │ 4 │ cool() │ │ 5 │ emergencyHeat() │ │ 6 │ off() │ └───┴───────────────────────────────────────────────────────────────────────┘`

Error from previous code. When trying to inject a change to the device. topic = thermostatMode payload = {"value":"dryair"}

`qs:
body:

19 Jun 20:21:05 - [error] [smartthings-node-thermostat:Mr cool(thermostatMode)] Error updating device
19 Jun 20:21:05 - [error] [smartthings-node-thermostat:Mr cool(thermostatMode)] StatusCodeError: 422 - {"requestId":"[redacted]","error":{"code":"ConstraintViolationError","message":"The request is malformed.","detai ls":[{"code":"NotValidValue","target":"commands[0].capability","message":"thermostat is not a valid value.","details":[]}`

shawner18 commented 2 years ago

I have confirmed this works with my device after making the change.