Compare commits

..

18 Commits

Author SHA1 Message Date
dfb87fad9b Merge pull request 'work' (#7) from work into main
Reviewed-on: #7
2025-08-18 18:53:17 +00:00
72325374f3 adding break system packages flag for container image
All checks were successful
/ Plan (push) Successful in 4m24s
/ Plan (pull_request) Successful in 27s
/ Deploy (pull_request) Successful in 27s
2025-08-18 13:48:26 -05:00
4c9d9ad7eb updating to trixie
Some checks failed
/ Plan (push) Failing after 4m4s
2025-08-18 13:41:56 -05:00
0442f586e4 Merge pull request 'work' (#6) from work into main
Reviewed-on: #6
2025-08-18 18:24:51 +00:00
2cf2dabe71 trying a flattened approach to dockerfile
All checks were successful
/ Plan (push) Successful in 4m50s
/ Plan (pull_request) Successful in 28s
/ Deploy (pull_request) Successful in 27s
2025-08-18 13:18:41 -05:00
de8db51676 adding auth checking and exiting to the script when auth token is invalid.
All checks were successful
/ Plan (push) Successful in 6m27s
2025-08-18 13:11:29 -05:00
a235bc46ba Merge pull request '.' (#5) from work into main
Reviewed-on: #5
2024-11-26 11:53:05 -06:00
0fa5a92086 .
All checks were successful
/ Plan (push) Successful in 8s
/ Plan (pull_request) Successful in 7s
/ Deploy (pull_request) Successful in 12s
2024-11-26 11:52:47 -06:00
db460df4a9 Merge pull request 'missed renaming container' (#4) from work into main
Reviewed-on: #4
2024-11-26 10:36:39 -06:00
bd9444f38c missed renaming container
Some checks failed
/ Plan (push) Successful in 12s
/ Plan (pull_request) Successful in 16s
/ Deploy (pull_request) Failing after 0s
2024-11-26 10:34:23 -06:00
3f47a4640d Merge pull request 'work' (#3) from work into main
Reviewed-on: #3
2024-11-26 10:31:12 -06:00
1527935c8a Updating pushbuild
Some checks failed
/ Plan (push) Successful in 1m14s
/ Plan (pull_request) Successful in 14s
/ Deploy (pull_request) Failing after 2s
2024-11-26 10:26:55 -06:00
9e7753645d switch deploy run
All checks were successful
/ Plan (push) Successful in 7s
2024-11-26 10:14:43 -06:00
e45ca1b2d3 Merge pull request 'updates' (#2) from work into main
Reviewed-on: #2
2024-11-26 10:13:06 -06:00
ac230bf35a updates
Some checks failed
/ Plan (push) Successful in 44s
/ Plan (pull_request) Has been cancelled
/ Deploy (pull_request) Has been cancelled
2024-11-26 10:12:11 -06:00
1402c07e70 Merge pull request 'work' (#1) from work into main
Reviewed-on: #1
2024-11-26 10:05:46 -06:00
87d5b2fddd fix typo
All checks were successful
/ Plan (push) Successful in 42s
/ Plan (pull_request) Successful in 9s
/ Deploy (pull_request) Successful in 39s
2024-11-26 10:04:26 -06:00
b6f433d13c get rid of unneeded volumes
Some checks failed
/ Plan (push) Failing after 1m45s
2024-11-26 10:01:47 -06:00
5 changed files with 48 additions and 27 deletions

View File

@@ -26,4 +26,4 @@ jobs:
run: |
echo "${{ secrets.GITEASECRET_TOKEN }}" | docker login git.hamik.net -u paradizelost --password-stdin
docker build -t git.hamik.net/paradizelost/enphase:dev .
docker push git.hamik.net/paradizelost/enphse:dev
docker push git.hamik.net/paradizelost/enphase:dev

View File

@@ -7,7 +7,6 @@ on:
jobs:
Plan:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
@@ -20,14 +19,14 @@ jobs:
- name: Deploy
run: |
echo "${{ secrets.GITEASECRET_TOKEN }}" | docker login git.hamik.net -u paradizelost --password-stdin
docker build -t git.hamik.net/paradizelost/librarynotices:latest .
docker push git.hamik.net/paradizelost/librarynotices
docker build -t git.hamik.net/paradizelost/enphase:latest .
docker push git.hamik.net/paradizelost/enphase:latest
Deploy:
needs: [Plan] #
runs-on: librarynoticehost
needs: [Plan]
runs-on: enphasecollector
defaults:
run:
working-directory: /docker/librarynotices
working-directory: /docker/enphase
steps:
- name: Destroy Container
id: down

View File

@@ -1,11 +1,8 @@
FROM debian:bullseye-slim
FROM debian:trixie-slim
#
RUN apt update && apt install python3 python3-pip -y
COPY enphase.py /usr/local/bin/
COPY requirements.txt /
COPY init.sh /
RUN chmod +x /init.sh
RUN chmod +x /usr/local/bin/enphase.py
RUN pip3 install -r /requirements.txt
RUN apt clean
RUN apt update && apt install python3 python3-pip -y && pip3 install -r /requirements.txt --break-system-packages && apt clean
COPY enphase.py /usr/local/bin/
RUN chmod +x /init.sh && chmod +x /usr/local/bin/enphase.py
CMD ["/init.sh"]

View File

@@ -1,9 +1,11 @@
services:
libnotices:
enphase:
image: git.hamik.net/paradizelost/enphase:latest
container_name: libnotices
container_name: enphase
restart: always
ports:
- "80:80"
volumes:
- "./credentials:/var/www/.aws/credentials"
environment:
- ENPHASE_TOKEN=${ENPHASE_TOKEN}
- ENPHASE_URL=${ENPHASE_URL}
- INFLUX_USER=${INFLUX_USER}
- INFLUX_PASSWORD=${INFLUX_PASSWORD}
- INFLUX_URI=${INFLUX_URI}

View File

@@ -162,7 +162,6 @@ enphaseurl = os.environ["ENPHASE_URL"]
infdbuser = os.environ["INFLUX_USER"]
infdbpass = os.environ["INFLUX_PASSWORD"]
influxuri = os.environ["INFLUX_URI"]
infdbuser = os.environ["INFLUX_USER"]
while True:
@@ -172,18 +171,42 @@ while True:
session.headers.update({"Authorization":"Bearer "+enphasetoken})
details = enphaseurl + "/production.json?details=1"
inverteruri= enphaseurl + "/api/v1/production/inverters"
mainresponse = session.get(details,verify=False).json()
inverterresponse = session.get(inverteruri,verify=False).json()
#print(json.dumps(mainresponse,indent=1))
for inverterdata in inverterresponse:
mainresponse = session.get(details,verify=False)
if mainresponse.status_code == 401:
print("Authentication Error, please renew enphase token at https://entrez.enphaseenergy.com/entrez_tokens")
quit()
print("Status code:", mainresponse.status_code)
print("Headers:", mainresponse.headers)
print("Raw text:", mainresponse.text[:500])
try:
mainresponseresult = mainresponse.json()
print("Parsed JSON:\n", json.dumps(mainresponseresult, indent=2))
except Exception as e:
print("Failed to parse JSON:", e)
quit()
inverterresponse = session.get(inverteruri,verify=False)
if inverterresponse.status_code == 401:
print("Authentication Error, please renew enphase token at https://entrez.enphaseenergy.com/entrez_tokens")
quit()
print("Status code:", inverterresponse.status_code)
print("Headers:", inverterresponse.headers)
print("Raw text:", inverterresponse.text[:500])
try:
inverterresponseresult = inverterresponse.json()
print("Parsed JSON:\n", json.dumps(inverterresponseresult, indent=2))
except Exception as e:
print("Failed to parse JSON:", e)
quit()
for inverterdata in inverterresponseresult:
myinverter = inverter(inverterdata['serialNumber'],inverterdata['lastReportDate'],inverterdata['devType'],inverterdata['lastReportWatts'],inverterdata['maxReportWatts'])
inverterlist.append(myinverter)
#print(json.dumps(response.json(),indent=1))
#for myinverter in inverterlist:
#pass
# myinverter.print()
print(json.dumps(mainresponse,indent=1))
maindata = ElectricalData(mainresponse)
#print(json.dumps(mainresponse,indent=1))
maindata = ElectricalData(mainresponseresult)
influxsession = requests.Session()
influxsession.verify = False
influxsession.auth = (infdbuser, infdbpass)