this howto is focused on “shell plug s” (it’s really hard to identify what exact version or “generation” a shelly is) but it should work the same for other shelly plugs.

how to factory reset the shelly?

before plugin hold the small little white button at bottom and keep it pressed while inserting the plug into power… after 15 sec it will start blinking red, afterwards there should be a wifi with no password, use a laptop to connect and use netdiscover to discover the IP of the shelly, then point the browser to that adress to get into web interface dashboard

  1. first thing the user might want to configure: make the shelly connect to the user’s wifi hotspot, so it’s easier to access it from the network
    • while on it disable all the user does not need:
      • AP (access point) mode: disable
      • bluetooth: disable
  2. set a login password
  3. might be a good idea to

 

client script: javascript

shelly allows running javascript scripts on startup

so what the dev user does is start a local test server

nc -l -k 5000

and make the shelly send post request with json data to that port

so modify the script to the devUser’s PC IP and insert script into shelly’s list of js scripts and hit the run button (also make sure to enable autostart: checkbox “run on startup” toggle switch)

post_data_v3_works_THEBEST.txt

server part

server will be (of course) 100% python

right now it’s 2x webservers:

  1. webserver_shelly_v3.py.txt this one receives the post json requests of the shelly and writes them into a local text file called webserver_shelly_shellyplusplugs-3ce90e2fba14.txt where “shellyplusplugs-3ce90e2fba14” = device_id
  2. webserver_shelly_v3_visualize.py.txt this webserver reads the webserver_shelly_shellyplusplugs-3ce90e2fba14.txt (device_id is send via request https://123.123.123.123:6443/shellyplusplugs-3ce90e2fba14.html
    • make sure to have ssl certs in the same directory, generate them like this
    • openssl req -x509 -newkey rsa:2048 -keyout key.pem -out cert.pem -days 365 -nodes -subj “/CN=123.123.123.123”
  3. the output looks like this:

how to auto start the python server scripts as non root?

su user -c “cd /home/user; python3 webserver_shelly_v3.py” &
su user -c “cd /home/user; python3 webserver_shelly_v3_visualize.py” &

 

liked this article?

  • only together we can create a truly free world
  • plz support dwaves to keep it up & running!
  • (yes the info on the internet is (mostly) free but beer is still not free (still have to work on that))
  • really really hate advertisement
  • contribute: whenever a solution was found, blog about it for others to find!
  • talk about, recommend & link to this blog and articles
  • thanks to all who contribute!
admin