Compare commits
4 Commits
Author | SHA1 | Date | |
---|---|---|---|
d84b1aab3c | |||
e7622062e8 | |||
a11c64f79b | |||
ac32beed0a |
@ -1,5 +1,8 @@
|
|||||||
# SolarControl
|
# SolarControl
|
||||||
|
|
||||||
|

|
||||||
|

|
||||||
|
|
||||||
Enforce a zero export (or whatever consumption you like) policy with an OpenDTU-controlled inverter and energy data from MQTT.
|
Enforce a zero export (or whatever consumption you like) policy with an OpenDTU-controlled inverter and energy data from MQTT.
|
||||||
|
|
||||||
|
|
||||||
@ -42,6 +45,7 @@ docker login # login to docker hub
|
|||||||
docker buildx create --name buildx-multi-arch
|
docker buildx create --name buildx-multi-arch
|
||||||
docker buildx use buildx-multi-arch
|
docker buildx use buildx-multi-arch
|
||||||
docker buildx build --no-cache --platform linux/amd64,linux/386,linux/arm/v5,linux/arm/v7,linux/arm64/v8,linux/ppc64le,linux/s390x -t bluefox42/solarcontrol:<VERSION> -t bluefox42/solarcontrol:latest . --push
|
docker buildx build --no-cache --platform linux/amd64,linux/386,linux/arm/v5,linux/arm/v7,linux/arm64/v8,linux/ppc64le,linux/s390x -t bluefox42/solarcontrol:<VERSION> -t bluefox42/solarcontrol:latest . --push
|
||||||
|
docker logout # so that credentials are no longer stored in clear but are deleted
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|
||||||
|
@ -8,7 +8,6 @@ from time import time, sleep
|
|||||||
import json
|
import json
|
||||||
from threading import Thread
|
from threading import Thread
|
||||||
import requests
|
import requests
|
||||||
import urllib3 # only for exception handling
|
|
||||||
import math
|
import math
|
||||||
|
|
||||||
|
|
||||||
@ -49,7 +48,7 @@ dry_run = bool(int(os.getenv('DRY_RUN', 1)))
|
|||||||
|
|
||||||
# set other important variables
|
# set other important variables
|
||||||
power_limit_type = 1 # only set the limit temporary to avoid memory damage; see also: https://github.com/tbnobody/OpenDTU/discussions/742
|
power_limit_type = 1 # only set the limit temporary to avoid memory damage; see also: https://github.com/tbnobody/OpenDTU/discussions/742
|
||||||
version = "v1.0" # the version number
|
version = "v1.1" # the version number
|
||||||
|
|
||||||
# some checks for the correctness of supplied data
|
# some checks for the correctness of supplied data
|
||||||
if power_target_min < 0: power_target_min = 0
|
if power_target_min < 0: power_target_min = 0
|
||||||
@ -112,8 +111,8 @@ def threaded_solar_power_limit_setting():
|
|||||||
# Get current openDTU current limit status
|
# Get current openDTU current limit status
|
||||||
try:
|
try:
|
||||||
status = requests.get(opendtu_address.strip("/") + "/api/limit/status", auth=(opendtu_user, opendtu_pwd)).json().copy()
|
status = requests.get(opendtu_address.strip("/") + "/api/limit/status", auth=(opendtu_user, opendtu_pwd)).json().copy()
|
||||||
except (requests.exceptions.RequestException, urllib3.exceptions.HTTPError) as e:
|
except BaseException as e:
|
||||||
print(f"{bcolors.ERROR}Some error occured while trying to reach out to OpenDTU to get latest data about the inverter limit status. Skipping for now.{bcolors.ENDC}\n==== START OF EXCEPTION ====\n{e}\n==== END OF EXCEPTION ====")
|
print(f"{bcolors.FAIL}Some error occured while trying to reach out to OpenDTU to get latest data about the inverter limit status. Skipping for now.{bcolors.ENDC}\n==== START OF EXCEPTION ====\n{e}\n==== END OF EXCEPTION ====")
|
||||||
sleep(0.2) # wait some time (to avaid cpu overload on continuous unavailability of the service)
|
sleep(0.2) # wait some time (to avaid cpu overload on continuous unavailability of the service)
|
||||||
continue # skip this loop pass
|
continue # skip this loop pass
|
||||||
|
|
||||||
@ -162,7 +161,7 @@ def threaded_solar_power_limit_setting():
|
|||||||
else:
|
else:
|
||||||
print(f"{bcolors.WARNING}Now the new limit would be set via the API (but DRY_RUN is either not specified or True): {str(new_limit)}%")
|
print(f"{bcolors.WARNING}Now the new limit would be set via the API (but DRY_RUN is either not specified or True): {str(new_limit)}%")
|
||||||
elif status[opendtu_inverter_sn]["max_power"] == 0:
|
elif status[opendtu_inverter_sn]["max_power"] == 0:
|
||||||
print(f"{bcolors.ERROR}OpenDTU is reporting strange values for the inverter's maximum power output. Skipping it for now.{bcolors.ENDC}")
|
print(f"{bcolors.FAIL}OpenDTU is reporting strange values for the inverter's maximum power output. Skipping it for now.{bcolors.ENDC}")
|
||||||
|
|
||||||
|
|
||||||
while (time() - last_time) < limit_update_interval:
|
while (time() - last_time) < limit_update_interval:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user