Skip to content
This repository has been archived by the owner on Feb 20, 2024. It is now read-only.

WiFi Thermostat - Setting Temp #3

Open
ninoz opened this issue May 25, 2016 · 1 comment
Open

WiFi Thermostat - Setting Temp #3

ninoz opened this issue May 25, 2016 · 1 comment

Comments

@ninoz
Copy link

ninoz commented May 25, 2016

Hi

Firstly thanks for the work you have put into this.

I can use the module to call data from the WiFi Thermostat okay, however when I try and set a temp i get the following error:

/usr/local/lib/node_modules/heatmiser/lib/wifi.js:173
                this.emit( 'error', e );
                    ^

TypeError: Cannot read property 'emit' of undefined
    at /usr/local/lib/node_modules/heatmiser/lib/wifi.js:173:21
    at Wifi.<anonymous> (/usr/local/lib/node_modules/heatmiser/lib/wifi.js:132:13)
    at emitOne (events.js:77:13)
    at Socket.emit (events.js:169:7)
    at readableAddChunk (_stream_readable.js:146:16)
    at Socket.Readable.push (_stream_readable.js:110:10)
    at TCP.onread (net.js:523:20)

and my test file is:

var heatmiser = require('/usr/local/lib/node_modules/heatmiser/');
var hm = new heatmiser.Wifi('172.**.**.100', ****);
var dcb;

hm.on('success', function(data) {
  console.log(data);
});
hm.on('error', function(data) {
  console.log(data);
});

hm.read_device(); //this runs okay
dcb = {
  heating: {
    target: 20, // C
    hold: 30 // minutes
  }
}
hm.write_device(dcb);

Many Thanks

@ninoz
Copy link
Author

ninoz commented May 25, 2016

i found that by settings this.model = "PRTHW" within the Wifi.prototype.write_device seemed to fix it, ill look into the error a little later

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant