Leverage zigpy for IEEE address conversions (#27972)

* Refactor EUI64 conversions.

* Update ZHA dependencies.

* Update tests.
This commit is contained in:
Alexei Chetroi authored and David F. Mulcahey committed 2019-10-21 13:14:17 -04:00
1 parent 643257d911
commit a0c50f4794
13 files changed
+135 -81

No files matched your search

+13 -6
View File
@@ -1,16 +1,22 @@
"""Test zha switch."""
from unittest.mock import call, patch
from zigpy.zcl.foundation import Command
from homeassistant.components.switch import DOMAIN
from homeassistant.const import STATE_ON, STATE_OFF, STATE_UNAVAILABLE
from tests.common import mock_coro
from homeassistant.const import STATE_OFF, STATE_ON, STATE_UNAVAILABLE
from .common import (
async_enable_traffic,
async_init_zigpy_device,
async_test_device_join,
make_attribute,
make_entity_id,
async_test_device_join,
async_enable_traffic,
make_zcl_header,
)
from tests.common import mock_coro
ON = 1
OFF = 0
@@ -44,13 +50,14 @@ async def test_switch(hass, config_entry, zha_gateway):
# turn on at switch
attr = make_attribute(0, 1)
cluster.handle_message(1, 0x0A, [[attr]])
hdr = make_zcl_header(Command.Report_Attributes)
cluster.handle_message(hdr, [[attr]])
await hass.async_block_till_done()
assert hass.states.get(entity_id).state == STATE_ON
# turn off at switch
attr.value.value = 0
cluster.handle_message(0, 0x0A, [[attr]])
cluster.handle_message(hdr, [[attr]])
await hass.async_block_till_done()
assert hass.states.get(entity_id).state == STATE_OFF