WiFi Button with ModemSleep

Moderators: grovkillen, Stuntteam, TD-er

Post Reply
Message
Author
User avatar
enesbcs
Normal user
Posts: 587
Joined: 18 Jun 2017, 11:02
Location: Békéscsaba, Hungary
Contact:

WiFi Button with ModemSleep

#1 Post by enesbcs » 31 Oct 2018, 15:16

I found the Button project and slightly revised. I have added a 0.8-3.3 to 3.3VDC step-up converter to it with 2xAAA battery. (can be done with a 1.8-5.5V to 3.3V Step up-down converter + 3xAAA battery) - update: the small step-up converter i have used is unable to provide enough power for the ESP when the voltage drops below 2.5V :( it's useless.
Also the original project uses some LUA interpreter, i uploaded ESPEasy to it.
Image
The full project costs approximately $6.
From the outer world, it looks like any other touch light.
Inside:
Image
Wiring:
Image
ESPEasy devices:
Image
Rules example for using with ModemSleep after each buttonpress:

Code: Select all

on System#Boot do
 taskvalueset,5,1,0
 taskvalueset,5,2,0
 timerset,2,120
endon

on gomb#Shortpress do
 taskvalueset,5,1,127
 event,wakeup
endon

on gomb#Longpress do
 taskvalueset,5,1,128
 event,wakeup
endon

on wakeup do
 taskvalueset,5,2,1
 If [wifiman#Connected]>0
  event,evalbtns
 else
  modemsleep,0
 endif
endon

on evalbtns do
 taskrun,3
 if [glob#idx]>0
  Publish domoticz/in,{"idx":[glob#idx],"nvalue":1.00,"svalue":"On", "RSSI": [rssi#rssi]}
  pulse,13,1,100
  Publish domoticz/in,{"idx":[glob#idx],"nvalue":0.00,"svalue":"Off", "RSSI": [rssi#rssi]}
 endif
 timerset,1,1
endon

on MQTT#Connected do
 event,evalbtns
endon

on Rules#Timer=1 do
 if [glob#sleepok]>0
  modemsleep,1
 endif
 if [glob#idx]=127
  pulse,13,1,200
 endif
 if [glob#idx]=128
  pulse,13,1,500
 endif
 taskvalueset,5,1,0  
endon

on Rules#Timer=2 do
 taskvalueset,5,2,1
endon
Project page
Last edited by enesbcs on 03 Nov 2018, 09:08, edited 1 time in total.

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

Re: WiFi Button with ModemSleep

#2 Post by grovkillen » 31 Oct 2018, 15:35

OOOOOH, sweet! I want to have this featured on the upcoming home page :)
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:

User avatar
enesbcs
Normal user
Posts: 587
Joined: 18 Jun 2017, 11:02
Location: Békéscsaba, Hungary
Contact:

Re: WiFi Button with ModemSleep

#3 Post by enesbcs » 31 Oct 2018, 16:03

grovkillen wrote: 31 Oct 2018, 15:35 OOOOOH, sweet! I want to have this featured on the upcoming home page :)
Waoh a new page is under development? :) Thanx, I feel honored.
In the matter of fact, i have a lot of ESP projects, but i am too lazy to translate it... i'll start once. :)

Post Reply

Who is online

Users browsing this forum: No registered users and 22 guests