• 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
#1
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...


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



Code:
"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:


Code:
        "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.
 
Reply
#2
Start with using code tags for readability.
 
Reply
#3
(07-12-2018, 11:38 AM)curlymo Wrote: Start with using code tags for readability.

Sorry... Blush
 
Reply
#4
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.
 
Reply
  


Possibly Related Threads...
Thread Author Replies Views Last Post
  sunset rule doesn't work fleisch 3 36 4 hours ago
Last Post: curlymo
  On and Off for one device in one rule Oliver 2 50 10-17-2019, 06:33 PM
Last Post: Oliver
  Rule with&without device. One working not the other... Tamadite 9 1,025 07-24-2018, 08:55 AM
Last Post: curlymo
  Problem with executing bash script via rule/program dYna 1 871 02-15-2018, 09:06 PM
Last Post: dYna
  Rule Sunset works, Sunrise not apartmedia 1 1,019 12-05-2017, 07:09 PM
Last Post: apartmedia
  Problem with a Rule for a One Button Switch martin-dj 1 1,211 03-06-2017, 12:01 PM
Last Post: pilino1234
  Rule executed at wrong time philipp81 1 862 02-25-2017, 10:43 PM
Last Post: curlymo
  Rule is executed repeatedly Niek 3 1,442 11-09-2016, 10:22 PM
Last Post: wo_rasp
  Rule with datetime will not work PT-Biker 4 2,550 09-24-2016, 11:57 AM
Last Post: PT-Biker
  Rule logging raj 1 1,271 09-05-2016, 01:35 PM
Last Post: raj

Forum Jump:


Browsing: 1 Guest(s)