• # [Solved] timer question

i have two buttons and i want to connect a timer to each of the buttons. Something like when i press button a then at 0500 turn on light a and if i should press button b then at 0600 turn on light a. So to make it more clear, the 2 buttons are just there to set other another time for the lights to go on. Maybe you guys could help me

• You will have to use rules and a buttons device.

pimatic v0.9 has been released!
Support Pimatic and get some free stickers

make it so !

• Thank you for the quick response but what i wanted is that when i go to sleep at night i push one of the two buttons and if i push button A then my coffeemachine will turn on at 5.00 in the morning. And on another day: if i go to sleep and i would push button B then my coffeemachine will turn on at 7.00 in the morning.

• Yes sorry, got that wrong…

pimatic v0.9 has been released!
Support Pimatic and get some free stickers

make it so !

• No problem

• I would create two Variables for each Button. The variable will be true when the Button pressed.
And after this i would create the rule "(is Variable1 = 1 and its 5:00 o’clock then Light on) or (is Variable 2 = 1 and its 7:00 o’clock then light on)"
You can reset the variable with: “(Its 5:05 o’clock and Variable1 = 1) or (Variable 2 = 1 and its 7:05 o’clock) then change Variable 1 and Variable 2 = 0”

Button A Pressed:
if Button A pressed then set variable1 to 1 and set variable2 to 0

Button B Pressed:
if Button A pressed then set variable2 to 1 and set variable1 to 0

Rule Light on Variable:
[“variable1” = “1” and its 05:00] or [“variable2” = “1” and its 07:00] then light on

Rule reset Variable1 and 2 :
[“variable1” = “1” and its 05:05] or [“variable2” = “1” and its 07:05] then set Variable1 to 0 and then set Variable2 to 0

You need only a rule to reset the light on. Another button or a Signal/Time or something.

• You can do it with tasker and an alarm of your phone. Tasker will send it automaticly to pimatic and then pimatic makes what you want.
So when your alarm goes on 05:00 pimatic will turn on your coffemashine. If your alarm is 7:00, mashine goes on at 07:00. I use it to turn on my radio after i wake up.

It works perfect i can every day set up a new time. And it works exactly on that time.

• thank you ck2003. that did the trick i was a little afraid to use the variables but it worked. now lets see if i got some coffee tomorrow morning. thanks

• @dyo No, Problem! I hope your coffee was hot this morning!

• yes, please report back so i can set this issue to solved.

pimatic v0.9 has been released!
Support Pimatic and get some free stickers

make it so !

• @ck2003
Hi,
I am interested for this option with button and variable to turn rules. Unfortunately I can not continue with the implementation. Could you post me the relevant sections of the config? So that i can rework for me.

"Really, I'm not out to destroy Microsoft. That will just be a completely unintentional side effect." 09-28-2003, LINUS TORVALDS (http://www.nytimes.com)

• @Thrusty said:
hey,

you can add buttons under the device section in the config:

``````{
"id": "swtest",
"name": "buttons",
"class": "ButtonsDevice",
"buttons": [
{
"id": "button-a",
"text": "Button-A"
},
{
"id": "button-b",
"text": "Button-b"
}
]
}
``````

On your Webinterface from pimatic, you can add Variables and the Rules. When you add them under the Webinterface, they will get in the Config automatically.

If Buttons not work, you can use the DummySwitch. But you must reset the Switches with the Variables too.

• @ck2003
My problem is that I know too little about scripts, programming, etc. have. I dont know, for example, wich arguments shoulb be on wich position items to need for linking a variable with a button. I hope you understand me.
With a exemple, i can change the entrys for my system.

"Really, I'm not out to destroy Microsoft. That will just be a completely unintentional side effect." 09-28-2003, LINUS TORVALDS (http://www.nytimes.com)

• @ck2003 said:
Add this to the device section in the config.json

{
“id”: “swtest”,
“name”: “buttons”,
“class”: “ButtonsDevice”,
“buttons”: [
{
“id”: “button-a”,
“text”: “Button-A”
},
{
“id”: “button-b”,
“text”: “Button-b”
}
]
}

After this, you do that:

On the Webinterface add two Variables:

Example:
variable1
and
variable2

Then Create rules on the Website:

Rule1:
Name: Button A Pressed
if Button A pressed
then set variable1 to 1 and set variable2 to 0

Rule2:
Name: Button B Pressed
if Button B pressed
then set variable2 to 1 and set variable1 to 0

Rule3:
Name: Light on Variable:
[\$variable1 = 1 and its 05:00] or [\$variable2 = 1 and its 07:00]
then light on

Rule4:
Name: Reset Variable1 and 2 :
[\$variable1 = 1 and its 05:05] or [\$variable2 = 1 and its 07:05] then set Variable1 to 0 and then set Variable2 to 0

You need only a rule to reset the light on. Another button or a Signal/Time or something.

• @ck2003 first thanks.
Is a entry in variable section in config not necessary?

"Really, I'm not out to destroy Microsoft. That will just be a completely unintentional side effect." 09-28-2003, LINUS TORVALDS (http://www.nytimes.com)

• @ck2003 said:
When you add them under the Webinterface, they will get in the Config automatically. The Rules also.

• @ck2003 oh, nice. I will test it. Thanks

"Really, I'm not out to destroy Microsoft. That will just be a completely unintentional side effect." 09-28-2003, LINUS TORVALDS (http://www.nytimes.com)

• @Thrusty
No Problem. When you have Problems, you can ask everytime

• @ leader 21 the issue is solved perfectly. and @ck2003 the coffee was nicely hot the last few days, i have made an extra rule with it so the variable is set to 0 when i am done with my coffee though.

but thanks guys for the help

dyo

• @dyo

Sounds great!

Posts 20Views 8855

Looks like your connection to pimatic forum was lost, please wait while we try to reconnect.