Compare commits

..

6 Commits

Author SHA1 Message Date
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
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
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
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
3 changed files with 37 additions and 17 deletions

View File

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

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 requirements.txt /
COPY init.sh / COPY init.sh /
RUN chmod +x /init.sh RUN apt update && apt install python3 python3-pip -y && pip3 install -r /requirements.txt --break-system-packages && apt clean
RUN chmod +x /usr/local/bin/enphase.py COPY enphase.py /usr/local/bin/
RUN pip3 install -r /requirements.txt RUN chmod +x /init.sh && chmod +x /usr/local/bin/enphase.py
RUN apt clean
CMD ["/init.sh"] CMD ["/init.sh"]

View File

@@ -171,18 +171,42 @@ while True:
session.headers.update({"Authorization":"Bearer "+enphasetoken}) session.headers.update({"Authorization":"Bearer "+enphasetoken})
details = enphaseurl + "/production.json?details=1" details = enphaseurl + "/production.json?details=1"
inverteruri= enphaseurl + "/api/v1/production/inverters" inverteruri= enphaseurl + "/api/v1/production/inverters"
mainresponse = session.get(details,verify=False).json() mainresponse = session.get(details,verify=False)
inverterresponse = session.get(inverteruri,verify=False).json() if mainresponse.status_code == 401:
#print(json.dumps(mainresponse,indent=1)) print("Authentication Error, please renew enphase token at https://entrez.enphaseenergy.com/entrez_tokens")
for inverterdata in inverterresponse: 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']) myinverter = inverter(inverterdata['serialNumber'],inverterdata['lastReportDate'],inverterdata['devType'],inverterdata['lastReportWatts'],inverterdata['maxReportWatts'])
inverterlist.append(myinverter) inverterlist.append(myinverter)
#print(json.dumps(response.json(),indent=1)) #print(json.dumps(response.json(),indent=1))
#for myinverter in inverterlist: #for myinverter in inverterlist:
#pass #pass
# myinverter.print() # myinverter.print()
print(json.dumps(mainresponse,indent=1)) #print(json.dumps(mainresponse,indent=1))
maindata = ElectricalData(mainresponse) maindata = ElectricalData(mainresponseresult)
influxsession = requests.Session() influxsession = requests.Session()
influxsession.verify = False influxsession.verify = False
influxsession.auth = (infdbuser, infdbpass) influxsession.auth = (infdbuser, infdbpass)