My automations aren't kicking off

Make sure you have the inital state set

  initial_state: on

No, that’s an old wives tale. That is not necessary.

Here are some log details.
could this be the cause of my pain?
sqlite3.DatabaseError: database disk image is malformed

Log Details (ERROR)
Wed Jan 15 2020 11:38:35 GMT-0600 (Central Standard Time)
Error saving event: <Event state_changed[L]: entity_id=sun.sun, old_state=<state sun.sun=above_horizon; next_dawn=2020-01-16T13:06:51+00:00, next_dusk=2020-01-15T23:49:30+00:00, next_midnight=2020-01-16T06:28:56+00:00, next_noon=2020-01-15T18:28:19+00:00, next_rising=2020-01-16T13:35:59+00:00, next_setting=2020-01-15T23:20:19+00:00, elevation=28.94, azimuth=165.51, rising=True, friendly_name=Sun @ 2020-01-15T07:35:14.004473-06:00>, new_state=<state sun.sun=above_horizon; next_dawn=2020-01-16T13:06:51+00:00, next_dusk=2020-01-15T23:49:30+00:00, next_midnight=2020-01-16T06:28:56+00:00, next_noon=2020-01-15T18:28:19+00:00, next_rising=2020-01-16T13:35:59+00:00, next_setting=2020-01-15T23:20:19+00:00, elevation=29.13, azimuth=166.56, rising=True, friendly_name=Sun @ 2020-01-15T07:35:14.004473-06: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 581, 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 2470, in flush
self._flush(objects)
File “/usr/local/lib/python3.7/site-packages/sqlalchemy/orm/session.py”, line 2608, 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 2568, 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 287, 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 581, 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”: “sun.sun”, “old_state”: {“entity_id”: “sun.sun”, “state”: “above_horizon”, “attributes”: {“next_dawn”: “2020-01-16T13:06:51+00:00”, “ne … (958 characters truncated) … :00”, “last_updated”: “2020-01-15T17:38:35.005942+00:00”, “context”: {“id”: “7280998e74224f72a7bb26ff58ccf171”, “parent_id”: null, “user_id”: null}}}’, ‘LOCAL’, ‘2020-01-15 17:38:35.005998’, ‘2020-01-15 17:38:35.012778’, ‘7280998e74224f72a7bb26ff58ccf171’, None)]
(Background on this error at: http://sqlalche.me/e/4xp6)

Your database is corrupted. Stop home assistant, delete home-assistant.db and restart.

Did they fix that? Automations kept disabling on me randomly on reboots (usually updates) until I did this.

It was corrected in 0.94.1

2 Likes

clean database

but when I try to execute blinds automation, receiving this.

Log Details (ERROR)

Wed Jan 15 2020 12:00:00 GMT-0600 (Central Standard Time)

Error while executing automation automation.entry_blinds_at_noon. Invalid data for call_service at pos 1: extra keys not allowed @ data[‘position’]

So I’ll have to look at pos 1 and see what is wrong with the file.

Your spacing is most likely off on the line with the position key. Or the spacing is off after that line. You didn’t post automation.entry_blinds_at_noon so I can’t be certain. But I’m 100% positive it’s a spacing problem.

# Front Entry Blinds at noon
- alias: 'Entry Blinds at noon'
  trigger:
    - platform: time
      at: "12:00:00"
  action:
    - service: cover.set_cover_tilt_position
      data:
        entity_id: cover.frontentry_hab_home_intelligence_llc_iblinds_level
        position: 40

what’s after it?

after what?

I’m using the configurator add-on and it gives me a green check mark as the automations file is correct.

after position: 40 there is no space, then a start of a new line, then my next automation

Thanks

The cover.set_cover_tilt_position needs:

tilt_position: 40

changing it to tilt_position no longer generates errors. although when I try to manually trigger the automation in Developer Tools / States, I get no response

which is better?
using automations.yaml file
or
using Node_RED

Does your cover support tilt position? Are there errors in the logs when you manually trigger it?

That’s personal preference. If you don’t think programatically, then node-red would probably be better for you.

no errors in the logs. I’m running iBlinds zwave component.

I believe I can think programatically. I’ll try Node_RED and see if I even like working with it. I may like sticking with the automations file

FYI
The blinds do work if I manually slide the slider bar in the Front Entry Blinds Level entity. So the zwave device is functioning properly.

Thanks

One more thing. I ran the below to test and this automation is working. So it’s only the blinds automation giving me a headache right now

# Front Outdoor Lights off sunrise
- alias: 'Outdoor Lights off sunrise'
  trigger:
    - platform: state
      entity_id: sun.sun
      from: below_horizon
      to: above_horizon
  action:
    - service: switch.turn_off
      data:
        entity_id: switch.frontoutdoorlights_enerwave_smart_single_relay_switch

node red is for people who think like a flow chart. So, what do you think like? a if then programmer or a flow chart.

Is that a tilt position or a cover position? I believe (I don’t have a cover) tilt is the angle of the cover blades, where position is the open/close position.

I’m running horizontal blinds, so I assume tilt is the way to go.

Can you post a screenshot of the cover and attributes on the developer tools > states page?