Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Plant does not work (SQL error) #114328

Closed
martijnbuts opened this issue Mar 27, 2024 · 3 comments
Closed

Plant does not work (SQL error) #114328

martijnbuts opened this issue Mar 27, 2024 · 3 comments

Comments

@martijnbuts
Copy link

martijnbuts commented Mar 27, 2024

The problem

After upgrading to beta 2024.4.0B0 the plant or plant monitor does not work anymore.
https://www.home-assistant.io/integrations/plant/

What version of Home Assistant Core has the issue?

core-2024.4.0b0

What was the last working version of Home Assistant Core?

core-2024.3.x

What type of installation are you running?

Home Assistant OS

Integration causing the issue

plant

Link to integration documentation on our website

https://www.home-assistant.io/integrations/plant/

Diagnostics information

Example YAML snippet

plant:
  Plant_links:
    sensors:
      moisture: sensor.plantenbak_1_vochtigheid
      temperature: sensor.serre_temperature
      conductivity: sensor.plantenbak_1_vochtigheid
      brightness: sensor.bh1750_illuminance
    min_moisture: 10
    min_conductivity: 20
    max_conductivity: 90
    min_temperature: 16
    max_temperature: 25

  Plant_rechts:
    sensors:
      moisture: sensor.plantenbak_2_vochtigheid
      temperature: sensor.serre_temperature
      conductivity: sensor.plantenbak_2_vochtigheid
      brightness: sensor.bh1750_illuminance
    min_moisture: 10
    min_conductivity: 20
    max_conductivity: 90
    min_temperature: 16
    max_temperature: 25

Anything in the logs that might be useful for us?

Logger: homeassistant.components.plant
Bron: helpers/entity_platform.py:580
integratie: Plant (documentatie, problemen)
Eerst voorgekomen: 19:02:27 (2 gebeurtenissen)
Laatst gelogd: 19:02:28

Error adding entity plant.plant_links for domain plant with platform plant
Error adding entity plant.plant_rechts for domain plant with platform plant
Traceback (most recent call last):
  File "/usr/local/lib/python3.12/site-packages/sqlalchemy/engine/base.py", line 1971, in _exec_single_context
    self.dialect.do_execute(
  File "/usr/local/lib/python3.12/site-packages/sqlalchemy/engine/default.py", line 919, in do_execute
    cursor.execute(statement, parameters)
sqlite3.OperationalError: no such column: states.last_reported_ts

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 580, in _async_add_entities
    await coro
  File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 881, in _async_add_entity
    await entity.add_to_platform_finish()
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 1333, in add_to_platform_finish
    await self.async_added_to_hass()
  File "/usr/src/homeassistant/homeassistant/components/plant/__init__.py", line 282, in async_added_to_hass
    await get_instance(self.hass).async_add_executor_job(
  File "/usr/local/lib/python3.12/concurrent/futures/thread.py", line 58, in run
    result = self.fn(*self.args, **self.kwargs)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/components/plant/__init__.py", line 311, in _load_history_from_db
    history_list = history.state_changes_during_period(
                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/components/recorder/history/__init__.py", line 175, in state_changes_during_period
    return _target(
           ^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/components/recorder/history/modern.py", line 437, in state_changes_during_period
    execute_stmt_lambda_element(
  File "/usr/src/homeassistant/homeassistant/components/recorder/util.py", line 232, in execute_stmt_lambda_element
    executed = session.connection().execute(stmt)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/sqlalchemy/engine/base.py", line 1422, in execute
    return meth(
           ^^^^^
  File "/usr/local/lib/python3.12/site-packages/sqlalchemy/sql/lambdas.py", line 603, in _execute_on_connection
    return connection._execute_clauseelement(
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/sqlalchemy/engine/base.py", line 1644, in _execute_clauseelement
    ret = self._execute_context(
          ^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/sqlalchemy/engine/base.py", line 1850, in _execute_context
    return self._exec_single_context(
           ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/sqlalchemy/engine/base.py", line 1990, in _exec_single_context
    self._handle_dbapi_exception(
  File "/usr/local/lib/python3.12/site-packages/sqlalchemy/engine/base.py", line 2357, in _handle_dbapi_exception
    raise sqlalchemy_exception.with_traceback(exc_info[2]) from e
  File "/usr/local/lib/python3.12/site-packages/sqlalchemy/engine/base.py", line 1971, in _exec_single_context
    self.dialect.do_execute(
  File "/usr/local/lib/python3.12/site-packages/sqlalchemy/engine/default.py", line 919, in do_execute
    cursor.execute(statement, parameters)
sqlalchemy.exc.OperationalError: (sqlite3.OperationalError) no such column: states.last_reported_ts
[SQL: SELECT states.metadata_id, states.state, states.last_updated_ts, states.last_reported_ts 
FROM states 
WHERE (states.last_changed_ts = states.last_updated_ts OR states.last_changed_ts IS NULL) AND states.last_updated_ts > ? AND states.metadata_id = ? ORDER BY states.metadata_id, states.last_updated_ts]
[parameters: (1711303347.714514, 1012)]
(Background on this error at: https://sqlalche.me/e/20/e3q8)

Additional information

No response

@home-assistant
Copy link

@joostlek
Copy link
Member

Seems related to #114327

@joostlek joostlek added this to the 2024.4.0 milestone Mar 27, 2024
@frenck frenck modified the milestone: 2024.4.0 Mar 27, 2024
@frenck frenck changed the title Plant does not work in beta 2024.4.0B0 Plant does not work (SQL error) Mar 27, 2024
@bdraco
Copy link
Member

bdraco commented Mar 27, 2024

This one is fixed via #114333 and will be in the next beta

@bdraco bdraco closed this as completed Mar 27, 2024
@github-actions github-actions bot locked and limited conversation to collaborators Apr 27, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

4 participants