Page 1 of 4

Binding to Domoticz

Posted: Thu 24 Sep 2015, 10:59
by fergalom
Binding to Domoticz Home automation system based on Gorans Fibaro Binding code.

Creates and updates user variables in Domoticz which can be used further to give indication of alarm status or drive the events based system.

https://github.com/fergalom/node-spc-domoticz-binding

Re: Binding to Domoticz

Posted: Wed 30 Sep 2015, 08:47
by Rena
Excellent! Just what I was looking for!
Does SPC Web Gateway works with the OS that´s bundled with the Domoticz PI-image?
https://www.domoticz.com/wiki/Domoticz_ ... i_SD_Image

Re: Binding to Domoticz

Posted: Wed 30 Sep 2015, 11:38
by fergalom
yes this is what I am using.

Re: Binding to Domoticz

Posted: Wed 30 Sep 2015, 11:44
by Rena
thanks!

Re: Binding to Domoticz

Posted: Sun 11 Oct 2015, 10:45
by littlejoe
Hi, i have some problems installing the SPC Web GW -Domoticz Binding.
i have istalled the SPC Web Gateway and the Domoticz Server on the same Raspberry!
The SPC Web GW works fine and i can send and receive commands to the SPC-Alarm-System.

The Domoticz Web_Interface works fine also, i have configured the Temp Sensor of my Raspi to test the system.

By installing the SPC Binding the command "nmp install" doesnt work. I have got an error log (see att)

Can anyone help me?
Thanks in advance
nmp-debug-log.pdf
(13.88 KiB) Downloaded 1119 times

Re: Binding to Domoticz

Posted: Tue 13 Oct 2015, 17:06
by fergalom
think you need to update node.
I have v0.12.1

Re: Binding to Domoticz

Posted: Mon 09 Nov 2015, 22:19
by thos
Hi,
Have SPC Web Gateway installed and working, but getting some mixed results on this binding to Domoticz

See logs:

Code: Select all

<html><head><title>Bad Request</title></head><body><h1>400 Bad Request</h1></body></html>
Failed to parse reply, expected JSON
Error: socket hang up
Error: socket hang up
Error: socket hang up
Error: socket hang up
Error: socket hang up
{
   "status" : "ERR"
}

{
   "status" : "OK",
   "title" : "UpdateUserVariable"
}

<html><head><title>Bad Request</title></head><body><h1>400 Bad Request</h1></body></html>
Failed to parse reply, expected JSON
<html><head><title>Bad Request</title></head><body><h1>400 Bad Request</h1></body></html>
Failed to parse reply, expected JSON
{
   "status" : "OK",
   "title" : "UpdateUserVariable"
}

{
   "status" : "OK",
   "title" : "UpdateUserVariable"
}

{
   "status" : "OK",
   "title" : "UpdateUserVariable"
}

Error: socket hang up
Error: socket hang up
<html><head><title>Bad Request</title></head><body><h1>400 Bad Request</h1></body></html>
<html><head><title>Bad Request</title></head><body><h1>400 Bad Request</h1></body></html>
<html><head><title>Bad Request</title></head><body><h1>400 Bad Request</h1></body></html>
{
   "status" : "OK",
   "title" : "SaveUserVariable"
}

{
   "status" : "OK",
   "title" : "SaveUserVariable"
I'm then getting some variables through to Domoticz, but not all, and only on first run, not getting any updates.

Is there any limit on zones? I've got 12, but it only seems to load 9.

Running Ubuntu 12.04, Node v0.10.37, Domoticz v2.3552.

Any help appreciated, will take another look tomorrow night to see which calls exactly are failing.

Re: Binding to Domoticz

Posted: Thu 12 Nov 2015, 20:03
by thos
So, I've commented out
//getSpcStatus('zone', handleSpcZoneData);

and it works fine.

Also tried only putting 2-3 Zones through (not the 12 on my system), and this works also, soon as I increase this to 4/5/6 zones I get 400 errors.

So looks like problem is this is pushing too many API calls to Domoticz, quicker than it can handle - in which case some sleep time / delay (or some nice exponential back-off / retry logic) might help.

Re: Binding to Domoticz

Posted: Thu 12 Nov 2015, 20:52
by thos
Have it working with some modification

if (res.statusCode == 400) { /* Create variable if not found */
console.log('400 Error, aborting, waiting and retrying');
setTimeout(function(){
setDomoticzVariable(globalVariableHC2, value)
}, 1000);
req.abort();
return;
}

May not be 100% accurate, but seems to work, I'm new to JS, and this async programming has my head melted.
But now loading 26 variables from SPC Gateway, and updating nicely ..

Re: Binding to Domoticz

Posted: Thu 12 Nov 2015, 21:05
by gol
@thos
Yes, it seems that the Domoticz web server has problem to manage all updates in parallell. Another solution would be to wait for the reply for each update request before sending next request.
Maybee I can help you with an example. But that will be tomorrow.