MySQL errors

Just upgraded to 0.40.0 in a hope to fix some problems. Many issues are resolved, but unfortunately I’m getting loaded up on MySQL errors (I moved to MySQL in the hopes that it would cope better than sqlite did)

It seems stuck in some kind of never ending loop of errors triggering errors, but here’s a subset of the log:

17-03-11 19:30:09 ERROR (MainThread) [homeassistant.core] Error doing job: Task exception was never retrieved
Traceback (most recent call last):
  File "/srv/hass/hass_venv/lib/python3.4/site-packages/pymysql/connections.py", line 912, in connect
    **kwargs)
  File "/usr/lib/python3.4/socket.py", line 509, in create_connection
    raise err
  File "/usr/lib/python3.4/socket.py", line 500, in create_connection
    sock.connect(sa)
ConnectionRefusedError: [Errno 111] Connection refused

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/hass/.homeassistant/deps/sqlalchemy/engine/base.py", line 2138, in _wrap_pool_connect
    return fn()
  File "/home/hass/.homeassistant/deps/sqlalchemy/pool.py", line 387, in connect
    return _ConnectionFairy._checkout(self)
  File "/home/hass/.homeassistant/deps/sqlalchemy/pool.py", line 766, in _checkout
    fairy = _ConnectionRecord.checkout(pool)
  File "/home/hass/.homeassistant/deps/sqlalchemy/pool.py", line 521, in checkout
    rec.checkin()
  File "/home/hass/.homeassistant/deps/sqlalchemy/util/langhelpers.py", line 60, in __exit__
    compat.reraise(exc_type, exc_value, exc_tb)
  File "/home/hass/.homeassistant/deps/sqlalchemy/util/compat.py", line 187, in reraise
    raise value
  File "/home/hass/.homeassistant/deps/sqlalchemy/pool.py", line 518, in checkout
    dbapi_connection = rec.get_connection()
  File "/home/hass/.homeassistant/deps/sqlalchemy/pool.py", line 607, in get_connection
    self.__connect()
  File "/home/hass/.homeassistant/deps/sqlalchemy/pool.py", line 651, in __connect
    connection = pool._invoke_creator(self)
  File "/home/hass/.homeassistant/deps/sqlalchemy/engine/strategies.py", line 105, in connect
    return dialect.connect(*cargs, **cparams)
  File "/home/hass/.homeassistant/deps/sqlalchemy/engine/default.py", line 393, in connect
    return self.dbapi.connect(*cargs, **cparams)
  File "/srv/hass/hass_venv/lib/python3.4/site-packages/pymysql/__init__.py", line 90, in Connect
    return Connection(*args, **kwargs)
  File "/srv/hass/hass_venv/lib/python3.4/site-packages/pymysql/connections.py", line 699, in __init__
    self.connect()
  File "/srv/hass/hass_venv/lib/python3.4/site-packages/pymysql/connections.py", line 959, in connect
    raise exc
pymysql.err.OperationalError: (2003, "Can't connect to MySQL server on '172.16.1.122' ([Errno 111] Connection refused)")

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

