1
0
Fork 0

„README.md“ ändern

This commit is contained in:
Manuel Kamper 2023-05-29 07:08:31 +00:00
parent 9bad3271be
commit 2648343c5f
1 changed files with 37 additions and 1 deletions

View File

@ -1,3 +1,39 @@
# Hoymiles-Solar-Database-FHEM
Queries the solar data from Hoymiles API and stores it in a database and shows it in FHEM.
Queries the solar data from Hoymiles API and stores it in a database and shows it in FHEM.
## Prerequisites
Make sure you have installed apache2 with php8.1 (and mysql extension). You need python3 too with mysql connector (python3 -m pip install mysql-connector-python).
## Create folders and rights
<code>mkdir /opt/hoymiles && mkdir /opt/hoymiles/www</code>
<code>chown -R fhem:dialout /opt/hoymiles/www</code>
## Upload files
Upload index.php into /opt/hoymiles/www folder. It acts as an JSON-API for serving data to FHEM.
Upload solar.py into /opt/hoymiles folder. It will gather data from Hoymiles API and stores it in the database.
## Create database
Use the script solar.sql to create your database for storing solar data. Make sure you configure the rights accordingly.
## Change values
In file index.php insert your database connection details. Do this also in solar.py, where you add also your Hoymiles credentials for login.
## Run python script as a service
## Apache mysql example
This example shows how to set up the JSON API in apache2.
<code></code>
## FHEM example
This is an example, how you can show the data in your FHEM instance.
<code>define Solar HTTPMOD 0
setuuid Solar 64744ab5-f33f-1b7d-ecc0-8b30ed24e4a4b55a
attr Solar event-on-change-reading .*
attr Solar extractAllJSON 1
attr Solar get01Name ReadSolarStats
attr Solar get01Poll 1
attr Solar get01URL http://your-automation-host/solarapi/index.php
attr Solar icon sani_solar
attr Solar room Solar
attr Solar stateFormat Current: current W, Today: today Wh</code>