My automations aren't kicking off

Running Hassio in docker on Ubuntu server 18. I have the following in my automations.yaml file and none of the automations are kicking off. What am I missing? Using configurator add-on and have a green check mark as no errors in the file.

Hass.io supervisor
Version 195
Latest version 195

Host system
System Ubuntu 18.04.3 LTS

# Front Entry Blinds at sunset
- alias: 'Entry Blinds at sunset'
  trigger:
    - platform: state
      entity_id: sun.sun
      from: above_horizon
      to: below_horizon
  action:
    - service: cover.set_cover_tilt_position
      data:
        entity_id: cover.frontentry_hab_home_intelligence_llc_iblinds_level
        position: 0

# Front Outdoor Lights at sunset
- alias: 'Outdoor Lights at sunset'
  trigger:
    - platform: state
      entity_id: sun.sun
      from: above_horizon
      to: below_horizon
  action:
    - service: switch.turn_on
      data:
        entity_id: switch.intermatic_ha_04c_outdoor_module_switch

# 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.intermatic_ha_04c_outdoor_module_switch

# Front Entry Blinds in the morning
- alias: 'Entry Blinds in the morning'
  trigger:
    - platform: time
      at: "08:00:00"
  action:
    - service: cover.set_cover_tilt_position
      data:
        entity_id: cover.frontentry_hab_home_intelligence_llc_iblinds_level
        position: 60

Thanks

Did you reload the configuration after you edited it?

(if you look at states on the developers screen, your automations should show up there. If they don’t, they’ve not been loaded)

all my automations are showing in the Developer Tools/States screen.

this is strange (shows last triggered today, but my blinds did not open)
automation.dining_blinds_in_the_morning on last_triggered: 2020-01-15T14:00:00.014889+00:00 friendly_name: Dining Blinds in the morning

Do the automations work if you trigger them manually?

Have you tried executing the ‘action’ piece in Devloper Tools -> Services to ensure they behave correctly? Or you can also trigger the automation there which will skip the trigger / conditions and just run the ‘action’ section of an automation.

EDIT: Just saw this in .104 docs:

I haven’t upgraded (as of this edit), but sounds like triggering an automation now WILL check the conditions and only bypass the trigger (since you’re manually triggering…)

1 Like

Well dang it, automations are not working when triggered manually

hmmmmmm

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