Skip to content

Commit

Permalink
Merge pull request #86 from ckvsoft/dev
Browse files Browse the repository at this point in the history
Dev
  • Loading branch information
christian1980nrw authored Oct 16, 2023
2 parents ef14d8e + ddf40d7 commit 584e435
Show file tree
Hide file tree
Showing 3 changed files with 48 additions and 44 deletions.
1 change: 1 addition & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
config.txt linguist-language=Shell
80 changes: 41 additions & 39 deletions scripts/config.txt
Original file line number Diff line number Diff line change
@@ -1,26 +1,26 @@
##### Configuration part...

# Switchable Sockets Setup (AVM Fritz DECT200/210 wireless sockets) if used (tested with FRITZ!OS: 07.29).
# Switchable Sockets Setup (AVM Fritz DECT200/210 wireless sockets) if used (tested with FRITZ!OS: 07.29).

use_fritz_dect_sockets=0 # please activate with 1 or deactivate this socket-type with 0
fbox="192.168.178.1"
user="fritz1234"
passwd="YOURPASSWORD"
sockets=("YOURSOCKETID" "0" "0" "0" "0" "0")

# Switchable Sockets Setup (Shelly Wifi Plugs) (tested with Shelly Plug S Firmware 20230109-114426/v1.12.2-g32055ee)
# Switchable Sockets Setup (Shelly Wifi Plugs) (tested with Shelly Plug S Firmware 20230109-114426/v1.12.2-g32055ee)
use_shelly_wlan_sockets=0 # please activate with 1 or deactivate this socket-type with 0
shelly_ips=("192.168.178.89" "0" "0") # add multiple Shellys if you like, dont forget to make the ips static in your router
shellyuser="admin"
shellypasswd="YOURPASSWORD" # only if used

# Solar Charger Setup (tested with Victron Venus OS)
# Solar Charger Setup (tested with Victron Venus OS)
use_victron_charger=0 # please activate with 1 or deactivate this charger-type with 0
energy_loss_percent=23.3 # Enter how much percent of the energy is lost by the charging and discharging process.
battery_lifecycle_costs_cent_per_kwh=4.444444 # If you are using a chinese 5KWh LifePo4 battery (4.5 KWh useable) with 6000 cycles and the rebuying price is at 1200 EUR, the calculation will be 1200*100/6000/4,5.
economic_check=2 # Set to 1 or 2. Current price + energy loss + battery lifecycle costs will be compared with (1 = highest_price / 2 = average_price) and aborted if charging makes no sense.

#Please change prices (always use Cent/kWh, no matter if youre using Awattar (displaying Cent/kWh) or Entsoe API (displaying EUR/MWh) / net prices excl. tax).
#Please change prices (always use Cent/kWh, no matter if youre using Awattar (displaying Cent/kWh) or Entsoe API (displaying EUR/MWh) / net prices excl. tax).
stop_price=4.1 # stop above this price
start_price=2.0 # start below this price
feedin_price=9.87 # your feed-in-tariff of your solar system
Expand All @@ -45,55 +45,57 @@ charge_at_sixth_lowest_price=0
switchablesockets_at_sixth_lowest_price=0
TZ='Europe/Amsterdam' # Set Correct Timezone
select_pricing_api=1 # Set to
# 1 for aWATTar or
# 2 for entsoe or
# 3 for Tibber
#
# Note:
# aWATTar: Provides only germany DE-LU or Austrian AT prices, but no API key needed
# Entsoe: Many more countrys available but free API key needed, see https://www.entsoe.eu/data/map/
# 1 for aWATTar or
# 2 for entsoe or
# 3 for Tibber
#
# Note:
# aWATTar: Provides only germany DE-LU or Austrian AT prices, but no API key needed
# Entsoe: Many more countrys available but free API key needed, see https://www.entsoe.eu/data/map/
include_second_day=0 # Set to 0 to compare only the today prices.
# Set include_second_day to 1 to compare today & tomorrow prices if they become available (today in the afternoon).
# Please note: If you activate this and the prices decrease over several days,
# it is possible that there will be no charging or switching for several days until the lowest prices are reached.
# Set include_second_day to 1 to compare today & tomorrow prices if they become available (today in the afternoon).
# Please note: If you activate this and the prices decrease over several days,
# it is possible that there will be no charging or switching for several days until the lowest prices are reached.

# Please set up Solar weather API to query solar yield

# Please set up Solar weather API to query solar yield
use_solarweather_api_to_abort=0
abort_solar_yield_today=3.5 # Abort and never charge because we are expecting enough sun today (daily megajoule per squaremeter)
abort_solar_yield_tomorrow=10.0 # Abort and never charge because we are expecting enough sun tomorrow (daily megajoule per squaremeter)
# To find the kilowatt hour value from megajoules, divide by 3.6.
# To find the kilowatt hour value from megajoules, divide by 3.6.
abort_suntime=700 # Abort and never charge if we have more sun minutes per day as this value (time in minutes between sunrise and sunset)
latitude=51.530600 # Your location
longitude=7.860575
# You can use Google Maps to find the latitude and longitude of a location by searching for the address or location and then right-clicking
# on the location on the map. A pop-up menu will appear with the option to "What's here?" which will display the latitude and longitude of that location.
# You can use Google Maps to find the latitude and longitude of a location by searching for the address or location and then right-clicking
# on the location on the map. A pop-up menu will appear with the option to "What's here?" which will display the latitude and longitude of that location.
visualcrossing_api_key=YOURAPIKEY # Get your free key at https://www.visualcrossing.com/sign-up No credit card is required to sign up for your free 1000 records per day.

