StefaE / PVForecast

Forecasts to optimize electricity consumption for rooftop PV (photo-voltaic) installations
GNU General Public License v3.0
50 stars 13 forks source link

Authentication support for Influx v1.x #6

Closed StefaE closed 3 years ago

StefaE commented 3 years ago

Hello, thank you very much for sharing this nice tool. I have a question/issue - I do have authentification enabled in Influxdb and would like to use the Solcast (light) python script, but I failed, since I cannot write into the database and getting an authentication error. I not very familiar with Python, but what I already tried is to add username and pwd to the config file and added these arguments into the "inlflux.py" file in the init section:

 def __init__(self, config):
         self.config     = config
         self._host      = self.config['Influx'].get('host', 'localhost')
         self._port      = self.config['Influx'].getint('port', 8086)
         self._database  = self.config['Influx'].get('database', None)
         self._token     = self.config['Influx'].get('token', None)
     self._username  = self.config['Influx'].get('username', None)
         self._password     = self.config['Influx'].get('password', None)
         self._org       = self.config['Influx'].get('org', None)
         self._influx_V2 = self.config['Influx'].getboolean('influx_v2', False)

This did not help -> same authentifcation error. Any idea? Thank you

Edit: I am using Influxdb 1.8

Originally posted by @miurlit in https://github.com/StefaE/PVForecast/discussions/5

StefaE commented 3 years ago

Hi Miurlit, the start was good: That way you can put username and password into the config.ini file. But we also need use them :-)

Can you try influx.py from the development branch?

Pls. let me know if it works.

Stefan

PS: Note that I still assume that you are on a home network and I don't use SSL encryption for the password - that would only make sense if your host also had the required certificate to verify the encryption.

miurlit commented 3 years ago

Perfect, thanks for the fast response, now everything is working!

StefaE commented 3 years ago

Thx for confirmation - in case you do posting of PV actuals to SolCast, I inadvertently had a bug in the file influx.py posted yesterday. Fixed now. If you don't post - no need to worry.

Will merge to trunk shortly.

miurlit commented 3 years ago

Yes, I did see the bug on the POST in the influx.py, but I fixed it already when I had seen the error message ;-) Thanks once again!

StefaE commented 3 years ago

Changes committed to Version-1.02.

Thx. for bringing this to my attention