Restore for automation entities#6254
Conversation
balloob
left a comment
There was a problem hiding this comment.
Can you also extend your test to actually fire an event to make sure that not just the state in the state machine is correct but also the handlers are enabled/disabled.
There was a problem hiding this comment.
So why would this pass?
There was a problem hiding this comment.
I see also strange thing with assert in last time... I don't trust assert anymore
0ca7cdf to
8001308
Compare
|
Need to be rebased. I change the handling a bit with new async bootstrap. |
There was a problem hiding this comment.
Not very important, but it would be cool to pull in last_triggered here as well.
8001308 to
b12e453
Compare
b12e453 to
55f8668
Compare
|
|
||
| hass.bus.fire('test_event_hello') | ||
| yield from hass.async_block_till_done() | ||
| assert len(calls) == 1 |
There was a problem hiding this comment.
This seems to fail for py3.5 & 3.6, but always passes on 3.4
@pvizeli any ideas?
|
|
||
| # pylint: disable=unnecessary-lambda | ||
| hass.services.register(domain, service, mock_service) | ||
| if hass.loop.__dict__.get("_thread_ident", 0) == threading.get_ident(): |
There was a problem hiding this comment.
I prefer if we make an async_mock_service and have mock_service call that
|
I think the test is failing because the automation is not properly enabled: there is no log entry that the automation was triggered. ps, the sleep would never have worked because the event loop is 1 thread. So you just postponed executing all the further tasks, no race conditions could be resolved. I would take a look but I don't have time right now |
|
We should make sure that there is a test that enabling it works when there is no state to restore. (there might already be one) |
There was a problem hiding this comment.
comparison to False should be 'if cond is False:' or 'if not cond:'
d4ce06f to
06ca47e
Compare
|
💥 🐬 🎉 |
|
Very cool 🐬 |
Description:
Restore for automation entities #4614
Example entry for
configuration.yaml(if applicable):Checklist:
If the code does not interact with devices:
toxrun successfully. Your PR cannot be merged unless tests pass