Skip to content
View in the app

A better way to browse. Learn more.

Power Forum - Renewable Energy Discussion

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

paulcb

Members
  • Joined

  • Last visited

Reputation Activity

  1. Like
    paulcb got a reaction from Garthox in Toggle Sonoff Switches based on Sunsynk Data   
    Ok sure. Here goes. This assumes you know some basic linux. If not maybe this is not for you but perhaps I can help if needed:
    1) Make sure your Sunsynk connect App is working and you know your username/password.
    2) Make sure your Sonoff switches are working in the Ewelink app and you know your username/password.
    3) Fire up an Ubuntu VM on AWS/Azure/GCP or even on a Pi or home PC. It can be really small like 512MB RAM and needs internet access
    4) Install docker in the linux vm. Follow something like this: https://kinsta.com/blog/install-docker-ubuntu/
    5) Someone wrote a nodejs gateway to mimic the calls done by the Ewelink App see: https://github.com/DoganM95/Ewelink-Rest-Api-Server I leverage this as a way to control the Sonoff Switches. To run this listening on port 8089 run this. It needs your Ewelink username/password you registered in the App so it can call into Ewelink servers: 
    docker run -d --restart=always -p 8089:3000 -e "EWELINK_USERNAME=yourusername" -e "EWELINK_PASSWORD=yourpassword" -e "EWELINK_REGION=eu" -e "PASSWORD_HASHING_ALGORITHM=sha512" -e "SERVER_MODE=prod" doganm95/ewelink-rest-api-server 6) Test you can turn a switch on like this (Replace "Your Switch Name" with the switch name as it appears in the Ewelink App):
    curl -m20 -sX POST "http://localhost:8089" -H "content-type: application/json" -d"{\"devicenameincludes\":[\"Your Switch Name\"],\"params\":{\"switch\":\"on\"}}" 7) Install a json parser utility:
    sudo apt install jq 8. In your home folder add the attached script.sh and make it executable with chmod +x ./script.sh
    9) In the script set your Sunsynk connect username and password on rows 4 & 5 for SUNSYNK_USER and SUNSYNK_PASS. Then set SUNSYNK_PLANT on row 6 with the plant ID you see if you login to sunsynk connect in your browser. E.g. mine is 88663:

    9) Create a cron schedule to run the script every 5 minutes: crontab -e -> then add a row like this: */5 * * * * /home/ubuntu/script.sh >> /home/ubuntu/solar.log
    10) Edit the script to suit your needs and refer to your Sonoff switch names. I've got a simple example of a switch called "My Switch" that will turn on if we have excess power and Off if we don't. If you don't know what going on, ping me with your switch names and basic rules and I can help. You have a huge amount of control. I have some fairly complex rules around hour of day etc.
    11) To see what the script is doing, run tail -f /home/ubuntu/solar.log
     
    I'd love it if this is useful to anyone so let me know if you need help and add any things I might have missed to make the instructions foolproof. My script generates a basic HTML page of the current status but I deleted that part as it just makes the script more complex than necessary. Anyone with basic bash scripting can go wild. If you comfortable with python or something else then use that - its really just some HTTP GET and POST commands surrounded with JSON parsing.
    script.sh
  2. Thanks
    paulcb got a reaction from Blouwildebees in Toggle Sonoff Switches based on Sunsynk Data   
    Ok sure. Here goes. This assumes you know some basic linux. If not maybe this is not for you but perhaps I can help if needed:
    1) Make sure your Sunsynk connect App is working and you know your username/password.
    2) Make sure your Sonoff switches are working in the Ewelink app and you know your username/password.
    3) Fire up an Ubuntu VM on AWS/Azure/GCP or even on a Pi or home PC. It can be really small like 512MB RAM and needs internet access
    4) Install docker in the linux vm. Follow something like this: https://kinsta.com/blog/install-docker-ubuntu/
    5) Someone wrote a nodejs gateway to mimic the calls done by the Ewelink App see: https://github.com/DoganM95/Ewelink-Rest-Api-Server I leverage this as a way to control the Sonoff Switches. To run this listening on port 8089 run this. It needs your Ewelink username/password you registered in the App so it can call into Ewelink servers: 
    docker run -d --restart=always -p 8089:3000 -e "EWELINK_USERNAME=yourusername" -e "EWELINK_PASSWORD=yourpassword" -e "EWELINK_REGION=eu" -e "PASSWORD_HASHING_ALGORITHM=sha512" -e "SERVER_MODE=prod" doganm95/ewelink-rest-api-server 6) Test you can turn a switch on like this (Replace "Your Switch Name" with the switch name as it appears in the Ewelink App):
    curl -m20 -sX POST "http://localhost:8089" -H "content-type: application/json" -d"{\"devicenameincludes\":[\"Your Switch Name\"],\"params\":{\"switch\":\"on\"}}" 7) Install a json parser utility:
    sudo apt install jq 8. In your home folder add the attached script.sh and make it executable with chmod +x ./script.sh
    9) In the script set your Sunsynk connect username and password on rows 4 & 5 for SUNSYNK_USER and SUNSYNK_PASS. Then set SUNSYNK_PLANT on row 6 with the plant ID you see if you login to sunsynk connect in your browser. E.g. mine is 88663:

    9) Create a cron schedule to run the script every 5 minutes: crontab -e -> then add a row like this: */5 * * * * /home/ubuntu/script.sh >> /home/ubuntu/solar.log
    10) Edit the script to suit your needs and refer to your Sonoff switch names. I've got a simple example of a switch called "My Switch" that will turn on if we have excess power and Off if we don't. If you don't know what going on, ping me with your switch names and basic rules and I can help. You have a huge amount of control. I have some fairly complex rules around hour of day etc.
    11) To see what the script is doing, run tail -f /home/ubuntu/solar.log
     
    I'd love it if this is useful to anyone so let me know if you need help and add any things I might have missed to make the instructions foolproof. My script generates a basic HTML page of the current status but I deleted that part as it just makes the script more complex than necessary. Anyone with basic bash scripting can go wild. If you comfortable with python or something else then use that - its really just some HTTP GET and POST commands surrounded with JSON parsing.
    script.sh
  3. Thanks
    paulcb got a reaction from Blouwildebees in Toggle Sonoff Switches based on Sunsynk Data   
    After some experimenting, I've come up with a reliable way to turn various Sonoff Switches on/off based on current Sunsynk stats such as SOV, Grid load, Solar generation, time of day etc. It even has a simple dashboard I'm displaying on an old phone stuck to the wall so that the family knows when is a good time to fire up the washing machine, dishwasher etc. I have various rules (in a bash script) that looks at the Sunsynk stats every 5 minutes and takes decisions on what to turn on/off based on current conditions. This is especially useful if like me you have the entire house on essential load and want fine-grained control of where excess power is used, while minimising Eskom usage.
    Sonoff switches are like R150 so it does not break the bank to add this level of automation. For the geyser, I have a 20A Sonoff which is a bit more but not crazy price.
    In my basic searching, I'm not sure if anyone has done this before as I have seen posts about waiting for the Sunsynk smart switch to do this kind of thing. If this is novel and people would like to know how to get this right, please let me know and I'll do a write up. I didn't want to do a long post, only to find that I've reinvented the wheel.

     
     
  4. Like
    paulcb got a reaction from slipx in Toggle Sonoff Switches based on Sunsynk Data   
    Ok sure. Here goes. This assumes you know some basic linux. If not maybe this is not for you but perhaps I can help if needed:
    1) Make sure your Sunsynk connect App is working and you know your username/password.
    2) Make sure your Sonoff switches are working in the Ewelink app and you know your username/password.
    3) Fire up an Ubuntu VM on AWS/Azure/GCP or even on a Pi or home PC. It can be really small like 512MB RAM and needs internet access
    4) Install docker in the linux vm. Follow something like this: https://kinsta.com/blog/install-docker-ubuntu/
    5) Someone wrote a nodejs gateway to mimic the calls done by the Ewelink App see: https://github.com/DoganM95/Ewelink-Rest-Api-Server I leverage this as a way to control the Sonoff Switches. To run this listening on port 8089 run this. It needs your Ewelink username/password you registered in the App so it can call into Ewelink servers: 
    docker run -d --restart=always -p 8089:3000 -e "EWELINK_USERNAME=yourusername" -e "EWELINK_PASSWORD=yourpassword" -e "EWELINK_REGION=eu" -e "PASSWORD_HASHING_ALGORITHM=sha512" -e "SERVER_MODE=prod" doganm95/ewelink-rest-api-server 6) Test you can turn a switch on like this (Replace "Your Switch Name" with the switch name as it appears in the Ewelink App):
    curl -m20 -sX POST "http://localhost:8089" -H "content-type: application/json" -d"{\"devicenameincludes\":[\"Your Switch Name\"],\"params\":{\"switch\":\"on\"}}" 7) Install a json parser utility:
    sudo apt install jq 8. In your home folder add the attached script.sh and make it executable with chmod +x ./script.sh
    9) In the script set your Sunsynk connect username and password on rows 4 & 5 for SUNSYNK_USER and SUNSYNK_PASS. Then set SUNSYNK_PLANT on row 6 with the plant ID you see if you login to sunsynk connect in your browser. E.g. mine is 88663:

    9) Create a cron schedule to run the script every 5 minutes: crontab -e -> then add a row like this: */5 * * * * /home/ubuntu/script.sh >> /home/ubuntu/solar.log
    10) Edit the script to suit your needs and refer to your Sonoff switch names. I've got a simple example of a switch called "My Switch" that will turn on if we have excess power and Off if we don't. If you don't know what going on, ping me with your switch names and basic rules and I can help. You have a huge amount of control. I have some fairly complex rules around hour of day etc.
    11) To see what the script is doing, run tail -f /home/ubuntu/solar.log
     
    I'd love it if this is useful to anyone so let me know if you need help and add any things I might have missed to make the instructions foolproof. My script generates a basic HTML page of the current status but I deleted that part as it just makes the script more complex than necessary. Anyone with basic bash scripting can go wild. If you comfortable with python or something else then use that - its really just some HTTP GET and POST commands surrounded with JSON parsing.
    script.sh
  5. Like
    paulcb got a reaction from uDuWaR in Toggle Sonoff Switches based on Sunsynk Data   
    Ok sure. Here goes. This assumes you know some basic linux. If not maybe this is not for you but perhaps I can help if needed:
    1) Make sure your Sunsynk connect App is working and you know your username/password.
    2) Make sure your Sonoff switches are working in the Ewelink app and you know your username/password.
    3) Fire up an Ubuntu VM on AWS/Azure/GCP or even on a Pi or home PC. It can be really small like 512MB RAM and needs internet access
    4) Install docker in the linux vm. Follow something like this: https://kinsta.com/blog/install-docker-ubuntu/
    5) Someone wrote a nodejs gateway to mimic the calls done by the Ewelink App see: https://github.com/DoganM95/Ewelink-Rest-Api-Server I leverage this as a way to control the Sonoff Switches. To run this listening on port 8089 run this. It needs your Ewelink username/password you registered in the App so it can call into Ewelink servers: 
    docker run -d --restart=always -p 8089:3000 -e "EWELINK_USERNAME=yourusername" -e "EWELINK_PASSWORD=yourpassword" -e "EWELINK_REGION=eu" -e "PASSWORD_HASHING_ALGORITHM=sha512" -e "SERVER_MODE=prod" doganm95/ewelink-rest-api-server 6) Test you can turn a switch on like this (Replace "Your Switch Name" with the switch name as it appears in the Ewelink App):
    curl -m20 -sX POST "http://localhost:8089" -H "content-type: application/json" -d"{\"devicenameincludes\":[\"Your Switch Name\"],\"params\":{\"switch\":\"on\"}}" 7) Install a json parser utility:
    sudo apt install jq 8. In your home folder add the attached script.sh and make it executable with chmod +x ./script.sh
    9) In the script set your Sunsynk connect username and password on rows 4 & 5 for SUNSYNK_USER and SUNSYNK_PASS. Then set SUNSYNK_PLANT on row 6 with the plant ID you see if you login to sunsynk connect in your browser. E.g. mine is 88663:

    9) Create a cron schedule to run the script every 5 minutes: crontab -e -> then add a row like this: */5 * * * * /home/ubuntu/script.sh >> /home/ubuntu/solar.log
    10) Edit the script to suit your needs and refer to your Sonoff switch names. I've got a simple example of a switch called "My Switch" that will turn on if we have excess power and Off if we don't. If you don't know what going on, ping me with your switch names and basic rules and I can help. You have a huge amount of control. I have some fairly complex rules around hour of day etc.
    11) To see what the script is doing, run tail -f /home/ubuntu/solar.log
     
    I'd love it if this is useful to anyone so let me know if you need help and add any things I might have missed to make the instructions foolproof. My script generates a basic HTML page of the current status but I deleted that part as it just makes the script more complex than necessary. Anyone with basic bash scripting can go wild. If you comfortable with python or something else then use that - its really just some HTTP GET and POST commands surrounded with JSON parsing.
    script.sh
  6. Like
    paulcb got a reaction from mzezman in Toggle Sonoff Switches based on Sunsynk Data   
    Ok sure. Here goes. This assumes you know some basic linux. If not maybe this is not for you but perhaps I can help if needed:
    1) Make sure your Sunsynk connect App is working and you know your username/password.
    2) Make sure your Sonoff switches are working in the Ewelink app and you know your username/password.
    3) Fire up an Ubuntu VM on AWS/Azure/GCP or even on a Pi or home PC. It can be really small like 512MB RAM and needs internet access
    4) Install docker in the linux vm. Follow something like this: https://kinsta.com/blog/install-docker-ubuntu/
    5) Someone wrote a nodejs gateway to mimic the calls done by the Ewelink App see: https://github.com/DoganM95/Ewelink-Rest-Api-Server I leverage this as a way to control the Sonoff Switches. To run this listening on port 8089 run this. It needs your Ewelink username/password you registered in the App so it can call into Ewelink servers: 
    docker run -d --restart=always -p 8089:3000 -e "EWELINK_USERNAME=yourusername" -e "EWELINK_PASSWORD=yourpassword" -e "EWELINK_REGION=eu" -e "PASSWORD_HASHING_ALGORITHM=sha512" -e "SERVER_MODE=prod" doganm95/ewelink-rest-api-server 6) Test you can turn a switch on like this (Replace "Your Switch Name" with the switch name as it appears in the Ewelink App):
    curl -m20 -sX POST "http://localhost:8089" -H "content-type: application/json" -d"{\"devicenameincludes\":[\"Your Switch Name\"],\"params\":{\"switch\":\"on\"}}" 7) Install a json parser utility:
    sudo apt install jq 8. In your home folder add the attached script.sh and make it executable with chmod +x ./script.sh
    9) In the script set your Sunsynk connect username and password on rows 4 & 5 for SUNSYNK_USER and SUNSYNK_PASS. Then set SUNSYNK_PLANT on row 6 with the plant ID you see if you login to sunsynk connect in your browser. E.g. mine is 88663:

    9) Create a cron schedule to run the script every 5 minutes: crontab -e -> then add a row like this: */5 * * * * /home/ubuntu/script.sh >> /home/ubuntu/solar.log
    10) Edit the script to suit your needs and refer to your Sonoff switch names. I've got a simple example of a switch called "My Switch" that will turn on if we have excess power and Off if we don't. If you don't know what going on, ping me with your switch names and basic rules and I can help. You have a huge amount of control. I have some fairly complex rules around hour of day etc.
    11) To see what the script is doing, run tail -f /home/ubuntu/solar.log
     
    I'd love it if this is useful to anyone so let me know if you need help and add any things I might have missed to make the instructions foolproof. My script generates a basic HTML page of the current status but I deleted that part as it just makes the script more complex than necessary. Anyone with basic bash scripting can go wild. If you comfortable with python or something else then use that - its really just some HTTP GET and POST commands surrounded with JSON parsing.
    script.sh
  7. Thanks
    paulcb got a reaction from Matthys Koch in Toggle Sonoff Switches based on Sunsynk Data   
    Ok sure. Here goes. This assumes you know some basic linux. If not maybe this is not for you but perhaps I can help if needed:
    1) Make sure your Sunsynk connect App is working and you know your username/password.
    2) Make sure your Sonoff switches are working in the Ewelink app and you know your username/password.
    3) Fire up an Ubuntu VM on AWS/Azure/GCP or even on a Pi or home PC. It can be really small like 512MB RAM and needs internet access
    4) Install docker in the linux vm. Follow something like this: https://kinsta.com/blog/install-docker-ubuntu/
    5) Someone wrote a nodejs gateway to mimic the calls done by the Ewelink App see: https://github.com/DoganM95/Ewelink-Rest-Api-Server I leverage this as a way to control the Sonoff Switches. To run this listening on port 8089 run this. It needs your Ewelink username/password you registered in the App so it can call into Ewelink servers: 
    docker run -d --restart=always -p 8089:3000 -e "EWELINK_USERNAME=yourusername" -e "EWELINK_PASSWORD=yourpassword" -e "EWELINK_REGION=eu" -e "PASSWORD_HASHING_ALGORITHM=sha512" -e "SERVER_MODE=prod" doganm95/ewelink-rest-api-server 6) Test you can turn a switch on like this (Replace "Your Switch Name" with the switch name as it appears in the Ewelink App):
    curl -m20 -sX POST "http://localhost:8089" -H "content-type: application/json" -d"{\"devicenameincludes\":[\"Your Switch Name\"],\"params\":{\"switch\":\"on\"}}" 7) Install a json parser utility:
    sudo apt install jq 8. In your home folder add the attached script.sh and make it executable with chmod +x ./script.sh
    9) In the script set your Sunsynk connect username and password on rows 4 & 5 for SUNSYNK_USER and SUNSYNK_PASS. Then set SUNSYNK_PLANT on row 6 with the plant ID you see if you login to sunsynk connect in your browser. E.g. mine is 88663:

    9) Create a cron schedule to run the script every 5 minutes: crontab -e -> then add a row like this: */5 * * * * /home/ubuntu/script.sh >> /home/ubuntu/solar.log
    10) Edit the script to suit your needs and refer to your Sonoff switch names. I've got a simple example of a switch called "My Switch" that will turn on if we have excess power and Off if we don't. If you don't know what going on, ping me with your switch names and basic rules and I can help. You have a huge amount of control. I have some fairly complex rules around hour of day etc.
    11) To see what the script is doing, run tail -f /home/ubuntu/solar.log
     
    I'd love it if this is useful to anyone so let me know if you need help and add any things I might have missed to make the instructions foolproof. My script generates a basic HTML page of the current status but I deleted that part as it just makes the script more complex than necessary. Anyone with basic bash scripting can go wild. If you comfortable with python or something else then use that - its really just some HTTP GET and POST commands surrounded with JSON parsing.
    script.sh

Account

Navigation

Search

Search

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.