|  | @@ -121,8 +121,9 @@ def test__update_and_report_device_info(
 | 
											
												
													
														|  |  ):
 |  |  ):
 | 
											
												
													
														|  |      with unittest.mock.patch("switchbot.SwitchbotCurtain.__init__", return_value=None):
 |  |      with unittest.mock.patch("switchbot.SwitchbotCurtain.__init__", return_value=None):
 | 
											
												
													
														|  |          actor = _CurtainMotor(mac_address="dummy", retry_count=21, password=None)
 |  |          actor = _CurtainMotor(mac_address="dummy", retry_count=21, password=None)
 | 
											
												
													
														|  | -    actor._get_device()._battery_percent = battery_percent
 |  | 
 | 
											
												
													
														|  | -    actor._get_device()._pos = position
 |  | 
 | 
											
												
													
														|  | 
 |  | +    actor._get_device()._switchbot_device_data = {
 | 
											
												
													
														|  | 
 |  | +        "data": {"battery": battery_percent, "position": position}
 | 
											
												
													
														|  | 
 |  | +    }
 | 
											
												
													
														|  |      mqtt_client_mock = unittest.mock.MagicMock()
 |  |      mqtt_client_mock = unittest.mock.MagicMock()
 | 
											
												
													
														|  |      with unittest.mock.patch("switchbot.SwitchbotCurtain.update") as update_mock:
 |  |      with unittest.mock.patch("switchbot.SwitchbotCurtain.update") as update_mock:
 | 
											
												
													
														|  |          actor._update_and_report_device_info(
 |  |          actor._update_and_report_device_info(
 | 
											
										
											
												
													
														|  | @@ -299,21 +300,21 @@ def test_execute_command_bluetooth_error(caplog, mac_address, message_payload):
 | 
											
												
													
														|  |          ),
 |  |          ),
 | 
											
												
													
														|  |      ), caplog.at_level(logging.ERROR):
 |  |      ), caplog.at_level(logging.ERROR):
 | 
											
												
													
														|  |          _CurtainMotor(
 |  |          _CurtainMotor(
 | 
											
												
													
														|  | -            mac_address=mac_address, retry_count=10, password="secret"
 |  | 
 | 
											
												
													
														|  | 
 |  | +            mac_address=mac_address, retry_count=0, password="secret"
 | 
											
												
													
														|  |          ).execute_command(
 |  |          ).execute_command(
 | 
											
												
													
														|  |              mqtt_client="dummy",
 |  |              mqtt_client="dummy",
 | 
											
												
													
														|  |              mqtt_message_payload=message_payload,
 |  |              mqtt_message_payload=message_payload,
 | 
											
												
													
														|  |              update_device_info=True,
 |  |              update_device_info=True,
 | 
											
												
													
														|  |          )
 |  |          )
 | 
											
												
													
														|  | -    assert caplog.record_tuples == [
 |  | 
 | 
											
												
													
														|  | -        (
 |  | 
 | 
											
												
													
														|  | -            "switchbot",
 |  | 
 | 
											
												
													
														|  | -            logging.ERROR,
 |  | 
 | 
											
												
													
														|  | -            "Switchbot communication failed. Stopping trying.",
 |  | 
 | 
											
												
													
														|  | -        ),
 |  | 
 | 
											
												
													
														|  | -        (
 |  | 
 | 
											
												
													
														|  | -            "switchbot_mqtt._actors",
 |  | 
 | 
											
												
													
														|  | -            logging.ERROR,
 |  | 
 | 
											
												
													
														|  | -            f"failed to {message_payload.decode().lower()} switchbot curtain {mac_address}",
 |  | 
 | 
											
												
													
														|  | -        ),
 |  | 
 | 
											
												
													
														|  | -    ]
 |  | 
 | 
											
												
													
														|  | 
 |  | +    assert len(caplog.records) == 2
 | 
											
												
													
														|  | 
 |  | +    assert caplog.records[0].name == "switchbot"
 | 
											
												
													
														|  | 
 |  | +    assert caplog.records[0].levelno == logging.ERROR
 | 
											
												
													
														|  | 
 |  | +    assert caplog.records[0].msg.startswith(
 | 
											
												
													
														|  | 
 |  | +        # pySwitchbot<0.11 had '.' suffix
 | 
											
												
													
														|  | 
 |  | +        "Switchbot communication failed. Stopping trying",
 | 
											
												
													
														|  | 
 |  | +    )
 | 
											
												
													
														|  | 
 |  | +    assert caplog.record_tuples[1] == (
 | 
											
												
													
														|  | 
 |  | +        "switchbot_mqtt._actors",
 | 
											
												
													
														|  | 
 |  | +        logging.ERROR,
 | 
											
												
													
														|  | 
 |  | +        f"failed to {message_payload.decode().lower()} switchbot curtain {mac_address}",
 | 
											
												
													
														|  | 
 |  | +    )
 |