skydiver / ewelink-api

eWeLink API for JavaScript
https://www.npmjs.com/package/ewelink-api
MIT License
267 stars 108 forks source link

Toggle auto/manual, and setpoints, on a Sonoff TH10? #81

Open JohnMurfett-Iedex opened 4 years ago

JohnMurfett-Iedex commented 4 years ago

Is it possible to toggle a TH10 between auto and manual using this API? Is it possible to alter the set points?

I don't think it is, and I would like to offer to alter code a new mixin mixins/temphumd/setTHMixin.js, based on the way it is done in setDevicePowerStateMixin.js.

The Sonoff TH10 is supported by your API, and the device.productModel==='Sonoff THS' identifies this type of device. The TH10 can be a manual switch, or an automatic heating/cooling controller by turning on and off at configurable temperature set points. The response from getDevice on a Sonoff TH10 temperature humidity sensor contains params.deviceType==='temperature' if the TH10 is in Auto, and params.deviceType='normal' if the TH10 is in Manual. The set points are also returned as an array of objects in params.targets:

  { targetHigh: '10', reaction: { switch: 'off' } },
  { targetLow: '8', reaction: { switch: 'on' } }
]

Am I correct to say the API does not presently allow setting the auto/manual mode and setpoints? Would you be open to this me developing this change?