User Tools

Site Tools


projets:fuz:presence_button

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
Next revisionBoth sides next revision
projets:fuz:presence_button [2019-11-02 22:55] – [Hardware] Lomanicprojets:fuz:presence_button [2019-11-25 23:05] – [Current status] roadmap update ; how to investigate crashes Lomanic
Line 9: Line 9:
 ===== Hardware ===== ===== Hardware =====
   * some glorious esp8266 in a Sonoff S20 power plug (NodeMCU v0.9 for development)   * some glorious esp8266 in a Sonoff S20 power plug (NodeMCU v0.9 for development)
-  * another esp8266 to check when the S20 goes down (Fuz closing) 
  
 To flash a Sonoff S20, solder the pins on the left of the push button, connect your USB-to-Serial convertor (RobotDyn CH340G in this case) to the headers like in the image below (from top to bottom, GND, TX, RX, 3.3v VCC), push Sonoff button while plugging in your USB-to-Serial convertor in your PC and then release the push button after a few seconds (check out [[https://medium.com/@jeffreyroshan/flashing-a-custom-firmware-to-sonoff-wifi-switch-with-arduino-ide-402e5a2f77b|this link]] and [[http://blinkingled.cc/update-firmware-of-smart-switch-sonoff-s20/|that one]]). Don't forget about the SPIFFS setting in Arduino IDE as we are using it to store custom settings via WifiManager (see step 6 below). To flash a Sonoff S20, solder the pins on the left of the push button, connect your USB-to-Serial convertor (RobotDyn CH340G in this case) to the headers like in the image below (from top to bottom, GND, TX, RX, 3.3v VCC), push Sonoff button while plugging in your USB-to-Serial convertor in your PC and then release the push button after a few seconds (check out [[https://medium.com/@jeffreyroshan/flashing-a-custom-firmware-to-sonoff-wifi-switch-with-arduino-ide-402e5a2f77b|this link]] and [[http://blinkingled.cc/update-firmware-of-smart-switch-sonoff-s20/|that one]]). Don't forget about the SPIFFS setting in Arduino IDE as we are using it to store custom settings via WifiManager (see step 6 below).
Line 25: Line 24:
 ===== Software ===== ===== Software =====
  
-See [[https://github.com/Lomanic/presencebutton|Lomanic/presencebutton]] on Github.+See [[https://github.com/Lomanic/presence-button|Lomanic/presence-button]] on Github.
  
 ===== Roadmap ===== ===== Roadmap =====
Line 56: Line 55:
   - **TODO**   - **TODO**
   - **TODO** https://github.com/esp8266/Arduino/issues/4826#issuecomment-491813938 (insecure) https://github.com/esp8266/Arduino/pull/3271/files (more secure). https://github.com/SensorsIot/HTTPS-for-Makers   - **TODO** https://github.com/esp8266/Arduino/issues/4826#issuecomment-491813938 (insecure) https://github.com/esp8266/Arduino/pull/3271/files (more secure). https://github.com/SensorsIot/HTTPS-for-Makers
-  - **DOING** <del>making the S20 regularly ping a remote server. This remote server would then send a message on Matrix saying Fuz is closed if it's not ping-ed after some delay. Implementing the latter using MQTT ([[https://github.com/knolleary/pubsubclient|PubSubClient library]]).</del> simpler, have an HTTP server on the S20 indicating if the button has been pushed once, and have an always-on esp8266 poll this webserver and notify the Matrix channel and a remote server when it's gone after a few minutes. S20 webserver done in [[https://gist.github.com/Lomanic/3ac81aa6bb5ce4cdb88da3a76fe4aa1c|sonoff_s20_wifimanager_longpress_matrix_events_webserver_admin.ino]] (with an admin interface as a bonus) +  - **DONE** making the S20 regularly ping a remote server. This remote server would then send a message on Matrix saying Fuz is closed if it's not ping-ed after some delay. Implementing the latter using <del>MQTT ([[https://github.com/knolleary/pubsubclient|PubSubClient library]])</del> HTTP polling. <del>simpler, have an HTTP server on the S20 indicating if the button has been pushed once, and have an always-on esp8266 poll this webserver and notify the Matrix channel and a remote server when it's gone after a few minutes. S20 webserver done in [[https://gist.github.com/Lomanic/3ac81aa6bb5ce4cdb88da3a76fe4aa1c|sonoff_s20_wifimanager_longpress_matrix_events_webserver_admin.ino]] (with an admin interface as a bonus)</del>, S20 part done in [[https://github.com/Lomanic/presence-button/commit/450fdfcddf5a187fb261470427bf255231f175d5|450fdfcddf5a187fb261470427bf255231f175d5]], server side on the Glitch platform also done (via a JSON log file as container gets killed after a while and to be able to recover after being killed
-  - **TODO** needs a publicly accessible server to serve an image/API (probably the same server as previous step), include the image/JS on fuz.re and yadda!+  - **ALMOST DONE** check out [[https://github.com/Lomanic/presence-button/commit/450fdfcddf5a187fb261470427bf255231f175d5|450fdfcddf5a187fb261470427bf255231f175d5]] and https://glitch.com/edit/#!/presence-button [[https://presence-button.glitch.me/|presence-button]], to be integrated on fuz.re
   - ??   - ??
   - **TODO**   - **TODO**
  
-Today the elementary functionalities described in step 2 are implemented [[https://gist.github.com/Lomanic/dba3cd9f93161cc1acc32c83197298eb|sonoff_s20_wifimanager_longpress_matrix_events.ino]].+Today the button can notify on Matrix when it's pressed after initialization or after being notified on Matrix, and a server registers pings from the button to notify on Matrix that the Fuz is closed.
  
 Next steps: Next steps:
  
 +  - investigate random crashes after some time, integrate the awesome [[https://github.com/krzychb/EspSaveCrash|EspSaveCrash]] library, maybe do as this dude [[https://www.esp8266.com/viewtopic.php?f=6&t=18716&start=4#79055|here]], but sending crash to HTTP server
   - handle multiple matrix channels configured (to listen to and to reply to)   - handle multiple matrix channels configured (to listen to and to reply to)
-  - notify when the Fuz is closing 
   - resolve HTTPS locally instead of relying on a HTTP/HTTPS proxy   - resolve HTTPS locally instead of relying on a HTTP/HTTPS proxy
  
Line 81: Line 80:
   * [[https://gist.github.com/Lomanic/3ac81aa6bb5ce4cdb88da3a76fe4aa1c|sonoff_s20_wifimanager_longpress_matrix_events_webserver_admin.ino]]   * [[https://gist.github.com/Lomanic/3ac81aa6bb5ce4cdb88da3a76fe4aa1c|sonoff_s20_wifimanager_longpress_matrix_events_webserver_admin.ino]]
  
-Subsequent versions on [[https://github.com/Lomanic/presencebutton|Github Lomanic/presencebutton]].+Subsequent versions on [[https://github.com/Lomanic/presence-button|Github Lomanic/presence-button]].
  
 ===== Resources ===== ===== Resources =====
projets/fuz/presence_button.txt · Last modified: 2023-02-02 22:06 by 127.0.0.1