A clever switch

Discussions about RaZberry - Z-Wave board for Raspberry computer
SolarFlor
Posts: 261
Joined: 22 Mar 2014 15:23

A clever switch

Post 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
SolarFlor
Posts: 261
Joined: 22 Mar 2014 15:23

Re: A clever switch

Post by SolarFlor »

Any good guy to support?
User avatar
PoltoS
Posts: 7649
Joined: 26 Jan 2011 19:36

Re: A clever switch

Post 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.
SolarFlor
Posts: 261
Joined: 22 Mar 2014 15:23

Re: A clever switch

Post 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
SolarFlor
Posts: 261
Joined: 22 Mar 2014 15:23

Re: A clever switch

Post by SolarFlor »

I cannot believe there is nobody availabe to support. Really the real scope of any forums is to support each other.
User avatar
PoltoS
Posts: 7649
Joined: 26 Jan 2011 19:36

Re: A clever switch

Post 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)
SolarFlor
Posts: 261
Joined: 22 Mar 2014 15:23

Re: A clever switch

Post 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
User avatar
PoltoS
Posts: 7649
Joined: 26 Jan 2011 19:36

Re: A clever switch

Post 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
SolarFlor
Posts: 261
Joined: 22 Mar 2014 15:23

Re: A clever switch

Post 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?
pz1
Posts: 2053
Joined: 08 Apr 2012 13:44

Re: A clever switch

Post by pz1 »

It is located in z-way/automation/modules/BatteryPolling on your RaspPi
Since 29-12-2016 I am no longer a moderator for this forum
Post Reply