• 10 dec 2017: forum version update. In case of issues use this topic.
  • 30 nov 2017: pilight moved servers. In case of issues use this topic.
Hello There, Guest! Login Register

Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
rule executed once at start up
I cant figure how to get this...
I want this to solve the problem with relay to gpio "first undefined state" at start up pilight

I have tried with generic switch like this...

"devices": {
              first_time": {
                        "protocol": [ "generic_switch" ],
                        "id": [{
                                "id": 101
                        "state": "on"

"rules": {
                "start_up": {
                        "rule": "IF first_time.state != off THEN switch DEVICE first_time AND sw1_filt TO off"
                        "active": 1

I have tried all possible configurations
with (first_time.state == on)
puttiing "AFTER"
changing for generic switch for dimmer ...

and it is imposible.

The root problem is that:

        "devices": {
                "": {
                        "protocol": [ "relay" ],
                        "id": [{
                                "gpio": 2
                        "default-state": "off",
                        "state": "off"

allways is showed as "ON" at GUI, but the GPIO is even in 'IN' mode (at start up of pilight daemon)
I want to force "sw1_filt" to "off" at startup, to put GPIO at OUT and a off state,
and then I need a rule that was executed only once at startup.

But this is really imposible with pilight v8

Please, help me with this... because if raspberry pi is booted, all the next rules with GPIO fails forever (and the pool is not filtered anymore).

Obviously I can solve this with a rule reseting every day, or running a post-script at starting pilight daemon... but I dont think this is the

PD: I have seen that "relay" has dissapeared from doc, and apear a "gpio_switch", but this dont have the "default-state": "off" reverse relay state (when gpio=0 => switch is on, and gpio=1 => switch is off)

Thanks for all.
Start with using code tags for readability.
(07-12-2018, 11:38 AM)curlymo Wrote: Start with using code tags for readability.

Sorry... Blush
Such a function does not exist yet, but i think it's a good idea. Let me think about the implementation of it or try to implement it yourself now all eventing modules are in plain text LUA.

Possibly Related Threads...
Thread Author Replies Views Last Post
  [solved] sunset rule doesn't work fleisch 5 904 08-29-2020, 05:23 AM
Last Post: CharlesRhymn
  Rule triggers twice Thorben653 13 2,454 02-05-2020, 01:06 PM
Last Post: VicktorKopf
  Exclude Weekend from a rule PT-Biker 1 658 12-08-2019, 10:22 AM
Last Post: curlymo
  [Solved] On and Off for one device in one rule Oliver 3 759 10-28-2019, 06:55 PM
Last Post: Oliver
  Rule with&without device. One working not the other... Tamadite 9 1,939 07-24-2018, 08:55 AM
Last Post: curlymo
  Problem with executing bash script via rule/program dYna 1 1,320 02-15-2018, 09:06 PM
Last Post: dYna
  Rule Sunset works, Sunrise not apartmedia 1 1,438 12-05-2017, 07:09 PM
Last Post: apartmedia
  Problem with a Rule for a One Button Switch martin-dj 1 1,562 03-06-2017, 12:01 PM
Last Post: pilino1234
  Rule executed at wrong time philipp81 1 1,186 02-25-2017, 10:43 PM
Last Post: curlymo
  Rule is executed repeatedly Niek 3 1,865 11-09-2016, 10:22 PM
Last Post: wo_rasp

Forum Jump:

Browsing: 1 Guest(s)