Git Product home page Git Product logo

solar-output's Introduction

solar-output

solar energy output - photovoltaic system

There are several (3) options to monitor your solar energy output.

These notes describe the SAJ Sununo plus solar inverter.

Solar panels => solar inverter => rs232-to-ethernet module => router => LAN/internet.

Option 1. Use the android app of SAJ, and the login that you received during installation.
You can read the outputs and graphs which are posted from your solar inverter to a SAJ server in Alibaba Cloud.

Option 2. Scan with nmap/zenmap gui for the MAC-address and IP of your solar inverter.
Use your browser to go the overview on http://x.x.x.x

Option 3. Use Home Assistant https://www.home-assistant.io/integrations/saj/

Option 4. (this project) Make a script to post your energy output to your own database and/or pvoutput.org

My setup:

Hardware: Raspberry Pi 3 Model B Rev 1.2 https://www.raspberrypi.org/
Operating system: Raspbian 10 buster https://distrowatch.com/table.php?distribution=raspbian
Software: Bash 5.0.3, Python 3.7.3, Mariadb-server 10.3.17, Nmap 7.70
sudo apt-get install mariadb-server python3-requests python3-pymysql nmap

  1. Activate your API-Key on pvoutput.org
  2. Create your local database (optional)
CREATE DATABASE solar DEFAULT CHARACTER SET utf8 DEFAULT COLLATE utf8_general_ci;
use solar;
create table solar_output (
	time_stamp DATETIME PRIMARY KEY,
	pac1 INT,
	e_today FLOAT
);
  1. Edit config.py
  2. chmod +x solar-output.py
  3. sudo crontab -e

crontab for root: (yes root, otherwise nmap doesn't output everything you need)

*/10 * * * * /home/pi/solar/solar-output.py

solar-output's People

Contributors

dinfangion avatar mdv1973 avatar

Stargazers

 avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

solar-output's Issues

python TypeError

2019-09-12 17:39:02,000 INFO using nmap to find inverter
2019-09-12 17:39:07,343 WARNING TypeError : a bytes-like object is required, not 'str'
2019-09-12 17:39:07,343 ERROR Exception : unable to get inverter IP address
2019-09-12 17:39:07,344 INFO Done

to python3

--- solar-output.py (original)
+++ solar-output.py (refactored)
@@ -83,10 +83,10 @@
charset='utf8',
cursorclass=pymysql.cursors.DictCursor)
with db.cursor() as c:

  • columns = ','.join(data.keys())
  • value_holders = ','.join(('%s',)*len(data.keys()))
  • columns = ','.join(list(data.keys()))
  • value_holders = ','.join(('%s',)*len(list(data.keys())))
    sql = 'insert into %s (%s) values (%s)' % (cfg_db['table'], columns, value_holders)
  • c.execute(sql, data.values())
  • c.execute(sql, list(data.values()))
    db.commit()
    logging.info('data inserted in database')
    return

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.