Bump dependency & add devices for HomematicIP Cloud (#36595)

* update dependency and test data

* Add test for HmIP-SWDO-PL

* Add device HmIP-MOD-HO

* Fix test
This commit is contained in:
SukramJ authored and GitHub committed 2020-06-10 11:34:14 +02:00
1 parent 44552937b6
commit 212b9df87d
8 files changed
+292 -8

No files matched your search

@@ -128,6 +128,36 @@ async def test_hmip_shutter_contact(hass, default_mock_hap_factory):
assert ha_state.attributes[ATTR_SABOTAGE]
async def test_hmip_shutter_contact_optical(hass, default_mock_hap_factory):
"""Test HomematicipShutterContact."""
entity_id = "binary_sensor.sitzplatzture"
entity_name = "Sitzplatzt\u00fcre"
device_model = "HmIP-SWDO-PL"
mock_hap = await default_mock_hap_factory.async_get_mock_hap(
test_devices=[entity_name]
)
ha_state, hmip_device = get_and_check_entity_basics(
hass, mock_hap, entity_id, entity_name, device_model
)
assert ha_state.state == STATE_OFF
await async_manipulate_test_data(hass, hmip_device, "windowState", WindowState.OPEN)
ha_state = hass.states.get(entity_id)
assert ha_state.state == STATE_ON
await async_manipulate_test_data(hass, hmip_device, "windowState", None)
ha_state = hass.states.get(entity_id)
assert ha_state.state == STATE_OFF
# test common attributes
assert ha_state.attributes[ATTR_RSSI_DEVICE] == -72
assert not ha_state.attributes.get(ATTR_SABOTAGE)
await async_manipulate_test_data(hass, hmip_device, "sabotage", True)
ha_state = hass.states.get(entity_id)
assert ha_state.attributes[ATTR_SABOTAGE]
async def test_hmip_motion_detector(hass, default_mock_hap_factory):
"""Test HomematicipMotionDetector."""
entity_id = "binary_sensor.bewegungsmelder_fur_55er_rahmen_innen"
@@ -207,6 +207,53 @@ async def test_hmip_garage_door_tormatic(hass, default_mock_hap_factory):
assert hmip_device.mock_calls[-1][1] == (DoorCommand.STOP,)
async def test_hmip_garage_door_hoermann(hass, default_mock_hap_factory):
"""Test HomematicipCoverShutte."""
entity_id = "cover.garage_door"
entity_name = "Garage door"
device_model = "HmIP-MOD-HO"
mock_hap = await default_mock_hap_factory.async_get_mock_hap(
test_devices=[entity_name]
)
ha_state, hmip_device = get_and_check_entity_basics(
hass, mock_hap, entity_id, entity_name, device_model
)
assert ha_state.state == "closed"
assert ha_state.attributes["current_position"] == 0
service_call_counter = len(hmip_device.mock_calls)
await hass.services.async_call(
"cover", "open_cover", {"entity_id": entity_id}, blocking=True
)
assert len(hmip_device.mock_calls) == service_call_counter + 1
assert hmip_device.mock_calls[-1][0] == "send_door_command"
assert hmip_device.mock_calls[-1][1] == (DoorCommand.OPEN,)
await async_manipulate_test_data(hass, hmip_device, "doorState", DoorState.OPEN)
ha_state = hass.states.get(entity_id)
assert ha_state.state == STATE_OPEN
assert ha_state.attributes[ATTR_CURRENT_POSITION] == 100
await hass.services.async_call(
"cover", "close_cover", {"entity_id": entity_id}, blocking=True
)
assert len(hmip_device.mock_calls) == service_call_counter + 3
assert hmip_device.mock_calls[-1][0] == "send_door_command"
assert hmip_device.mock_calls[-1][1] == (DoorCommand.CLOSE,)
await async_manipulate_test_data(hass, hmip_device, "doorState", DoorState.CLOSED)
ha_state = hass.states.get(entity_id)
assert ha_state.state == STATE_CLOSED
assert ha_state.attributes[ATTR_CURRENT_POSITION] == 0
await hass.services.async_call(
"cover", "stop_cover", {"entity_id": entity_id}, blocking=True
)
assert len(hmip_device.mock_calls) == service_call_counter + 5
assert hmip_device.mock_calls[-1][0] == "send_door_command"
assert hmip_device.mock_calls[-1][1] == (DoorCommand.STOP,)
async def test_hmip_cover_shutter_group(hass, default_mock_hap_factory):
"""Test HomematicipCoverShutteGroup."""
entity_id = "cover.rollos_shuttergroup"
@@ -22,7 +22,7 @@ async def test_hmip_load_all_supported_devices(hass, default_mock_hap_factory):
test_devices=None, test_groups=None
)
assert len(mock_hap.hmip_device_by_entity_id) == 183
assert len(mock_hap.hmip_device_by_entity_id) == 186
async def test_hmip_remove_device(hass, default_mock_hap_factory):