Hi razberry users,
I'm new to zwave technology, and I'd like your advice about my project :
- I've got a working razberry (installed with access to web interface) and a TrickleStar Remote Control : http://laboutiquededomotique.com/teleco ... -wave.html
- I'd like to use the remote control to generate http requests from the raspberrypi
I've tried different ways to connect the remote control to the razberry, using this remote as the primay controller for example, it seems to work in configuration mode.
But once I pass to operation mode, the remote gives me an error, and I'm not sure where to check the debug on the razberry side (the queue is not showing anything).
What would be your advice to debug this connection issue ? Have you got other advices relative to this project ?
Thanks a lot,
Alex
[Resolved] TrickleStar remote to razberry
[Resolved] TrickleStar remote to razberry
Last edited by alx on 23 Oct 2014 02:04, edited 1 time in total.
Re: TrickleStar remote to razberry
The queue shows only outgoing requests, while you need to see incoming.
The easiest way is to run
in SSH session and see what happens when you're pressing a button on remote.
But I don't like the idea of remote (i.e. portable controller) to be primary one.
The easiest way is to run
Code: Select all
tail -f /var/log/z-way-server.log
But I don't like the idea of remote (i.e. portable controller) to be primary one.
Re: TrickleStar remote to razberry
Thanks pofs for your reply, I'll have a look at the z-way-server.log file.
If you don't like the idea of the remote being the primary controller, how would you configure this setup ? the remote being a secondary controller ?
If you don't like the idea of the remote being the primary controller, how would you configure this setup ? the remote being a secondary controller ?
Re: TrickleStar remote to razberry
Thanks a lot pofs, I've persisted a bit, and found how to make the Tricklestar remote as a secundary controller, and now I'm able to catch events in the logs :
Code: Select all
[2014-10-22 22:46:25.381] RECEIVED: ( 01 08 00 04 04 02 02 27 04 D4 )
[2014-10-22 22:46:25.383] SENT ACK
[2014-10-22 22:46:25.384] SETDATA devices.2.data.lastReceived = 0 (0x00000000)
[2014-10-22 22:46:25.385] Node 2:0 CC SwitchAll: On
[2014-10-22 22:46:25.386] SETDATA devices.2.instances.0.commandClasses.39.data.onOff = True
[2014-10-22 22:46:36.950] RECEIVED: ( 01 08 00 04 04 02 02 27 05 D5 )
[2014-10-22 22:46:36.952] SENT ACK
[2014-10-22 22:46:36.953] SETDATA devices.2.data.lastReceived = 0 (0x00000000)
[2014-10-22 22:46:36.954] Node 2:0 CC SwitchAll: Off
[2014-10-22 22:46:36.955] SETDATA devices.2.instances.0.commandClasses.39.data.onOff = False
Re: [Resolved] TrickleStar remote to razberry
Ok, so now you should bind on change of that onOff value and make requests in the handler.
I believe there's a custom code module in Automation for that, so you can make http.request() call there. Look into dev manual to get more info about accepted parameters to fulfil your needs.
If there's no such a module, it is still quite simple to write the logic:
I believe there's a custom code module in Automation for that, so you can make http.request() call there. Look into dev manual to get more info about accepted parameters to fulfil your needs.
If there's no such a module, it is still quite simple to write the logic:
Code: Select all
var cc = zway.devices[deviceId].instances[0].commandClasses[39];
cc.data.onOff.bind(function(type) {
if (type == 0x01 /* Updated */) {
http.request({ ... });
}
});
Re: [Resolved] TrickleStar remote to razberry
I'm not sure where to place this module.
There's a /opt/z-way-server/automation folder, with a list of modules inside, but the npm install is giving me an error.
There's a /opt/z-way-server/automation folder, with a list of modules inside, but the npm install is giving me an error.
Re: [Resolved] TrickleStar remote to razberry
If you want to create an actual module (for example, take DummyDevice as a base, also refer dev documentation on modules), you might just place a folder with it into userModules folder. It will be automatically available in the modules list after restart.
Otherwise you may just put your code in the end of main.js, but it is not recommended (won't survive updates).
Otherwise you may just put your code in the end of main.js, but it is not recommended (won't survive updates).
Re: [Resolved] TrickleStar remote to razberry
I've tried this piece of code in userModules/RemoteControl/index.js :
This module seems to load after /etc/init.d/z-way-server restart :
But I'm not able to catch the console.log from the script after pressing the remote buttons :
Code: Select all
function RemoteControl (id, controller) {
RemoteControl.super_.call(this, id, controller);
}
inherits(RemoteControl, AutomationModule);
_module = RemoteControl;
RemoteControl.prototype.init = function (config) {
RemoteControl.super_.prototype.init.call(this, config);
var self = this;
var deviceId = 2;
var cc = zway.devices[deviceId].instances[0].commandClasses[39];
cc.data.onOff.bind(function(type) {
console.log('Remote type : ' + type);
if (type == 0x01 /* Updated */) {
http.request({
url: 'http://localhost/record',
method: 'get',
async: true,
success: function(response) {
var data = typeof(response.data) == "object" ? "(" + JSON.stringify(response.data) + ")": response.data.toString();
},
error: function(response) {
console.log("Can not make request: " + response.statusText);
}
});
}
});
};
RemoteControl.prototype.stop = function () {
RemoteControl.super_.prototype.stop.call(this);
};
Code: Select all
[2014-10-23 00:11:50.569] Loading module RemoteControl from userModules/RemoteControl/index.js
[2014-10-23 00:11:50.571] Scheduling execution of file: automation/userModules/RemoteControl/index.js
[2014-10-23 00:11:50.575] Executing script: function RemoteControl (id, controller) { ...
Code: Select all
[2014-10-23 00:12:22.138] RECEIVED: ( 01 08 00 04 04 02 02 27 05 D5 )
[2014-10-23 00:12:22.138] SENT ACK
[2014-10-23 00:12:22.138] SETDATA devices.2.data.lastReceived = 0 (0x00000000)
[2014-10-23 00:12:22.140] Node 2:0 CC SwitchAll: Off
[2014-10-23 00:12:22.142] SETDATA devices.2.instances.0.commandClasses.39.data.onOff = False
[2014-10-23 00:12:33.277] RECEIVED: ( 01 08 00 04 04 02 02 27 04 D4 )
[2014-10-23 00:12:33.278] SENT ACK
[2014-10-23 00:12:33.278] SETDATA devices.2.data.lastReceived = 0 (0x00000000)
[2014-10-23 00:12:33.278] Node 2:0 CC SwitchAll: On
[2014-10-23 00:12:33.278] SETDATA devices.2.instances.0.commandClasses.39.data.onOff = True
Re: [Resolved] TrickleStar remote to razberry
Have you added module.json as well? Don't forget to set appropriate load priority (in case of old HA) or dependency on ZWave (in case of new one).
You also need to enable your module in HA, it is not enabled by default.
You also need to enable your module in HA, it is not enabled by default.