Home Assistant release with the issue:
0.92.0
Last working Home Assistant release (if known):
0.91.4
Operating environment (Hass.io/Docker/Windows/etc.):
Docker
Component/platform:
https://www.home-assistant.io/components/influxdb/#sensor
Description of problem:
Getting an "Invalid Config" error on startup after updating to 0.92.0. See the provided traceback below.
Problem-relevant configuration.yaml entries and (fill out even if it seems unimportant):
sensor:
- platform: influxdb
host: influxdb
queries:
- name: house water pressure
where: 'time > now() - 1m'
value_template: '{{ value | round(1) }}'
database: home_sensors
measurement: water_psi
unit_of_measurement: psi
field: pressure
group_function: last
- name: Washing Machine Power
where: 'time > now() - 20s'
value_template: '{{ value | round(1) }}'
database: iotawatt
measurement: washer
unit_of_measurement: W
field: Watts
group_function: max
- name: Dryer Power
where: 'time > now() - 20s'
value_template: '{{ value | round(1) }}'
database: iotawatt
measurement: dryer
unit_of_measurement: W
field: Watts
group_function: max
Traceback (if applicable):
Traceback (most recent call last):
File "/usr/src/app/homeassistant/setup.py", line 156, in _async_setup_component
component.setup, hass, processed_config) # type: ignore
File "/usr/local/lib/python3.7/concurrent/futures/thread.py", line 57, in run
result = self.fn(*self.args, **self.kwargs)
File "/usr/src/app/homeassistant/components/influxdb/__init__.py", line 92, in setup
conf = config[DOMAIN]
KeyError: 'influxdb'
Hey there @fabaff, mind taking a look at this issue as its been labeled with a integration (influxdb) you are listed as a codeowner for? Thanks!
_This is a automatic comment generated by codeowners-mention to help ensure issues and pull requests are seen by the right people._
This is a bug.
With our new set up way, the influxdb component is required to be set up before the platform is set up. This will fail since there's no config for the influxdb component required for the platform and no logic connecting the component and platform.
quick dirty fix is change
https://github.com/home-assistant/home-assistant/blob/3d91d76d3d87dc28958c70c25cbd7568c8c20d4c/homeassistant/components/influxdb/__init__.py#L92
to
if DOMAIN not in config:
return False
conf = config[DOMAIN]
The proper fix is decouple sensor platform and influxdb component by moving influxdb/sensor.py to influxdb_client/sensor.py
Just to clarify. Is the influxdb component completely broken or is there a way to get it working without changing the code?
@kylehendricks adding a influxdb: section to your configuration.yaml is a workaround to make your sensors work without code changes. As a side effect you will get a "database not found: \"home_assistant\""} error every minute. This is harmless but if you ant to avoid it configure the influxdb component properly.
There hasn't been any activity on this issue recently. Due to the high number of incoming GitHub notifications, we have to clean some of the old issues, as many of them have already been resolved with the latest updates.
Please make sure to update to the latest Home Assistant version and check if that solves the issue. Let us know if that works for you by adding a comment 馃憤
This issue now has been marked as stale and will be closed if no further activity occurs. Thank you for your contributions.
This bug is still present in 0.103.4
Had to configure influxdb: before creating sensor to make it working.
Also present in 0.105.3...
Same issue. I would like to read data from influx.