Hoe to disable/enable a timer in a scene from another ??
Moderators: leecollings, remb0
-
- Posts: 12
- Joined: Monday 02 March 2015 14:46
- Target OS: NAS (Synology & others)
- Domoticz version:
- Contact:
Hoe to disable/enable a timer in a scene from another ??
I have a virtual switch in domoticz.. which goes on and off through an json command and with an ios app.
This to tell the system if im home or not.
Now I also have a couple of scenes with an timer in it. (Trigger a bunch of lights 30 minutes before sunset).
How can I create a blocky script or something, that will do the following:
When I am home.. the timer of scene "A" needs to be active.
When I am away, the timer of scene "A" needs to be inactive.
I already have the home and away switch working.. but how to disable/enable a timer within a scene from another switch...
This to tell the system if im home or not.
Now I also have a couple of scenes with an timer in it. (Trigger a bunch of lights 30 minutes before sunset).
How can I create a blocky script or something, that will do the following:
When I am home.. the timer of scene "A" needs to be active.
When I am away, the timer of scene "A" needs to be inactive.
I already have the home and away switch working.. but how to disable/enable a timer within a scene from another switch...
-
- Posts: 115
- Joined: Sunday 11 January 2015 16:40
- Target OS: Raspberry Pi / ODroid
- Domoticz version:
- Contact:
Re: Hoe to disable/enable a timer in a scene from another ??
Why not use a the timer on a virtual switch and use this switch in your blockly to run the scenes?
Re: Hoe to disable/enable a timer in a scene from another ??
The manual shows how to "add a timer to a scene" using json. https://www.domoticz.com/wiki/Domoticz_ ... .2F_Groups
You could use this in combination with your home/away switch. When you're home, you set the timer being "true" and when you're away you set it to "false". I haven't tested this, but I'm just thinking out loud.
You could use this in combination with your home/away switch. When you're home, you set the timer being "true" and when you're away you set it to "false". I haven't tested this, but I'm just thinking out loud.
-
- Posts: 12
- Joined: Monday 02 March 2015 14:46
- Target OS: NAS (Synology & others)
- Domoticz version:
- Contact:
Re: Hoe to disable/enable a timer in a scene from another ??
cause the scene allows me easier access to 30 minutes before sunset instead of @ sunset.RayAmsterdam wrote:Why not use a the timer on a virtual switch and use this switch in your blockly to run the scenes?
-
- Posts: 12
- Joined: Monday 02 March 2015 14:46
- Target OS: NAS (Synology & others)
- Domoticz version:
- Contact:
Re: Hoe to disable/enable a timer in a scene from another ??
mrf68 wrote:The manual shows how to "add a timer to a scene" using json. https://www.domoticz.com/wiki/Domoticz_ ... .2F_Groups
You could use this in combination with your home/away switch. When you're home, you set the timer being "true" and when you're away you set it to "false". I haven't tested this, but I'm just thinking out loud.
Nice thanks, ill try this one this weekend; This can work in more than 1 way
-
- Posts: 3
- Joined: Wednesday 25 November 2015 20:16
- Target OS: Raspberry Pi / ODroid
- Domoticz version:
- Contact:
Re: Hoe to disable/enable a timer in a scene from another ??
I stumbled upon this thread when searching for a solution of the problem described. By browsing through the sourcecode, I found this simple solution of doing json calls to enable/disable the scenetimer (where you simply provide the scenetimer identifier which you can find e.g., by checking the action linked to the 'update' button after selecting the scenetimer in the domoticz gui (it says javascript:UpdateTimer(<scenetimeridx>)):
http://server:port/json.htm?type=command¶m=enablescenetimer&idx=scenetimeridx
http://server:port/json.htm?type=command¶m=disablescenetimer&idx=scenetimeridx
This can be done via any script that can be called on the appropriate event.
It's not listed on https://www.domoticz.com/wiki/Domoticz_ ... of_a_scene, but does work like a charm.
http://server:port/json.htm?type=command¶m=enablescenetimer&idx=scenetimeridx
http://server:port/json.htm?type=command¶m=disablescenetimer&idx=scenetimeridx
This can be done via any script that can be called on the appropriate event.
It's not listed on https://www.domoticz.com/wiki/Domoticz_ ... of_a_scene, but does work like a charm.
-
- Posts: 374
- Joined: Friday 23 May 2014 7:55
- Target OS: Linux
- Domoticz version: 2022.1
- Location: Saint Pierre de Jards
- Contact:
Re: Hoe to disable/enable a timer in a scene from another ??
For the "regular timers" I use this command is a bash script that works as well
Code: Select all
curl --silent $IPADDRESS:$PORT'/json.htm?type=command¶m=enabletimer&idx=idxvalue' > /dev/null
Debian buster on NUC and three RPi with buster.
Re: Hoe to disable/enable a timer in a scene from another ??
You could use a variable as part of a script to check if home = true or false
-
- Posts: 36
- Joined: Thursday 03 August 2017 15:44
- Target OS: Raspberry Pi / ODroid
- Domoticz version:
- Contact:
Re: Hoe to disable/enable a timer in a scene from another ??
Hi,
does someone know how to disable/enable ALL times of a scene/group in the same time ?
With the index of the scene.
I am able to disable/enable a timer from a scene but I want to disable/enable all in the same time with only one http command. (to write in a NFC tag)
Is it possible?
thanks.
does someone know how to disable/enable ALL times of a scene/group in the same time ?
With the index of the scene.
I am able to disable/enable a timer from a scene but I want to disable/enable all in the same time with only one http command. (to write in a NFC tag)
Is it possible?
thanks.
- philchillbill
- Posts: 396
- Joined: Monday 12 September 2016 13:47
- Target OS: Linux
- Domoticz version: beta
- Location: Eindhoven. NL
- Contact:
Re: Hoe to disable/enable a timer in a scene from another ??
I use the following perl script which is run when the virtual home/away dummy switch is set, using the script://timers.pl construct. It bulk enables/disables all the timers it finds (except those on an ignore list) but you might be able to modify it to just do the idx'es in your scene:
Code: Select all
#!/usr/bin/perl
use JSON::XS;
use LWP::UserAgent;
no warnings 'uninitialized';
# Queries timers within Domoticz and bulk-enables/disables them depending on whether 0 or 1 is passed when executing
# Any idx values in the hash '%ignore' are skipped. If $debug is set to 1 the script provides feedback when run from command line
$what=$ARGV[0];
unless (defined ($what)) { print "No parameter supplied, exiting. ($what)\n"; sleep 2; exit 0 };
if ($what == 1) { $action = 'enabletimer' } else { $action = 'disabletimer' };
$debug=0;
# get the list of scheduled timers into a hash
$domo_url='http://192.168.178.12:8080';
$ua=LWP::UserAgent->new; $ua->timeout(5);
$scheds=$domo_url.'/json.htm?type=schedules';
$response=$ua->get($scheds);
unless ($response->is_success) { warn "Error getting schedule data from Domoticz $response->status_line" };
$schedules=$response->decoded_content;
$jdata=decode_json $schedules;
%ignore = ( '38' => 1, '39' => 1 );
# loop through the timers and enable/disable them. Only idx is strictly needed, the others are for feedback
foreach $entry (@{$$jdata{result}}) {
$name=$$entry{DevName};
$time=$$entry{Time};
$type=$$entry{TimerTypeStr};
$idx=$$entry{TimerID};
$cmd=$$entry{TimerCmd};
if ($ignore{$idx}) { next };
$c++; $c=sprintf("%02d", $c);
print "\[$c\] $name -- $type -- $time -- $cmd -- idx: $idx\n" if ($debug);
$set_schedule=$domo_url."/json.htm?type=command¶m=$action&idx=$idx";
$response=$ua->get($set_schedule);
unless ($response->is_success) { warn "Error performing '$action' $response->status_line" };
Alexa skills author: EvoControl, Statereport, MediaServer, LMS-lite
-
- Posts: 36
- Joined: Thursday 03 August 2017 15:44
- Target OS: Raspberry Pi / ODroid
- Domoticz version:
- Contact:
Re: Hoe to disable/enable a timer in a scene from another ??
thank you philchillbill
I will try your script later
I will try your script later
-
- Posts: 3
- Joined: Tuesday 06 March 2018 16:33
- Target OS: Windows
- Domoticz version:
- Contact:
Re: Hoe to disable/enable a timer in a scene from another ??
SOLVED
hello everyone.
I'll would like to share with you have I solved in my system (Raspbian+domoticz v4.97).
I have very low programmings skills, so probably I'm missing something, so all comments are welcomed
Before start playing with physical devices, I tried with Virtual devices for testing:
After a couple of tests, it worked!!
hello everyone.
I'll would like to share with you have I solved in my system (Raspbian+domoticz v4.97).
I have very low programmings skills, so probably I'm missing something, so all comments are welcomed
Before start playing with physical devices, I tried with Virtual devices for testing:
- I've created 2 dummy switches, and 1 Scene and 1 Blockly Event.
- For the trigger, I've created a dummy switch called: Fuera de Casa (Out of home)
- The device to be controlled by the scene: I've created a second dummy switch called: Deteccion Jardin (Garden's Detector)
- I've created a scene called: test, I have added the device/swicth 'Deteccion Jardin', and I've added a Timmer: type 'On' & 'On time' & 'everyday'. For the time, in order to see if the script works, I've just taken the current time and I've added +4 minutes.
- Then I have added the witches and scene in the Dashboard to see better the interaction between them.
- Finally I did à simple Blockly script which I named it Test, and i said:
After a couple of tests, it worked!!
Who is online
Users browsing this forum: No registered users and 1 guest