Post about your Basic project here

Moderator: Mmiscool

User avatar
By JMS
#64566 This board has been a little quiet lately... I suspect its because everyone is off building cool IOT things. I've found that ESP8266 Basic allows you to just DO without a lot of discussion required around the HOW. I thought i'd mention a few of my ESP8266 Basic based Projects.

I have 3 projects in everyday use around the house that are based ESP8266 Basic. It is great that I can just log in to my device make some changes and not have to worry about recompiling and reflashing the firmware every time I want to change something simple.

1. A simple lamp relay that I can control with Amazon Alexa or on board web interface
2. A clock with time date and temperature based on a 2 line cash register POS display
3. A centrally located multi relay controller that turns various stuff on and off interfaces with local wall mounted push buttons. It interfaces with Amazon Alexa as it's own local web interface. I am working to extend this to control a pool pump relay and include some on/off scheduling as well.
User avatar
By JMS
#66571
Luc Volders wrote:I second this.
Please share the projects.

I am mostly interested in the interface with Alexa.

Luc


Sorry it took so long to respond hopefully this info will still be relevant.

I've looked into creating my own Alexa Skill and didn't have the time to learn what I needed to learn so the Alexa integration is through the IFTTT Alexa channel https://ifttt.com/amazon_alexa which works pretty good for my purposes. I have a small raspberry pi ZeroW based "security server" that parses and forwards of the commands received from the IFTTT Alexa channel. This server receives the commands and it talks to ESP devices so I do not have to open ports for all the ESP devices. It provides a very minimal amount of security around controlling the ESP devices.

Here is the code for the lamp relay I have attempted to make it very generic so you could have multiple devices and interface with them in the same way. I haven't worked on this for a while my spare time has been pretty limited.

Code: Select all[startUP]
devInfo = "0"
devType = "relay"
devChannels = 1
devPin = 12 
devName = "Living Room Lamp"
devNotes = "Additional Dev Info"
devState = io(laststat,devPin)
devLocalButton = 1
devLocalButtonPin = 6
devAutoOff = 0
devAutoOffTimer = 20000
msgbranch [webCmd]
[setOptions]
gosub [getInfo]
gosub [setLocalButtonOption]
gosub [setLocaltimerOption]
 

[localControl]
cls
wprint "<meta name='viewport' content='width=device-width,initial-scale=1'><br><center>"
button "On" , [turnOnStub]
button "Off" , [turnOffStub]
wprint "<br> Current Status: " & devState & "<br>"
button "configure" , [config]
wait

[config]
cls
wprint "<meta name='viewport' content='width=device-width,initial-scale=1'><br><center>"
wprint devInfo & "<br>"
wprint "<br><b> Relay Pin: "
dropdown devPin, "1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16"
wprint "<br>Auto Off timer enable: "
dropdown devAutoOff, "1,0"
wprint "<br>Auto Off Time: "
dropdown devAutoOffTimer,"5000,20000,30000,40000"
wprint "<br>ocal Button Enable: "
dropdown devLocalButton, "1,0"
wprint "<br>Local Button Pin :"
dropdown devLocalButtonPin, "1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16"
wprint "<br></b>"
button "save", [setOptions]
wait

[turnOnStub]
gosub [turnOn]
wait

[turnOffStub]
gosub [turnOff]

wait

[turnOn]
io(po,devPin,0)
gosub [setLocalButtonOption]
gosub [setTimerOption]
gosub [postUpdate]
return
wait

[turnOff]
io(po,devPin,1)
gosub [setLocalButtonOption]
gosub [postUpdate]
return
wait

[webCmd]
'actions
'0=off 1=on R=on of status Q=return Info 2-99 = dim command
webAction = msgget("action")

if webAction == "on" then
   gosub [turnOn]   
    mReturn = "on"
end if

if webAction == "off" then
   gosub [turnOff]
   mReturn = "off"
end if   

if webAction == "tog" then
   gosub [toggle]
   mReturn = io(laststat,devPin)
end if   

if webAction == "R" then
   mReturn = io(laststat,devPin)
end if   

if webAction == "Q" then
    gosub [getInfo]
   mReturn = devInfo
end if

if webAction > 1 then
   if webAction < 101 then
      gosub [goDim]
      mReturn = "dim"
   end if
end if   
msgreturn mReturn
wait

[getInfo]
gosub [pinStatLast]
devInfo = "devType= " & devType & "<br>" & "devChannels= " & devChannels & "<br>" & "devState= " & "devState= " & devState & "<br>" & "devLocalButton= " & devLocalButton & "<br>" & "devLocalButtonPin= " & devLocalButtonPin & "<br>" & "devAutoOff= " & devAutoOff & "<br>" & "devAutoOffTimer= " & devAutoOffTimer & "<br>"
return
wait

[buttonPress]
interrupt devLocalButtonPin
if io(laststat,devPin) = 1 then
   goto [turnOff]
else
   goto [turnOn]
end if
[wait]

[toggle]
if io(laststat,devPin) = 1 then
   goto [turnOn]
else
   goto [turnOff]
end if
return

[autoOff]
if io(laststat,devPin) = 0 then
   timer 0
   goto [turnOff]
end if
wait

[pinStatLast]
devState = io(laststat,devPin)
return

[postUpdate]
'future use
return

[setLocalButtonOption]
if devLocalButton = 1 then
   interrupt devLocalButtonPin,[buttonPress]
endif
return

[setTimerOption]
if devAutoOff = 1 then
   timer devAutoOffTimer , [autoOff]
end if   
return