Traceback (most recent call last):
  File "/usr/lib/python3.4/asyncio/tasks.py", line 233, in _step
    result = coro.throw(exc)
  File "/srv/hass/hass_venv/lib/python3.4/site-packages/homeassistant/helpers/entity_component.py", line 359, in async_process_entity
    new_entity, self, update_before_add=update_before_add
  File "/srv/hass/hass_venv/lib/python3.4/site-packages/homeassistant/helpers/entity_component.py", line 213, in async_add_entity
    yield from entity.async_added_to_hass()
  File "/srv/hass/hass_venv/lib/python3.4/site-packages/homeassistant/components/sensor/template.py", line 97, in async_added_to_hass
    state = yield from async_get_last_state(self.hass, self.entity_id)
  File "/srv/hass/hass_venv/lib/python3.4/site-packages/homeassistant/helpers/restore_state.py", line 80, in async_get_last_state
    None, _load_restore_cache, hass)
  File "/usr/lib/python3.4/asyncio/futures.py", line 388, in __iter__
    yield self  # This tells Task to wait for completion.
  File "/usr/lib/python3.4/asyncio/tasks.py", line 286, in _wakeup
    value = future.result()
  File "/usr/lib/python3.4/asyncio/futures.py", line 277, in result
    raise self._exception
  File "/usr/lib/python3.4/concurrent/futures/thread.py", line 54, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/srv/hass/hass_venv/lib/python3.4/site-packages/homeassistant/helpers/restore_state.py", line 30, in _load_restore_cache
    last_run = last_recorder_run(hass)
  File "/srv/hass/hass_venv/lib/python3.4/site-packages/homeassistant/components/history.py", line 44, in last_recorder_run
    .order_by(RecorderRuns.end.desc()).first())
  File "/home/hass/.homeassistant/deps/sqlalchemy/orm/query.py", line 2690, in first
    ret = list(self[0:1])
  File "/home/hass/.homeassistant/deps/sqlalchemy/orm/query.py", line 2482, in __getitem__
    return list(res)
  File "/home/hass/.homeassistant/deps/sqlalchemy/orm/query.py", line 2790, in __iter__
    return self._execute_and_instances(context)
  File "/home/hass/.homeassistant/deps/sqlalchemy/orm/query.py", line 2811, in _execute_and_instances
    close_with_result=True)
  File "/home/hass/.homeassistant/deps/sqlalchemy/orm/query.py", line 2820, in _get_bind_args
    **kw
  File "/home/hass/.homeassistant/deps/sqlalchemy/orm/query.py", line 2802, in _connection_from_session
    conn = self.session.connection(**kw)
  File "/home/hass/.homeassistant/deps/sqlalchemy/orm/session.py", line 966, in connection
    execution_options=execution_options)
  File "/home/hass/.homeassistant/deps/sqlalchemy/orm/session.py", line 971, in _connection_for_bind
    engine, execution_options)
  File "/home/hass/.homeassistant/deps/sqlalchemy/orm/session.py", line 403, in _connection_for_bind
    conn = bind.contextual_connect()
  File "/home/hass/.homeassistant/deps/sqlalchemy/engine/base.py", line 2103, in contextual_connect
    self._wrap_pool_connect(self.pool.connect, None),
  File "/home/hass/.homeassistant/deps/sqlalchemy/engine/base.py", line 2142, in _wrap_pool_connect
    e, dialect, self)
  File "/home/hass/.homeassistant/deps/sqlalchemy/engine/base.py", line 1456, in _handle_dbapi_exception_noconnection
    exc_info
  File "/home/hass/.homeassistant/deps/sqlalchemy/util/compat.py", line 203, in raise_from_cause
    reraise(type(exception), exception, tb=exc_tb, cause=cause)
  File "/home/hass/.homeassistant/deps/sqlalchemy/util/compat.py", line 186, in reraise
    raise value.with_traceback(tb)
  File "/home/hass/.homeassistant/deps/sqlalchemy/engine/base.py", line 2138, in _wrap_pool_connect
    return fn()
  File "/home/hass/.homeassistant/deps/sqlalchemy/pool.py", line 387, in connect
    return _ConnectionFairy._checkout(self)
  File "/home/hass/.homeassistant/deps/sqlalchemy/pool.py", line 766, in _checkout
    fairy = _ConnectionRecord.checkout(pool)
  File "/home/hass/.homeassistant/deps/sqlalchemy/pool.py", line 521, in checkout
    rec.checkin()
  File "/home/hass/.homeassistant/deps/sqlalchemy/util/langhelpers.py", line 60, in __exit__
    compat.reraise(exc_type, exc_value, exc_tb)
  File "/home/hass/.homeassistant/deps/sqlalchemy/util/compat.py", line 187, in reraise
    raise value
  File "/home/hass/.homeassistant/deps/sqlalchemy/pool.py", line 518, in checkout
    dbapi_connection = rec.get_connection()
  File "/home/hass/.homeassistant/deps/sqlalchemy/pool.py", line 607, in get_connection
    self.__connect()
  File "/home/hass/.homeassistant/deps/sqlalchemy/pool.py", line 651, in __connect
    connection = pool._invoke_creator(self)
  File "/home/hass/.homeassistant/deps/sqlalchemy/engine/strategies.py", line 105, in connect
    return dialect.connect(*cargs, **cparams)
  File "/home/hass/.homeassistant/deps/sqlalchemy/engine/default.py", line 393, in connect
    return self.dbapi.connect(*cargs, **cparams)
  File "/srv/hass/hass_venv/lib/python3.4/site-packages/pymysql/__init__.py", line 90, in Connect
    return Connection(*args, **kwargs)
  File "/srv/hass/hass_venv/lib/python3.4/site-packages/pymysql/connections.py", line 699, in __init__
    self.connect()
  File "/srv/hass/hass_venv/lib/python3.4/site-packages/pymysql/connections.py", line 959, in connect
    raise exc
sqlalchemy.exc.OperationalError: (pymysql.err.OperationalError) (2003, "Can't connect to MySQL server on '172.16.1.122' ([Errno 111] Connection refused)")
17-03-11 19:30:09 ERROR (MainThread) [homeassistant.core] Error doing job: Task exception was never retrieved
Traceback (most recent call last):
  File "/srv/hass/hass_venv/lib/python3.4/site-packages/pymysql/connections.py", line 912, in connect
    **kwargs)
  File "/usr/lib/python3.4/socket.py", line 509, in create_connection
    raise err
  File "/usr/lib/python3.4/socket.py", line 500, in create_connection
    sock.connect(sa)
ConnectionRefusedError: [Errno 111] Connection refused

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/hass/.homeassistant/deps/sqlalchemy/engine/base.py", line 2138, in _wrap_pool_connect
    return fn()
  File "/home/hass/.homeassistant/deps/sqlalchemy/pool.py", line 387, in connect
    return _ConnectionFairy._checkout(self)
  File "/home/hass/.homeassistant/deps/sqlalchemy/pool.py", line 766, in _checkout
    fairy = _ConnectionRecord.checkout(pool)
  File "/home/hass/.homeassistant/deps/sqlalchemy/pool.py", line 521, in checkout
    rec.checkin()
  File "/home/hass/.homeassistant/deps/sqlalchemy/util/langhelpers.py", line 60, in __exit__
    compat.reraise(exc_type, exc_value, exc_tb)
  File "/home/hass/.homeassistant/deps/sqlalchemy/util/compat.py", line 187, in reraise
    raise value
  File "/home/hass/.homeassistant/deps/sqlalchemy/pool.py", line 518, in checkout
    dbapi_connection = rec.get_connection()
  File "/home/hass/.homeassistant/deps/sqlalchemy/pool.py", line 607, in get_connection
    self.__connect()
  File "/home/hass/.homeassistant/deps/sqlalchemy/pool.py", line 651, in __connect
    connection = pool._invoke_creator(self)
  File "/home/hass/.homeassistant/deps/sqlalchemy/engine/strategies.py", line 105, in connect
    return dialect.connect(*cargs, **cparams)
  File "/home/hass/.homeassistant/deps/sqlalchemy/engine/default.py", line 393, in connect
    return self.dbapi.connect(*cargs, **cparams)
  File "/srv/hass/hass_venv/lib/python3.4/site-packages/pymysql/__init__.py", line 90, in Connect
    return Connection(*args, **kwargs)
  File "/srv/hass/hass_venv/lib/python3.4/site-packages/pymysql/connections.py", line 699, in __init__
    self.connect()
  File "/srv/hass/hass_venv/lib/python3.4/site-packages/pymysql/connections.py", line 959, in connect
    raise exc
