Rule: If wifi not connect set gpioX 0 - possible?

Moderators: grovkillen, Stuntteam, TD-er

Post Reply
Message
Author
schmucke
New user
Posts: 6
Joined: 21 Jun 2017, 09:48

Rule: If wifi not connect set gpioX 0 - possible?

#1 Post by schmucke » 21 Jun 2017, 09:57

Hey,

thank you very much for this forum.

i need a rule which set the status off defined gpios if the WiFi Signal is lost.
I watering my garden with a Wemos D1 mini Pro -> 4 relay module -> 24V valve. I control it with Pimatic (pimatic.org) and the MQTT protocol. But, if i lost the WiFi signal i want that the ESP close all valves in the garden (Backup if i lost the signal in the time where the garden ist watering).

Is this possible by a rule?

Thank you very much,
schmucke

User avatar
grovkillen
Core team member
Posts: 3621
Joined: 19 Jan 2017, 12:56
Location: Hudiksvall, Sweden
Contact:

Re: Rule: If wifi not connect set gpioX 0 - possible?

#2 Post by grovkillen » 21 Jun 2017, 13:12

schmucke wrote: 21 Jun 2017, 09:57 Hey,

thank you very much for this forum.

i need a rule which set the status off defined gpios if the WiFi Signal is lost.
I watering my garden with a Wemos D1 mini Pro -> 4 relay module -> 24V valve. I control it with Pimatic (pimatic.org) and the MQTT protocol. But, if i lost the WiFi signal i want that the ESP close all valves in the garden (Backup if i lost the signal in the time where the garden ist watering).

Is this possible by a rule?

Thank you very much,
schmucke
I know this is not what you ask for but cant you make sure that the valves are closed after a certain time period (internally in the ESP Easy)? You can have the valves close after lets say 60 minutes if no "Off" command has been received from the server side?
ESP Easy Flasher [flash tool and wifi setup at flash time]
ESP Easy Webdumper [easy screendumping of your units]
ESP Easy Netscan [find units]
Official shop: https://firstbyte.shop/
Sponsor ESP Easy, we need you :idea: :idea: :idea:

schmucke
New user
Posts: 6
Joined: 21 Jun 2017, 09:48

Re: Rule: If wifi not connect set gpioX 0 - possible?

#3 Post by schmucke » 21 Jun 2017, 13:20

can u explain me a sample? this is what i need.

i send a on signal remote and need, for the worst case, a backup if no off signal is coming. i think, this is a better solution if my pimatic hangs.

majklovec
Normal user
Posts: 10
Joined: 12 Jul 2016, 07:47

Re: Rule: If wifi not connect set gpioX 0 - possible?

#4 Post by majklovec » 21 Jun 2017, 14:00


schmucke
New user
Posts: 6
Joined: 21 Jun 2017, 09:48

Re: Rule: If wifi not connect set gpioX 0 - possible?

#5 Post by schmucke » 21 Jun 2017, 15:08

majklovec wrote: 21 Jun 2017, 14:00 Use the rules and timer.

https://www.letscontrolit.com/wiki/inde ... ith_events
Thanks, is this possible?

Code: Select all

on givemesomewater do
   gpio,14,0  // open valve
   timerSet 1,300 // 5 minute timer
 endon

on Rules#Timer=1 do
   gpio,14,1 // close valve
   gpio,16,0 // open valve two
   timerset 2,300 
 endon

on Rules#Timer=2 do
   gpio,16,1 //close valve two
 endon
 
But, this is not what i need. I just need a Rule wich detect the remote MQTT change. When it turns the valve on, then it must start a timer which close the valve after a time if the valve is not close by MQTT.

User avatar
grovkillen
Core team member
Posts: 3621
Joined: 19 Jan 2017, 12:56
Location: Hudiksvall, Sweden
Contact:

Re: Rule: If wifi not connect set gpioX 0 - possible?

#6 Post by grovkillen » 21 Jun 2017, 17:07

Use MQTT Import for that.
ESP Easy Flasher [flash tool and wifi setup at flash time]
ESP Easy Webdumper [easy screendumping of your units]
ESP Easy Netscan [find units]
Official shop: https://firstbyte.shop/
Sponsor ESP Easy, we need you :idea: :idea: :idea:

schmucke
New user
Posts: 6
Joined: 21 Jun 2017, 09:48

Re: Rule: If wifi not connect set gpioX 0 - possible?

#7 Post by schmucke » 21 Jun 2017, 21:18

grovkillen wrote: 21 Jun 2017, 17:07 Use MQTT Import for that.
I think, this is not this what i mean. I need a local backup. i just use a raspberry with mosquitto, but, if the system crash i want a local backup at the ESPEASY system.

If the Raspberry cannot connect to the esp to turn off the watering. I need a rule which start a timer local in this moment, where the gpio set to 1. If there come no signal (wifi loss or something), the esp must stop the watering after a specified time. i dont want that my garden is flooting by water in the worst case.

is there a rule what do the following?

Code: Select all

on gpio set to 1 do
 timerSet 1,600
 endon

