Page 1 of 2
A clever switch
Posted: 21 Apr 2014 10:33
by SolarFlor
Dear all,
someone could teach me on how to make my plug a bit more clever?
I would like to write my first code (js or php) to instruct my plug to turn off automatically when the power meausered by the plug itself is higher (or lower) than a threshold.
.. or after a certain time it is turned on.
Many thanks for your help.
Ciao
Re: A clever switch
Posted: 29 Apr 2014 22:33
by SolarFlor
Any good guy to support?
Re: A clever switch
Posted: 01 May 2014 02:42
by PoltoS
zway.devices[N].Meter.data.val.bind(function() { if (this.level > X) zway.devices[N].SwitchBinary.Set(0) });
Check for correct dataholder name, scale S, device id N and value X.
Re: A clever switch
Posted: 01 May 2014 11:39
by SolarFlor
Hi PoltoS,
please give me some more 'low level' details. I'm really a beginners.
Where I should write the code you suggested me? in which file?
Need to have few examples so that I could understand and personalise them.
For example I have installed a Micro Switch device to turn off the Television of my dauther that is usually leaving on it during the night.
To do that I wrote a small php script (switchoff.php)
Code: Select all
<?php
$result = file_get_contents('http://192.168.1.22:8083/ZAutomation/OpenRemote/SwitchBinaryOff/5/0');
?>
and I have added this line on my crontab:
Code: Select all
0 0-04 * * * /usr/bin/php /var/www/123solar/scripts/switchoff.php
Now, starting from midnight till 4AM, the system switch off the tv every hour, in the hopeness that after 4 AM she is sleepping.
I'm sure this is not the clever way to use Z-Way. What would have been the right approach to do it?
Please send me some few detailed examples so I can learn by doing.
Ciao
Re: A clever switch
Posted: 03 May 2014 13:14
by SolarFlor
I cannot believe there is nobody availabe to support. Really the real scope of any forums is to support each other.
Re: A clever switch
Posted: 06 May 2014 22:21
by PoltoS
does this works in your browser?
http://192.168.1.22:8083/ZAutomation/Op ... aryOff/5/0
does the script runs by cron (check cron logs)
Re: A clever switch
Posted: 08 May 2014 18:06
by SolarFlor
Yes it woks very well but I wonder I'm not using all the potentialities of the Z-Way system. I'm sure I could do the same using some of the existing Modules or Rules. If you give me some examples I will start to study them.
Another problem I have is related to the status of the Aeolabs Micro Switch. When I open Expert UI I see the swith not updated and I need to push the button 'Update' on Device Control to update it.
Is there any special setting I should do?
Many Thanks again for you support
Re: A clever switch
Posted: 09 May 2014 01:13
by PoltoS
Associate it with Z-Way. But some switches forgets to report correct value in correct channel, so no way to fix it without a hack. We think on making a module to make the hack
Currently we have no scheduler module to do what you want, but it is very easy to make based on BatteryPolling device. I've added it to our with list
Re: A clever switch
Posted: 10 May 2014 16:28
by SolarFlor
PoltoS wrote:Currently we have no scheduler module to do what you want, but it is very easy to make based on BatteryPolling device. I've added it to our with list
Could you post any exampe of BatteryPolling?
Re: A clever switch
Posted: 10 May 2014 18:19
by pz1
It is located in z-way/automation/modules/BatteryPolling on your RaspPi