-
-
Notifications
You must be signed in to change notification settings - Fork 345
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Scheduling Goldair Wifi controllable Heaters using tuyapi #31
Comments
This is great, thanks for your work. See this comment for details, but eventually when TuyAPI gets split up I'd love it if you published a package for controlling heaters using TuyAPI as a dependency. The more device-specific community packages the better. |
Also, did you have to modify |
No modification of requests.json was required. |
Huh, interesting. |
I have managed to get one of these heaters working on Homebridge by essentially adding it as a power outlet using the homebridge-tuya-outlet plugin. Now I can turn it on and off through my home app, or ask Siri to turn it on and off. Any suggestions on how I might add other functionality? For me, the most used functions would be turning the heater on and off (done), turning the LED on and off, and checking the room temperature. It would be great to do this all in one HomeKit "device", but would be equally useful to have three separate devices: heater (fan), led (light) and temperature (sensor). |
I would suggest you make a custom Homebridge plugin for your heater. The gist of the process:
// -- Common to all accessories:
module.exports = function(homebridge) {
Service = homebridge.hap.Service;
Characteristic = homebridge.hap.Characteristic;
//...
// params: plugin name, accessory name, accessory constructor
// call .registerAccessory for each parameter you want to control
homebridge.registerAccessory("homebridge-tuya-heater", "TuyaHeaterTemperature", TuyaHeaterTemperature);
//...
}
// -- End common code
//...
function TuyaHeaterTemperature(log, config) {
// create a tuya instance
// ...
this._service = new Service.TemperatureSensor(this.name);
this._service.getCharacteristic(Characteristic.CurrentTemperature).on('get', this._get.bind(this));
}
TuyaHeaterTemperature.prototype._get = function(callback) {
debug("Getting temperature...");
this.tuya.get({schema: true}).then(data => {
debug("Data", data); // <- figure out the right DIP
return callback(null, data.dip.2);
}).catch(error => {
callback(error, null);
});
}
Find supported characteristics and services here. Hopefully you can figure it out from there. |
Awesome, thanks! I am going to have a play with this over the next few weeks. If I’m successful I’ll share it. |
@TarxBoy thanks for this it looks interesting. Are you happy share a complete (without keys etc) file that can be used to control the heater? I have got my uuid, productID and localKey however am having trouble doing any basic control. I'm trying to get the minimum amount to turn heater on/off to start with but the following does not work (running as I get the error Any ideas?
|
@charlietomo please see the docs on tuya.set({dps: 1, set: false}).then(() => console.log('heater was turned off')); |
Thanks. It was the rest of the code I was struggling with but got it to work. Full code:
|
Glad to hear you got it working @charlietomo. I realize now that your issue was that you didn't pass in an IP or call I've added a check which throws an error if the IP is missing. |
@codetheweb that check sounds useful. You are right, it was the missing IP / resolveID which was the main issue, but not apparent to me. @deiphid I am also interested in a home bridge plugin so please update this thread if you make progress. I am actually more interested in a Home Assistant plugin, and then would expose it to homebridge (and iOS Home) that way. |
While not strictly related to this repo, I've developed an initial Home Assistant integration (made possible by the awesome research done in this thread). It needs specs and a few more features (eg, adding extra sensors and supporting power levels) but it's working well as a climate device and is robust enough for automation. https://github.com/nikrolls/homeassistant-goldair-heater // @charlietomo who specifically mentioned HA |
Amazing @nikrolls that looks great. Will test it on my heaters / HA setup. Thanks in advance for the work you put into this. |
I have found that the homebridge-igenix-air-conditioner plugin works for these heaters. The plugin provides on/off, current temp, and target temp functionality. I am going to see if I can figure out a way to add control of the led screen, and maybe tailor the plugin towards a heater rather than an air conditioner. |
Just another heads-up: for those using Home Assistant, my integration now also supports the LED light, child lock, a standalone temperature sensor, and manual power levels. Now I'm working on official integration into the core so it can work on hass.io and HassOS. |
Closing this because of inactivity. |
Firstly, I love the work you have done with the tuyapi library.
I am using tuyapi library with these Goldair Wifi controllable heaters http://www.goldair.co.nz/product-catalogue/heating/panel-heaters which I found use the Tuya IOT framework. The mobile app annoyingly does not have a schedule feature - only a simple timer you have to set every day. I have implemented my own schedule using crontab running on a Raspberry Pi.
Here are some notes on how I got this working.
Device Encryption Key discovery is done by finding these in the mobile app log file.
Heater Settings
Code snippet of scheduling (crontab calls this with a scene param)
Extension to device set method to allow multiple settings to be changed at one time
I hope this helps.
The text was updated successfully, but these errors were encountered: