Page 1 of 2

Sonoff S20 WiFi Smart Socket

Posted: Sat Dec 07, 2019 12:01 pm
by jedie
Project to get a webserver on Sonoff WiFi Smart Socket: https://github.com/jedie/micropython-sonoff-webswitch

Here current screenshots:

Image

Image

Image

Re: Sonoff S20 WiFi Smart Socket

Posted: Sat Dec 07, 2019 2:06 pm
by kevinkk525
Looks good!

Re: Sonoff S20 WiFi Smart Socket

Posted: Sat Dec 07, 2019 8:17 pm
by jedie
Now i add a new feature: checkboxes for each day of the week where timers are active
Screenshot_2019-12-07 Sonoff S20.png
Screenshot_2019-12-07 Sonoff S20.png (8.1 KiB) Viewed 2167 times
But currently i store the selected days only in RTC RAM... (The timers stored as a json file in filesystem)
So next thing is to store the days in filesystem, too.

Re: Sonoff S20 WiFi Smart Socket

Posted: Sun Dec 08, 2019 7:24 am
by pythoncoder
Very nice work.

Sonoff products seem finally to have come of age. I spent a lot of time on the Sonoff Basic in-line switch. This has gone through three hardware redesigns. Unlike the R1 and R2 units, the new R3 units actually work reliably with decent wireless range. I gather from @kevinkk525 that the S20 is good, too. These things have a lot of potential MicroPython applications and are very hacker-friendly.

Re: Sonoff S20 WiFi Smart Socket

Posted: Sat Dec 14, 2019 11:02 am
by jedie
v0.8.1 is out...

New:
  • handles time zones: User can set his timezone via web page (pre filled via JavaScript). All times are converted from UTC to his local time.
  • A Device name can be saved via web page, and will be displayed on every page. Helpfull if you have more than one device. In the screenshots the same saved to test-esp8233
  • many bug fixes
Current screenshots:

Image


Image


Image


Image


Image

Re: Sonoff S20 WiFi Smart Socket

Posted: Mon Dec 16, 2019 5:00 pm
by jedie
v0.9.0 is available :D

I've refactor the timer schedule. This makes the functionality much more robust and reliable.

From the README:
The Device always tries to turn the power ON/OFF based on the current timer. Even after a power failure. However, this only works correctly if the current time is set correctly by the RTC. The current time is automatically retrieved from the Internet via NTP sync. At boot and also repeated after start. Of course, this can only work if the device is connected to the Internet via WiFi ;)

You can "overwrite" the current timer at any time by pressing the button on the device. This overwrite will stay until the next timer. After a power failure the "overwrite" information is deleted and the timer regulates the power again.
However, it is still the situation that now and then the RAM is not sufficient. But I already have an idea what I can optimize.

Re: Sonoff S20 WiFi Smart Socket

Posted: Mon Dec 16, 2019 10:03 pm
by kevinkk525
Are you already using littlefs? That would free 4kb of RAM

Re: Sonoff S20 WiFi Smart Socket

Posted: Tue Dec 17, 2019 3:31 am
by mattyt
MicroPython v1.12 is expected to be released within a few days and it'll have littlefs built-in...

Re: Sonoff S20 WiFi Smart Socket

Posted: Tue Dec 17, 2019 6:02 am
by jedie
With v1.12 I will use it.

Re: Sonoff S20 WiFi Smart Socket

Posted: Thu Dec 19, 2019 10:40 pm
by jedie
Now it's possible to dim the power LED:
Screenshot_2019-12-19.png
Screenshot_2019-12-19.png (14.63 KiB) Viewed 1930 times
See also: viewtopic.php?f=2&t=7414