addon-appdaemon icon indicating copy to clipboard operation
addon-appdaemon copied to clipboard

InfluxDB Import Error

Open Marty56 opened this issue 1 year ago • 2 comments

I am trying to use the influxdb package but the Import does not work. I am getting the following error

ImportError: cannot import name 'InfluxDBClient' from 'influxdb' (/config/apps/influxdb.py)

My test app is the following


import appdaemon.plugins.hass.hassapi as hass
import datetime
import json
import time
from influxdb import InfluxDBClient


class main(hass.Hass):
    def initialize(self):
        influxdb_server = "localhost"
        json_body = [
            {
                "measurement": "bezug",
                "time": "2009-11-10T23:00:00Z",
                "fields": {
                    "value": 0.64
                }
            }
        ]

        client = InfluxDBClient(influxdb_server, 8086, 'admin', 'admin', 'example')

        client.create_database('example')

        client.write_points(json_body)

        result = client.query('select value from bezug;')

        print("Result: {0}".format(result))

I have installed the "influxdb" package under Configuration and the respective tab "Python Packages" and it seems that it was installed correctly

Looking in indexes: https://pypi.org/simple, https://wheels.home-assistant.io/musllinux-index/
Collecting influxdb
  Downloading influxdb-5.3.2-py2.py3-none-any.whl.metadata (6.9 kB)
Requirement already satisfied: python-dateutil>=2.6.0 in /usr/lib/python3.11/site-packages (from influxdb) (2.8.2)
Requirement already satisfied: pytz in /usr/lib/python3.11/site-packages (from influxdb) (2023.3.post1)
Requirement already satisfied: requests>=2.17.0 in /usr/lib/python3.11/site-packages (from influxdb) (2.28.2)
Requirement already satisfied: six>=1.10.0 in /usr/lib/python3.11/site-packages (from influxdb) (1.16.0)
Collecting msgpack (from influxdb)
  Downloading msgpack-1.0.8-cp311-cp311-musllinux_1_1_x86_64.whl.metadata (9.1 kB)
Requirement already satisfied: charset-normalizer<4,>=2 in /usr/lib/python3.11/site-packages (from requests>=2.17.0->influxdb) (3.3.2)
Requirement already satisfied: idna<4,>=2.5 in /usr/lib/python3.11/site-packages (from requests>=2.17.0->influxdb) (3.7)
Requirement already satisfied: urllib3<1.27,>=1.21.1 in /usr/lib/python3.11/site-packages (from requests>=2.17.0->influxdb) (1.26.18)
Requirement already satisfied: certifi>=2017.4.17 in /usr/lib/python3.11/site-packages (from requests>=2.17.0->influxdb) (2024.2.2)
Downloading influxdb-5.3.2-py2.py3-none-any.whl (79 kB)
   ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 79.4/79.4 kB 1.8 MB/s eta 0:00:00
Downloading msgpack-1.0.8-cp311-cp311-musllinux_1_1_x86_64.whl (409 kB)
   ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 409.1/409.1 kB 6.3 MB/s eta 0:00:00
Installing collected packages: msgpack, influxdb
Successfully installed influxdb-5.3.2 msgpack-1.0.8
WARNING: Running pip as the 'root' user can result in broken permissions and conflicting behaviour with the system package manager. It is recommended to use a virtual environ

Marty56 avatar Jun 13 '24 04:06 Marty56

is this add-on still supported?

Marty56 avatar Jun 26 '24 19:06 Marty56

Hi, @Marty56 👋

Yes it is, but your question doesn't seem to be add-on related, but related to the use of ApPDaemon; which might be better asked @ the AppDaemon community.

Just because nobody has given an answer to your question, it doesn't indicate support; it means no one has an answer.

../Frenck

frenck avatar Jun 26 '24 19:06 frenck

There hasn't been any activity on this issue recently, so we clean up some of the older and inactive issues. Please make sure to update to the latest version and check if that solves the issue. Let us know if that works for you by leaving a comment 👍 This issue has now been marked as stale and will be closed if no further activity occurs. Thanks!

github-actions[bot] avatar Jul 27 '24 08:07 github-actions[bot]