pymysql.err.OperationalError: (2003, "Can't connect to MySQL server on '172.16.1.122' ([Errno 111] Connection refused)")

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

Traceback (most recent call last):
  File "/usr/lib/python3.4/asyncio/tasks.py", line 233, in _step
    result = coro.throw(exc)
  File "/srv/hass/hass_venv/lib/python3.4/site-packages/homeassistant/helpers/entity_component.py", line 359, in async_process_entity
    new_entity, self, update_before_add=update_before_add
  File "/srv/hass/hass_venv/lib/python3.4/site-packages/homeassistant/helpers/entity_component.py", line 213, in async_add_entity
    yield from entity.async_added_to_hass()
  File "/srv/hass/hass_venv/lib/python3.4/site-packages/homeassistant/components/sensor/template.py", line 97, in async_added_to_hass
    state = yield from async_get_last_state(self.hass, self.entity_id)
  File "/srv/hass/hass_venv/lib/python3.4/site-packages/homeassistant/helpers/restore_state.py", line 80, in async_get_last_state
    None, _load_restore_cache, hass)
  File "/usr/lib/python3.4/asyncio/futures.py", line 388, in __iter__
    yield self  # This tells Task to wait for completion.
  File "/usr/lib/python3.4/asyncio/tasks.py", line 286, in _wakeup
    value = future.result()
  File "/usr/lib/python3.4/asyncio/futures.py", line 277, in result
    raise self._exception
  File "/usr/lib/python3.4/concurrent/futures/thread.py", line 54, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/srv/hass/hass_venv/lib/python3.4/site-packages/homeassistant/helpers/restore_state.py", line 30, in _load_restore_cache
    last_run = last_recorder_run(hass)
  File "/srv/hass/hass_venv/lib/python3.4/site-packages/homeassistant/components/history.py", line 44, in last_recorder_run
    .order_by(RecorderRuns.end.desc()).first())
  File "/home/hass/.homeassistant/deps/sqlalchemy/orm/query.py", line 2690, in first
    ret = list(self[0:1])
  File "/home/hass/.homeassistant/deps/sqlalchemy/orm/query.py", line 2482, in __getitem__
    return list(res)
  File "/home/hass/.homeassistant/deps/sqlalchemy/orm/query.py", line 2790, in __iter__
    return self._execute_and_instances(context)
  File "/home/hass/.homeassistant/deps/sqlalchemy/orm/query.py", line 2811, in _execute_and_instances
    close_with_result=True)
  File "/home/hass/.homeassistant/deps/sqlalchemy/orm/query.py", line 2820, in _get_bind_args
    **kw
  File "/home/hass/.homeassistant/deps/sqlalchemy/orm/query.py", line 2802, in _connection_from_session
    conn = self.session.connection(**kw)
  File "/home/hass/.homeassistant/deps/sqlalchemy/orm/session.py", line 966, in connection
    execution_options=execution_options)
  File "/home/hass/.homeassistant/deps/sqlalchemy/orm/session.py", line 971, in _connection_for_bind
    engine, execution_options)
  File "/home/hass/.homeassistant/deps/sqlalchemy/orm/session.py", line 403, in _connection_for_bind
    conn = bind.contextual_connect()
  File "/home/hass/.homeassistant/deps/sqlalchemy/engine/base.py", line 2103, in contextual_connect
    self._wrap_pool_connect(self.pool.connect, None),
  File "/home/hass/.homeassistant/deps/sqlalchemy/engine/base.py", line 2142, in _wrap_pool_connect
    e, dialect, self)
  File "/home/hass/.homeassistant/deps/sqlalchemy/engine/base.py", line 1456, in _handle_dbapi_exception_noconnection
    exc_info
  File "/home/hass/.homeassistant/deps/sqlalchemy/util/compat.py", line 203, in raise_from_cause
    reraise(type(exception), exception, tb=exc_tb, cause=cause)
  File "/home/hass/.homeassistant/deps/sqlalchemy/util/compat.py", line 186, in reraise
    raise value.with_traceback(tb)
  File "/home/hass/.homeassistant/deps/sqlalchemy/engine/base.py", line 2138, in _wrap_pool_connect
    return fn()
  File "/home/hass/.homeassistant/deps/sqlalchemy/pool.py", line 387, in connect
    return _ConnectionFairy._checkout(self)
  File "/home/hass/.homeassistant/deps/sqlalchemy/pool.py", line 766, in _checkout
    fairy = _ConnectionRecord.checkout(pool)
  File "/home/hass/.homeassistant/deps/sqlalchemy/pool.py", line 521, in checkout
    rec.checkin()
  File "/home/hass/.homeassistant/deps/sqlalchemy/util/langhelpers.py", line 60, in __exit__
    compat.reraise(exc_type, exc_value, exc_tb)
  File "/home/hass/.homeassistant/deps/sqlalchemy/util/compat.py", line 187, in reraise
    raise value
  File "/home/hass/.homeassistant/deps/sqlalchemy/pool.py", line 518, in checkout
    dbapi_connection = rec.get_connection()
  File "/home/hass/.homeassistant/deps/sqlalchemy/pool.py", line 607, in get_connection
    self.__connect()
  File "/home/hass/.homeassistant/deps/sqlalchemy/pool.py", line 651, in __connect
    connection = pool._invoke_creator(self)
  File "/home/hass/.homeassistant/deps/sqlalchemy/engine/strategies.py", line 105, in connect
    return dialect.connect(*cargs, **cparams)
  File "/home/hass/.homeassistant/deps/sqlalchemy/engine/default.py", line 393, in connect
    return self.dbapi.connect(*cargs, **cparams)
  File "/srv/hass/hass_venv/lib/python3.4/site-packages/pymysql/__init__.py", line 90, in Connect
    return Connection(*args, **kwargs)
  File "/srv/hass/hass_venv/lib/python3.4/site-packages/pymysql/connections.py", line 699, in __init__
    self.connect()
  File "/srv/hass/hass_venv/lib/python3.4/site-packages/pymysql/connections.py", line 959, in connect
    raise exc