on Rules#Timer=1 do
 gpio,16,0
 endon
i dont find a rule what is starting by change the gpio.

Thank you.
schmucke

User avatar
grovkillen
Core team member
Posts: 3621
Joined: 19 Jan 2017, 12:56
Location: Hudiksvall, Sweden
Contact:

Re: Rule: If wifi not connect set gpioX 0 - possible?

#8 Post by grovkillen » 21 Jun 2017, 21:58

If you send the watering command as MQTT and fetch it through MQTT Import you can start the timer from there.

I'll try to give you an example... Hold on.
ESP Easy Flasher [flash tool and wifi setup at flash time]
ESP Easy Webdumper [easy screendumping of your units]
ESP Easy Netscan [find units]
Official shop: https://firstbyte.shop/
Sponsor ESP Easy, we need you :idea: :idea: :idea:

Martinus

Re: Rule: If wifi not connect set gpioX 0 - possible?

#9 Post by Martinus » 21 Jun 2017, 21:59

If you need this kind of local control, i think the best way is to send an event to ESP Easy from Pimatic.

The rules could then be like this:

Code: Select all

on givemesomewater do
   gpio,14,0  // open valve
   timerSet 1,300 // 5 minute timer
 endon

on Rules#Timer=1 do
   gpio,14,1 // close valve
endon
From pimatic send this to the .../cmd topic
event,givemesomewater

Shardan
Normal user
Posts: 1156
Joined: 03 Sep 2016, 23:27
Location: Bielefeld / Germany

Re: Rule: If wifi not connect set gpioX 0 - possible?

#10 Post by Shardan » 21 Jun 2017, 22:03

It might be possible to use the

Code: Select all

Status <device>, <pin>
command for this too.
Did not test this myself, as far as i have seen in some forum threads this might
give strange results as it is not fully developed.

Regards
Shardan
Regards
Shardan

User avatar
grovkillen
Core team member
Posts: 3621
Joined: 19 Jan 2017, 12:56
Location: Hudiksvall, Sweden
Contact:

Re: Rule: If wifi not connect set gpioX 0 - possible?

#11 Post by grovkillen » 21 Jun 2017, 22:12

Rule using MQTT (importer)

Code: Select all

on sniff#cmdMQTT=1 do
  gpio,12,1
  timerSet,1,600 //timer 1 set for 10 minutes
  Publish %sysname%/Valve,Open
  Publish %sysname%/Status,Started watering
endon

on sniff#cmdMQTT=2 do
  timerSet,1,0 //timer 1 set to halt
  Publish %sysname%/Valve,Close
  Publish %sysname%/Status,STOP watering
endon

On Rules#Timer=1 do  
   gpio,12,0 //stop watering
endOn
More on the plugin here:
https://www.letscontrolit.com/wiki/inde ... QTT_Import


Rule using HTTP (event)

Code: Select all

On startwatering do 
  gpio,12,1 //start watering 
  timerSet,1,600 //timer 1 set for 10 minutes
endon
 
On stopwatering do 
  timerSet,1,0 //timer 1 set to halt
endon
 
On Rules#Timer=1 do  
   gpio,12,0 //stop watering
endOn
Triggering through this command.
http://<espeasyip>/control?cmd=event,startwatering
http://<espeasyip>/control?cmd=event,stopwatering
ESP Easy Flasher [flash tool and wifi setup at flash time]
ESP Easy Webdumper [easy screendumping of your units]
ESP Easy Netscan [find units]
Official shop: https://firstbyte.shop/
Sponsor ESP Easy, we need you :idea: :idea: :idea:

schmucke
New user
Posts: 6
Joined: 21 Jun 2017, 09:48

Re: Rule: If wifi not connect set gpioX 0 - possible?

#12 Post by schmucke » 22 Jun 2017, 20:33

Martinus wrote: 21 Jun 2017, 21:59 If you need this kind of local control, i think the best way is to send an event to ESP Easy from Pimatic.

The rules could then be like this:

Code: Select all

on givemesomewater do
   gpio,14,0  // open valve
   timerSet 1,300 // 5 minute timer
 endon

on Rules#Timer=1 do
   gpio,14,1 // close valve
endon
From pimatic send this to the .../cmd topic
event,givemesomewater
Ok, it works! But, where can i get the state of the Device?

User avatar
grovkillen
Core team member
Posts: 3621
Joined: 19 Jan 2017, 12:56
Location: Hudiksvall, Sweden
Contact:

Re: Rule: If wifi not connect set gpioX 0 - possible?

#13 Post by grovkillen » 22 Jun 2017, 23:28

Publish or SendToHTTP is what I would do.

https://www.letscontrolit.com/wiki/inde ... _Reference
ESP Easy Flasher [flash tool and wifi setup at flash time]
ESP Easy Webdumper [easy screendumping of your units]
ESP Easy Netscan [find units]
Official shop: https://firstbyte.shop/
Sponsor ESP Easy, we need you :idea: :idea: :idea:

Post Reply

Who is online

Users browsing this forum: No registered users and 95 guests