- Place every second a status request call via OpenRemoteHelpers module
- Use setInterval as Custom Java script
Code: Select all
/JS/Run/setInterval(function(){ zway.devices[2].Basic.Get(); } ,1000);
Old Düwi wall plug polling
Old Düwi wall plug polling
I have this old Düwi wall plug that does not send unsolicited status updates. For usage with OpenRemote there are two things I can do:
Since 29-12-2016 I am no longer a moderator for this forum
Re: Old Düwi wall plug polling
Sure setInterval() is preferred one, because it doesn't involve network interaction overhead (request parsing, native->js->native data transfer etc.)
Re: Old Düwi wall plug polling
Thanks, that's what I thought. I'll add this bit of information to the UPD Recipe
Since 29-12-2016 I am no longer a moderator for this forum
Re: Old Düwi wall plug polling
Hmmmmm, I am biting myself in the tail with this one
Every time I do a "Get()" it results in an event. This event does trigger a status update to be send with my UDP module. As a result CPU raising from a modest 5% to 25-40%. For this one I'll revert to good old polling. For its intended use, a low refresh rate is not a real problem.

Since 29-12-2016 I am no longer a moderator for this forum
Re: Old Düwi wall plug polling
There's a type arg in callback. If it has PhantomUpdate bit set, you shouldn't really send status update, because value has not changed 

Re: Old Düwi wall plug polling
Took me a while to find information about PhantomUpdate as it is not in the Developers Document, and the search function of this forum apparantly does not search inside code blocks. Anyhow I found this post about TKB switches.pofs wrote:There's a type arg in callback. If it has PhantomUpdate bit set, you shouldn't really send status update, because value has not changed
That describes a different situation I think. I don't know how/where to use that type in my function
Here?
Code: Select all
/JS/Run/setInterval(function(){
zway.devices[2].Basic.Get();
} ,1000);
Code: Select all
zway.devices[4].instances[0].SwitchBinary.data.level.bind(function()
{
var status = (this.value) ? "on" : "off";
system("/opt/z-way-server/automation/storage/status.sh", "ZWay_4," + status ) ;
} );
Since 29-12-2016 I am no longer a moderator for this forum
Re: Old Düwi wall plug polling
The latter one, as type arg is only available in bind callback.
But unlike the linked post, where only phantom updates were used, you should use only real ones:
Of course, it will create some overhead, but not that big as calling shell script
But unlike the linked post, where only phantom updates were used, you should use only real ones:
Code: Select all
zway.devices[4].instances[0].SwitchBinary.data.level.bind(function(type)
{
if (type !== 1) return; // handle only real updates
var status = (this.value) ? "on" : "off";
system("/opt/z-way-server/automation/storage/status.sh", "ZWay_4," + status ) ;
});
Re: Old Düwi wall plug polling
Thanks, I'll give it a try.pofs wrote:Of course, it will create some overhead, but not that big as calling shell script
Result will go to Recipe on UPD status push
Since 29-12-2016 I am no longer a moderator for this forum
Re: Old Düwi wall plug polling
I had to make a block code after the if:pofs wrote:The latter one, as type arg is only available in bind callback.
But unlike the linked post, where only phantom updates were used, you should use only real ones:Code: Select all
zway.devices[4].instances[0].SwitchBinary.data.level.bind(function(type) { if (type !== 1) return; // handle only real updates var status = (this.value) ? "on" : "off"; system("/opt/z-way-server/automation/storage/status.sh", "ZWay_4," + status ) ; });
Code: Select all
zway.devices[4].instances[0].SwitchBinary.data.level.bind(function(type)
{
if (type !==1){
return;
}
var status = (this.value) ? "on" : "off";
system("/opt/z-way-server/automation/storage/status.sh", "ZWay_4," + status ) ;
} );
Since 29-12-2016 I am no longer a moderator for this forum
Re: Old Düwi wall plug polling
My system is aware of all the nodes (and their classes) and periodically (once a minute) does automated *.Get() for all classes on a white-list, for all mains devices.
Battery device's have their *.Get() done on wake instead.
Maybe you could do something similar with just javascript?
Battery device's have their *.Get() done on wake instead.
Maybe you could do something similar with just javascript?
Using BMSLink https://linode.bmslink.co.uk with z-way-server. http://linode.bmslink.co.uk:4567