sqlalchemy.exc.OperationalError: (pymysql.err.OperationalError) (2003, "Can't connect to MySQL server on '172.16.1.122' ([Errno 111] Connection refused)")
17-03-11 19:30:09 ERROR (MainThread) [homeassistant.core] Error doing job: Task exception was never retrieved
Traceback (most recent call last):
  File "/srv/hass/hass_venv/lib/python3.4/site-packages/pymysql/connections.py", line 912, in connect
    **kwargs)
  File "/usr/lib/python3.4/socket.py", line 509, in create_connection
    raise err
  File "/usr/lib/python3.4/socket.py", line 500, in create_connection
    sock.connect(sa)
ConnectionRefusedError: [Errno 111] Connection refused

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/hass/.homeassistant/deps/sqlalchemy/engine/base.py", line 2138, in _wrap_pool_connect
    return fn()
  File "/home/hass/.homeassistant/deps/sqlalchemy/pool.py", line 387, in connect
    return _ConnectionFairy._checkout(self)
  File "/home/hass/.homeassistant/deps/sqlalchemy/pool.py", line 766, in _checkout
    fairy = _ConnectionRecord.checkout(pool)
  File "/home/hass/.homeassistant/deps/sqlalchemy/pool.py", line 521, in checkout
    rec.checkin()
  File "/home/hass/.homeassistant/deps/sqlalchemy/util/langhelpers.py", line 60, in __exit__
    compat.reraise(exc_type, exc_value, exc_tb)
  File "/home/hass/.homeassistant/deps/sqlalchemy/util/compat.py", line 187, in reraise
    raise value
  File "/home/hass/.homeassistant/deps/sqlalchemy/pool.py", line 518, in checkout
    dbapi_connection = rec.get_connection()
  File "/home/hass/.homeassistant/deps/sqlalchemy/pool.py", line 607, in get_connection
    self.__connect()
  File "/home/hass/.homeassistant/deps/sqlalchemy/pool.py", line 651, in __connect
    connection = pool._invoke_creator(self)
  File "/home/hass/.homeassistant/deps/sqlalchemy/engine/strategies.py", line 105, in connect
    return dialect.connect(*cargs, **cparams)
  File "/home/hass/.homeassistant/deps/sqlalchemy/engine/default.py", line 393, in connect
    return self.dbapi.connect(*cargs, **cparams)
  File "/srv/hass/hass_venv/lib/python3.4/site-packages/pymysql/__init__.py", line 90, in Connect
    return Connection(*args, **kwargs)
  File "/srv/hass/hass_venv/lib/python3.4/site-packages/pymysql/connections.py", line 699, in __init__
    self.connect()
  File "/srv/hass/hass_venv/lib/python3.4/site-packages/pymysql/connections.py", line 959, in connect
    raise exc
