@Mondmonarch wrote:
Hey there,
i’ve tried to set up an MQTT automation to control my shutters, that i wake up “dynamically”. Therefore I have to setup a script, which publishes MQTT topics with a short time period (delay 3 minutes) between them.
Therefore I’ve created the following:/config/automations.yaml
- alias: Move shutter up trigger: - platform: template value_template: > {% set alarm_time = as_timestamp(states('input_datetime.alarm_time')) %} {% set time_now = as_timestamp(states('sensor.date_time').replace(',', '')) %} {{ time_now >= ( alarm_time - 1200 ) }} condition: condition: state entity_id: input_boolean.shutter_wakeup state: 'on' action: service: script.cover_wakeup
/config/scripts.yaml
cover_wakeup: alias: Wake Up description: 'Slowly moves up the cover' fields: minutes: description: 'Amount time between cycles in minutes' example: 1 sequence: - alias: Shutter wake 1 service: cover.open_cover data: entity_id: cover.rolladen_wake1 - delay: # supports seconds, milliseconds, minutes, hours minutes: 3 - alias: Shutter wake 2.1 service: cover.open_cover data: entity_id: cover.rolladen_wake2 - delay: minutes: 3 - alias: Shutter wake 2.2 service: cover.open_cover data: entity_id: cover.rolladen_wake2 - delay: minutes: 3 - alias: Shutter wake 2.3 service: cover.open_cover data: entity_id: cover.rolladen_wake2
/config/configuration.yaml
input_boolean: node_red: name: Node Red Watchdog initial: on # Switch for the shutter automation shutter_wakeup: name: Rolladen - auto # Input time for shutter automation input_datetime: alarm_time: name: Uhrzeit has_date: false has_time: true
now, i’ getting the following errors:
1.)Fri Mar 06 2020 23:25:25 GMT+0100 (Mitteleuropäische Normalzeit) Error saving event: <Event state_changed[L]: entity_id=input_datetime.alarm_time, old_state=<state input_datetime.alarm_time=23:43:00; editable=False, has_date=False, has_time=True, hour=23, minute=43, second=0, timestamp=85380, friendly_name=Uhrzeit @ 2020-03-06T23:25:22.775296+01:00>, new_state=<state input_datetime.alarm_time=23:26:00; editable=False, has_date=False, has_time=True, hour=23, minute=26, second=0, timestamp=84360, friendly_name=Uhrzeit @ 2020-03-06T23:25:25.216730+01:00>> Traceback (most recent call last): File "/usr/local/lib/python3.7/site-packages/sqlalchemy/engine/base.py", line 1246, in _execute_context cursor, statement, parameters, context File "/usr/local/lib/python3.7/site-packages/sqlalchemy/engine/default.py", line 588, in do_execute cursor.execute(statement, parameters) sqlite3.DatabaseError: database disk image is malformed The above exception was the direct cause of the following exception: Traceback (most recent call last): File "/usr/src/homeassistant/homeassistant/components/recorder/__init__.py", line 348, in run session.flush() File "/usr/local/lib/python3.7/site-packages/sqlalchemy/orm/session.py", line 2479, in flush self._flush(objects) File "/usr/local/lib/python3.7/site-packages/sqlalchemy/orm/session.py", line 2617, in _flush transaction.rollback(_capture_exception=True) File "/usr/local/lib/python3.7/site-packages/sqlalchemy/util/langhelpers.py", line 68, in __exit__ compat.reraise(exc_type, exc_value, exc_tb) File "/usr/local/lib/python3.7/site-packages/sqlalchemy/util/compat.py", line 153, in reraise raise value File "/usr/local/lib/python3.7/site-packages/sqlalchemy/orm/session.py", line 2577, in _flush flush_context.execute() File "/usr/local/lib/python3.7/site-packages/sqlalchemy/orm/unitofwork.py", line 422, in execute rec.execute(self) File "/usr/local/lib/python3.7/site-packages/sqlalchemy/orm/unitofwork.py", line 589, in execute uow, File "/usr/local/lib/python3.7/site-packages/sqlalchemy/orm/persistence.py", line 245, in save_obj insert, File "/usr/local/lib/python3.7/site-packages/sqlalchemy/orm/persistence.py", line 1137, in _emit_insert_statements statement, params File "/usr/local/lib/python3.7/site-packages/sqlalchemy/engine/base.py", line 982, in execute return meth(self, multiparams, params) File "/usr/local/lib/python3.7/site-packages/sqlalchemy/sql/elements.py", line 293, in _execute_on_connection return connection._execute_clauseelement(self, multiparams, params) File "/usr/local/lib/python3.7/site-packages/sqlalchemy/engine/base.py", line 1101, in _execute_clauseelement distilled_params, File "/usr/local/lib/python3.7/site-packages/sqlalchemy/engine/base.py", line 1250, in _execute_context e, statement, parameters, cursor, context File "/usr/local/lib/python3.7/site-packages/sqlalchemy/engine/base.py", line 1476, in _handle_dbapi_exception util.raise_from_cause(sqlalchemy_exception, exc_info) File "/usr/local/lib/python3.7/site-packages/sqlalchemy/util/compat.py", line 398, in raise_from_cause reraise(type(exception), exception, tb=exc_tb, cause=cause) File "/usr/local/lib/python3.7/site-packages/sqlalchemy/util/compat.py", line 152, in reraise raise value.with_traceback(tb) File "/usr/local/lib/python3.7/site-packages/sqlalchemy/engine/base.py", line 1246, in _execute_context cursor, statement, parameters, context File "/usr/local/lib/python3.7/site-packages/sqlalchemy/engine/default.py", line 588, in do_execute cursor.execute(statement, parameters) sqlalchemy.exc.DatabaseError: (sqlite3.DatabaseError) database disk image is malformed [SQL: INSERT INTO events (event_type, event_data, origin, time_fired, created, context_id, context_user_id) VALUES (?, ?, ?, ?, ?, ?, ?)] [parameters: ('state_changed', '{"entity_id": "input_datetime.alarm_time", "old_state": {"entity_id": "input_datetime.alarm_time", "state": "23:43:00", "attributes": {"editable": fa ... (668 characters truncated) ... -06T22:25:25.216730+00:00", "context": {"id": "839f883d3eda42c28603767caa58ce73", "parent_id": null, "user_id": "bb66043e7eaf4ec582de8721b47539dc"}}}', 'LOCAL', '2020-03-06 22:25:25.216806', '2020-03-06 22:25:25.251274', '839f883d3eda42c28603767caa58ce73', 'bb66043e7eaf4ec582de8721b47539dc')] (Background on this error at: http://sqlalche.me/e/4xp6)
2.)
Fri Mar 06 2020 23:25:25 GMT+0100 (Mitteleuropäische Normalzeit) Error executing query: (sqlite3.DatabaseError) database disk image is malformed [SQL: INSERT INTO events (event_type, event_data, origin, time_fired, created, context_id, context_user_id) VALUES (?, ?, ?, ?, ?, ?, ?)] [parameters: ('state_changed', '{"entity_id": "input_datetime.alarm_time", "old_state": {"entity_id": "input_datetime.alarm_time", "state": "23:43:00", "attributes": {"editable": fa ... (668 characters truncated) ... -06T22:25:25.216730+00:00", "context": {"id": "839f883d3eda42c28603767caa58ce73", "parent_id": null, "user_id": "bb66043e7eaf4ec582de8721b47539dc"}}}', 'LOCAL', '2020-03-06 22:25:25.216806', '2020-03-06 22:25:25.251274', '839f883d3eda42c28603767caa58ce73', 'bb66043e7eaf4ec582de8721b47539dc')] (Background on this error at: http://sqlalche.me/e/4xp6)
I’m not familiar with yaml and homeassistant. Can anyone help me to fix this issue?
Thank you for your response
Posts: 2
Participants: 2