# Awattar API setup
# Awattar API setup
awattar=de # Set to de for Germany or at for Austria (no other countrys available, for other countrys use Entsoe API)

# Entsoe API setup
# To find out your in and out domain key, go to https://www.entsoe.eu/data/energy-identification-codes-eic/eic-area-codes-map/ to find the Bidding Zone or open https://eepublicdownloads.entsoe.eu/clean-documents/EDI/Library/Market_Areas_v2.1.pdf and get the Market Balance Area code of your country.
# Entsoe API setup
# To find out your in and out domain key, go to https://www.entsoe.eu/data/energy-identification-codes-eic/eic-area-codes-map/ to find the Bidding Zone or open https://eepublicdownloads.entsoe.eu/clean-documents/EDI/Library/Market_Areas_v2.1.pdf and get the Market Balance Area code of your country.

in_Domain=10Y1001A1001A82H # this is for Germany DE-LU
out_Domain=10Y1001A1001A82H # Example: Spain is 10YES-REE------0
entsoe_eu_api_security_token=YOURAPIKEY
# How to get the free api_security_token:
# 1. Go to https://transparency.entsoe.eu/ , click Login --> Register and create a Account.
# 2. Send an email to [email protected] with “Restful API access” in the subject line.
# Indicate the email address you entered during registration in the email body.
# 3. The ENTSO-E Helpdesk will make their best efforts to respond to your request within 3 working days.
# 4. Afterwards you can generate a security token at https://transparency.entsoe.eu/usrm/user/myAccountSettings
# The ENTSO-E Transparency Platform aims to provide free, continuous access to pan-European electricity market data for all users.
# How to get the free api_security_token:
# 1. Go to https://transparency.entsoe.eu/ , click Login --> Register and create a Account.
# 2. Send an email to [email protected] with “Restful API access” in the subject line.
# Indicate the email address you entered during registration in the email body.
# 3. The ENTSO-E Helpdesk will make their best efforts to respond to your request within 3 working days.
# 4. Afterwards you can generate a security token at https://transparency.entsoe.eu/usrm/user/myAccountSettings
# The ENTSO-E Transparency Platform aims to provide free, continuous access to pan-European electricity market data for all users.

# Tibber API setup
# To get the tibber_api_key
# 1. log in with a free or customer Tibber account at https://developer.tibber.com/settings/access-token .
# 2. Create a token by selecting the scopes you need (select "price").
# 3. Use this link to create a free account with your smartphone. https://tibber.com/de/invite/ojgfbx2e
# Currently no contract is needed to create a free Account that is able to access the API.
# 4. Put your API Key into the function get_tibber_api() at the controller.sh file.
# Tibber API setup
# To get the tibber_api_key
# 1. log in with a free or customer Tibber account at https://developer.tibber.com/settings/access-token .
# 2. Create a token by selecting the scopes you need (select "price").
# 3. Use this link to create a free account with your smartphone. https://tibber.com/de/invite/ojgfbx2e
# Currently no contract is needed to create a free Account that is able to access the API.
tibber_prices=energy # Set to
# "energy" to use the spotmarket-prices (default), set to
# "total" to use the total prices including taxes and fees, set to
# "tax" to use only the taxes and fees
tibber_api_key="YOUR_ACTUAL_API_KEY" # replace this value with your API Key

tibber_prices=energy # Set to
# "energy" to use the spotmarket-prices (default), set to
# "total" to use the total prices including taxes and fees, set to
# "tax" to use only the taxes and fees
11 changes: 6 additions & 5 deletions scripts/controller.sh
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ source "$DIR/config.txt"
get_tibber_api() {
curl --location --request POST 'https://api.tibber.com/v1-beta/gql' \
--header 'Content-Type: application/json' \
--header 'Authorization: Bearer YOUR_API_KEY_HERE' \
--header "Authorization: Bearer $tibber_api_key" \
--data-raw '{"query":"{viewer{homes{currentSubscription{priceInfo{current{total energy tax startsAt}today{total energy tax startsAt}tomorrow{total energy tax startsAt}}}}}}"}' |
awk '{
gsub(/"current":/, "\n&");
Expand Down Expand Up @@ -238,13 +238,14 @@ for tool in $tools; do
if ! which "$tool" >/dev/null; then
echo "E: Please ensure the tool '$tool' is found."
num_tools_missing=$((num_tools_missing + 1))
exit 1
fi
done
if [ 0 -lt $num_tools_missing ]; then
echo "E: Found $num_tools_missing tool(s) missing."
exit 1

if [ $num_tools_missing -gt 0 ]; then
echo "E: $num_tools_missing tools are missing."
exit 1
fi

unset num_tools_missing

########## Begin of the script...
Expand Down

0 comments on commit 584e435

Please sign in to comment.