2021-01-26 20:45:09 +00:00
|
|
|
"""Helper to test significant Switch state changes."""
|
2021-03-18 13:31:38 +00:00
|
|
|
from __future__ import annotations
|
|
|
|
|
|
|
|
from typing import Any
|
2021-01-26 20:45:09 +00:00
|
|
|
|
|
|
|
from homeassistant.core import HomeAssistant, callback
|
|
|
|
|
|
|
|
|
|
|
|
@callback
|
|
|
|
def async_check_significant_change(
|
|
|
|
hass: HomeAssistant,
|
|
|
|
old_state: str,
|
|
|
|
old_attrs: dict,
|
|
|
|
new_state: str,
|
|
|
|
new_attrs: dict,
|
|
|
|
**kwargs: Any,
|
2021-03-18 13:31:38 +00:00
|
|
|
) -> bool | None:
|
2021-01-26 20:45:09 +00:00
|
|
|
"""Test if state significantly changed."""
|
|
|
|
return old_state != new_state
|