pymysql.err.OperationalError: (2003, "Can't connect to MySQL server on '172.16.1.122' ([Errno 111] Connection refused)")

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

Traceback (most recent call last):
  File "/usr/lib/python3.4/asyncio/tasks.py", line 233, in _step
    result = coro.throw(exc)
  File "/srv/hass/hass_venv/lib/python3.4/site-packages/homeassistant/helpers/entity_component.py", line 359, in async_process_entity
    new_entity, self, update_before_add=update_before_add
  File "/srv/hass/hass_venv/lib/python3.4/site-packages/homeassistant/helpers/entity_component.py", line 213, in async_add_entity
    yield from entity.async_added_to_hass()
  File "/srv/hass/hass_venv/lib/python3.4/site-packages/homeassistant/components/sensor/template.py", line 97, in async_added_to_hass
    state = yield from async_get_last_state(self.hass, self.entity_id)
  File "/srv/hass/hass_venv/lib/python3.4/site-packages/homeassistant/helpers/restore_state.py", line 80, in async_get_last_state
    None, _load_restore_cache, hass)
  File "/usr/lib/python3.4/asyncio/futures.py", line 388, in __iter__
    yield self  # This tells Task to wait for completion.
  File "/usr/lib/python3.4/asyncio/tasks.py", line 286, in _wakeup
    value = future.result()
  File "/usr/lib/python3.4/asyncio/futures.py", line 277, in result
    raise self._exception
  File "/usr/lib/python3.4/concurrent/futures/thread.py", line 54, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/srv/hass/hass_venv/lib/python3.4/site-packages/homeassistant/helpers/restore_state.py", line 30, in _load_restore_cache
    last_run = last_recorder_run(hass)
  File "/srv/hass/hass_venv/lib/python3.4/site-packages/homeassistant/components/history.py", line 44, in last_recorder_run
    .order_by(RecorderRuns.end.desc()).first())
  File "/home/hass/.homeassistant/deps/sqlalchemy/orm/query.py", line 2690, in first
    ret = list(self[0:1])
  File "/home/hass/.homeassistant/deps/sqlalchemy/orm/query.py", line 2482, in __getitem__
    return list(res)
  File "/home/hass/.homeassistant/deps/sqlalchemy/orm/query.py", line 2790, in __iter__
    return self._execute_and_instances(context)
  File "/home/hass/.homeassistant/deps/sqlalchemy/orm/query.py", line 2811, in _execute_and_instances
    close_with_result=True)
  File "/home/hass/.homeassistant/deps/sqlalchemy/orm/query.py", line 2820, in _get_bind_args
    **kw
  File "/home/hass/.homeassistant/deps/sqlalchemy/orm/query.py", line 2802, in _connection_from_session
    conn = self.session.connection(**kw)
  File "/home/hass/.homeassistant/deps/sqlalchemy/orm/session.py", line 966, in connection
    execution_options=execution_options)
  File "/home/hass/.homeassistant/deps/sqlalchemy/orm/session.py", line 971, in _connection_for_bind
    engine, execution_options)
  File "/home/hass/.homeassistant/deps/sqlalchemy/orm/session.py", line 403, in _connection_for_bind
    conn = bind.contextual_connect()
  File "/home/hass/.homeassistant/deps/sqlalchemy/engine/base.py", line 2103, in contextual_connect
    self._wrap_pool_connect(self.pool.connect, None),
  File "/home/hass/.homeassistant/deps/sqlalchemy/engine/base.py", line 2142, in _wrap_pool_connect
    e, dialect, self)
  File "/home/hass/.homeassistant/deps/sqlalchemy/engine/base.py", line 1456, in _handle_dbapi_exception_noconnection
    exc_info
  File "/home/hass/.homeassistant/deps/sqlalchemy/util/compat.py", line 203, in raise_from_cause
    reraise(type(exception), exception, tb=exc_tb, cause=cause)
  File "/home/hass/.homeassistant/deps/sqlalchemy/util/compat.py", line 186, in reraise
    raise value.with_traceback(tb)
  File "/home/hass/.homeassistant/deps/sqlalchemy/engine/base.py", line 2138, in _wrap_pool_connect
    return fn()
  File "/home/hass/.homeassistant/deps/sqlalchemy/pool.py", line 387, in connect
    return _ConnectionFairy._checkout(self)
  File "/home/hass/.homeassistant/deps/sqlalchemy/pool.py", line 766, in _checkout
    fairy = _ConnectionRecord.checkout(pool)
  File "/home/hass/.homeassistant/deps/sqlalchemy/pool.py", line 521, in checkout
    rec.checkin()
  File "/home/hass/.homeassistant/deps/sqlalchemy/util/langhelpers.py", line 60, in __exit__
    compat.reraise(exc_type, exc_value, exc_tb)
  File "/home/hass/.homeassistant/deps/sqlalchemy/util/compat.py", line 187, in reraise
    raise value
  File "/home/hass/.homeassistant/deps/sqlalchemy/pool.py", line 518, in checkout
    dbapi_connection = rec.get_connection()
  File "/home/hass/.homeassistant/deps/sqlalchemy/pool.py", line 607, in get_connection
    self.__connect()
  File "/home/hass/.homeassistant/deps/sqlalchemy/pool.py", line 651, in __connect
    connection = pool._invoke_creator(self)
  File "/home/hass/.homeassistant/deps/sqlalchemy/engine/strategies.py", line 105, in connect
    return dialect.connect(*cargs, **cparams)
  File "/home/hass/.homeassistant/deps/sqlalchemy/engine/default.py", line 393, in connect
    return self.dbapi.connect(*cargs, **cparams)
  File "/srv/hass/hass_venv/lib/python3.4/site-packages/pymysql/__init__.py", line 90, in Connect
    return Connection(*args, **kwargs)
  File "/srv/hass/hass_venv/lib/python3.4/site-packages/pymysql/connections.py", line 699, in __init__
    self.connect()
  File "/srv/hass/hass_venv/lib/python3.4/site-packages/pymysql/connections.py", line 959, in connect
    raise exc
sqlalchemy.exc.OperationalError: (pymysql.err.OperationalError) (2003, "Can't connect to MySQL server on '172.16.1.122' ([Errno 111] Connection refused)")
17-03-11 19:30:09 ERROR (Recorder) [homeassistant.components.recorder.util] Error executing query: (pymysql.err.OperationalError) (2003, "Can't connect to MySQL server on '172.16.1.122' ([Errno 111] Connection refused)")