rule to set GPIO output high/low for 30s

587 views
Skip to first unread message

Petr Jakes

unread,
Oct 9, 2021, 4:10:36 PM10/9/21
to TasmotaUsers
using tasmota 9.5.0

I would like to set the one of the GPIOs high for 30s when the Power1#State changes.
  1. I can not find the way how to set the GPIO as an output (it the "configure template" I can not find such an option, only LED looks usable but I did not try it)
  2. I do not know how to set GPIO high in the rule 
    ON Power1#state DO RuleTimer1 30 ENDON
    ON Rules#Timer=1 DO ????? ENDON
Thks for your kind help

Philip Knowles

unread,
Oct 9, 2021, 11:16:02 PM10/9/21
to Petr Jakes, TasmotaUsers
A Relay is an output but use PulseTime or Blink.
Power1#State is responding to the change in state of Relay1.

Regards

Phil K


From: sonof...@googlegroups.com <sonof...@googlegroups.com> on behalf of Petr Jakes <petr.ja...@gmail.com>
Sent: Saturday, October 9, 2021 9:10:36 PM
To: TasmotaUsers <sonof...@googlegroups.com>
Subject: rule to set GPIO output high/low for 30s
 
--
You received this message because you are subscribed to the Google Groups "TasmotaUsers" group.
To unsubscribe from this group and stop receiving emails from it, send an email to sonoffusers...@googlegroups.com.
To view this discussion on the web, visit https://groups.google.com/d/msgid/sonoffusers/638e1644-d249-4888-928c-117c1172c6can%40googlegroups.com.

Philip Knowles

unread,
Oct 9, 2021, 11:17:21 PM10/9/21
to Petr Jakes, TasmotaUsers
BTW don't use Template use Configure Module
From: Philip Knowles <knowles...@gmail.com>
Sent: Sunday, October 10, 2021 4:15:58 AM
To: Petr Jakes <petr.ja...@gmail.com>; TasmotaUsers <sonof...@googlegroups.com>
Subject: Re: rule to set GPIO output high/low for 30s
 

Petr Jakes

unread,
Oct 10, 2021, 2:28:47 AM10/10/21
to Philip Knowles, TasmotaUsers
Thanks for the answer, Phil,

Maybe I was not clear enough in the description of my problem.

  • I have Relay defined on the GPIO2 (Power1)
  • I would like to set the GPIO4 High for 30 seconds when Power1 toggles (I have another device connected to the GPIO4) and then set it back to Low
Thks




Philip Knowles

unread,
Oct 10, 2021, 2:53:13 AM10/10/21
to Petr Jakes, TasmotaUsers

In Configure Module (not template) set GPIO4 as Relay2. Then set BlinkCount 1 and BlinkTime 300

Advantage of Blink is can use output normally by using power2 1 or 0 or getting it to pulse by using power2 3

If you want it to pulse only when power1 comes on

Rule1

On power1#state=1 do power2 3 endon

If you want it to pulse on every change of state

Rule1

On power1#state do power2 3 endon

 

Bear in mind that you may need to set GPIO4 as Relay2i depending on what the GPIO is driving – relay boards often go low to turn them on.

 

Regards

 

Phil K

 

Sent from Mail for Windows

 

From: Petr Jakes
Sent: 10 October 2021 07:28
To: Philip Knowles
Cc: TasmotaUsers
Subject: Re: rule to set GPIO output high/low for 30s

 

Thanks for the answer, Phil,

 

Maybe I was not clear enough in the description of my problem.

 

  • I have Relay defined on the GPIO2 (Power1)
  • I would like to set the GPIO4 High for 30 seconds when Power1 toggles (I have another device connected to the GPIO4) and then set it back to Low

Thks

 

 

 

 

 

On Sun, Oct 10, 2021 at 5:16 AM Philip Knowles <knowles...@gmail.com> wrote:

A Relay is an output but use PulseTime or Blink.

Power1#State is responding to the change in state of Relay1.

Regards

Phil K

 

From: sonof...@googlegroups.com <sonof...@googlegroups.com> on behalf of Petr Jakes <petr.ja...@gmail.com>
Sent: Saturday, October 9, 2021 9:10:36 PM
To: TasmotaUsers <sonof...@googlegroups.com>
Subject: rule to set GPIO output high/low for 30s

 

using tasmota 9.5.0

 

I would like to set the one of the GPIOs high for 30s when the Power1#State changes.

  1. I can not find the way how to set the GPIO as an output (it the "configure template" I can not find such an option, only LED looks usable but I did not try it)
  2. I do not know how to set GPIO high in the rule 
    ON Power1#state DO RuleTimer1 30 ENDON
    ON Rules#Timer=1 DO ????? ENDON

Thks for your kind help

 

Petr Jakes

unread,
Oct 10, 2021, 3:19:01 AM10/10/21
to Philip Knowles, TasmotaUsers
I was experimenting with a second relay. With this approach I get two buttons in the web GUI which I do not want.

And yes, I need the GPIO4 High for 30 seconds when GPIO2 (Power1) toggles.

Petr

Philip Knowles

unread,
Oct 10, 2021, 4:13:21 AM10/10/21
to Petr Jakes, TasmotaUsers
The webui isn't really for control just for configuration.
You could try assigning LED1 to GPIO4.
Then
On power1#state do backlog ledpower1 1;delay 300;ledpower1 0 endon
But it's a fudge and may have unexpected results.

Regards

Phil K






From: Petr Jakes <petr.ja...@gmail.com>
Sent: Sunday, October 10, 2021 8:18:46 AM
To: Philip Knowles <knowles...@gmail.com>
Cc: TasmotaUsers <sonof...@googlegroups.com>

Petr Jakes

unread,
Oct 10, 2021, 4:17:55 AM10/10/21
to Philip Knowles, TasmotaUsers
)))) yes, this is a fudge ))) I read a lot about ledpower1 and so on, but I was confused about the functionality
This is why I am trying to ask here ))
Anyway thanks for trying to hepl
Reply all
Reply to author
Forward
0 new messages