tedpearson / electric-usage-downloader

Import smart meter metrics from smarthub into VictoriaMetrics or InfluxDB
MIT License
24 stars 1 forks source link

Translating API call to python results in error message #5

Closed ethanous closed 5 months ago

ethanous commented 5 months ago

Really not an issue, more like a question. I've been trying to convert your code to python and then set it up to send MQTT messages so that home assistant can utilize the data. However, i keep getting "Your request could not be completed. If the problem persists, please contact customer service." Im thinking it has something to do with the poll_request body data, but not 100%. I'm able to get a authorization token without any issues. printing out the headers and the poll_request data looks the same as yours, but i keep getting that error. I was curious if you saw that while developing your tool and what you did to resolve it. I can copy and paste code into here if it'll help.

ethanous commented 5 months ago

nvm, i found the issue. thanks for all your work, its made what im doing so much easier.

tedpearson commented 5 months ago

Glad my code was able to help you! 😄

schlick7 commented 1 month ago

nvm, i found the issue. thanks for all your work, its made what im doing so much easier.

Commenting in hopes @ethanous sees this. I am also interested in getting this data into Home Assistant, get anything working?

ethanous commented 1 month ago

Currently my solution is more manual than I'd like to admit. I have a python script that will download the data from NISC and then output it into csv format. That data is then copy and pasted into a file on the box running home assistant. You can use the File Editor add-on to accomplish this. Then using the Import statistics Add-on (https://github.com/klausj1/homeassistant-statistics) i can point it towards my text file and it will ingest all of the data for the last almost 60 days. I started turning this into a proper HA add-on, but never got far on it as life kept pulling me away. I'd be happy to share my python code though if anyone is interested.

I played with pushing it directly to HA via both API calls and MQTT, but the data would come in as the date/time of the ingest, and not when NISC reported it actually being used. That's where the import statistics came into play. It allowed for ingestion of data at as if it came in at the specified date/time NISC reported.