Hmmm… Can’t retrieve query results via Pycharm IDE, but the URL query it generates seen in the error returns data when I paste it in my browser. Guessing I’m missing something basic. Will keep trying…
from influxdb import DataFrameClient
cli = DataFrameClient('http://192.168.x.xxx', 8086, 'homeassistant', 'MyPassword', 'home_assistant')
rs = cli.query('SELECT * FROM "Mbit/s"')
Query via browser:
http://192.168.1.XXX:8086/query?q=SELECT+*+FROM+"Mbit%2Fs"&db=home_assistant
browser response:
{“results”:[{“statement_id”:0,“series”:[{“name”:“Mbit/s”,“columns”:[“time”,“attribution_str”,“domain”,“entity_id”,“friendly_name_str”,“icon_str”,“value”],“values”:[[“2019-05-20T00:04:29.650247936Z”,null,“sensor”,“speedtest_download”,“Speedtest Download”,“mdi:speedometer”,4.12],[“2019-05-20T02:34:59.870418176Z”,null,“sensor”,“speedtest_download”,“Speedtest Download”,“mdi:speedometer”,4.34],[“2019-05-20T03:18:30.728969984Z”,null,“sensor”,“speedtest_download”,“Speedtest Download”,“mdi:speedometer”,9.51],[“2019-05-20T06:33:41.20925312Z”,null,“sensor”,“speedtest_download”,“Speedtest Download”,“mdi:speedometer”,13.86],["2019-05-
Traceback (most recent call last):
File "<input>", line 1, in <module>
File "C:\Users\mahko\Anaconda3\envs\LightingAnalysis\lib\site-packages\influxdb\_dataframe_client.py", line 194, in query
results = super(DataFrameClient, self).query(query, **query_args)
File "C:\Users\mahko\Anaconda3\envs\LightingAnalysis\lib\site-packages\influxdb\client.py", line 512, in query
response = self.request(
File "C:\Users\mahko\Anaconda3\envs\LightingAnalysis\lib\site-packages\influxdb\client.py", line 323, in request
response = self._session.request(
File "C:\Users\mahko\Anaconda3\envs\LightingAnalysis\lib\site-packages\requests\sessions.py", line 530, in request
resp = self.send(prep, **send_kwargs)
File "C:\Users\mahko\Anaconda3\envs\LightingAnalysis\lib\site-packages\requests\sessions.py", line 643, in send
r = adapter.send(request, **kwargs)
File "C:\Users\mahko\Anaconda3\envs\LightingAnalysis\lib\site-packages\requests\adapters.py", line 516, in send
raise ConnectionError(e, request=request)
requests.exceptions.ConnectionError: HTTPConnectionPool(host='http', port=80): Max retries exceeded with url: //192.168.1.XXX:8086/query?q=SELECT+%2A+FROM+%22Mbit%2Fs%22&db=home_assistant (Caused by NewConnectionError('<urllib3.connection.HTTPConnection object at 0x0009AB3A0>: Failed to establish a new connection: [Errno 11001] getaddrinfo failed'))