@@ -833,7 +833,7 @@ async def tinker_legacy_thermostat(
833833 smile ,
834834 schedule_on = True ,
835835 block_cooling = False ,
836- unhappy = False
836+ unhappy = False ,
837837 ):
838838 """Toggle various climate settings to test functionality."""
839839 result_1 = await self .tinker_thermostat_temp (
@@ -847,7 +847,7 @@ async def tinker_legacy_thermostat(
847847 return result_1 and result_2 and result_3
848848
849849 @staticmethod
850- async def tinker_dhw_mode (smile ):
850+ async def tinker_dhw_mode (smile , unhappy = False ):
851851 """Toggle dhw to test functionality."""
852852 for mode in ["auto" , "boost" , BOGUS ]:
853853 warning = ""
@@ -860,9 +860,14 @@ async def tinker_dhw_mode(smile):
860860 _LOGGER .info (" + tinker_dhw_mode worked as intended" )
861861 except pw_exceptions .PlugwiseError :
862862 _LOGGER .info (" + tinker_dhw_mode found invalid mode, as expected" )
863+ except pw_exceptions .ConnectionFailedError :
864+ if unhappy :
865+ _LOGGER .info (" + failed as expected before intended failure" )
866+ else : # pragma: no cover
867+ _LOGGER .info (" - succeeded unexpectedly for some reason" )
863868
864869 @staticmethod
865- async def tinker_regulation_mode (smile ):
870+ async def tinker_regulation_mode (smile , unhappy = False ):
866871 """Toggle regulation_mode to test functionality."""
867872 for mode in ["off" , "heating" , "bleeding_cold" , BOGUS ]:
868873 warning = ""
@@ -877,9 +882,14 @@ async def tinker_regulation_mode(smile):
877882 _LOGGER .info (
878883 " + tinker_regulation_mode found invalid mode, as expected"
879884 )
885+ except pw_exceptions .ConnectionFailedError :
886+ if unhappy :
887+ _LOGGER .info (" + failed as expected before intended failure" )
888+ else : # pragma: no cover
889+ _LOGGER .info (" - succeeded unexpectedly for some reason" )
880890
881891 @staticmethod
882- async def tinker_max_boiler_temp (smile ):
892+ async def tinker_max_boiler_temp (smile , unhappy = False ):
883893 """Change max boiler temp setpoint to test functionality."""
884894 new_temp = 60.0
885895 _LOGGER .info ("- Adjusting temperature to %s" , new_temp )
@@ -889,9 +899,15 @@ async def tinker_max_boiler_temp(smile):
889899 _LOGGER .info (" + tinker_max_boiler_temp worked as intended" )
890900 except pw_exceptions .PlugwiseError :
891901 _LOGGER .info (" + tinker_max_boiler_temp failed as intended" )
902+ except pw_exceptions .ConnectionFailedError :
903+ if unhappy :
904+ _LOGGER .info (" + failed as expected before intended failure" )
905+ else : # pragma: no cover
906+ _LOGGER .info (" - succeeded unexpectedly for some reason" )
907+
892908
893909 @staticmethod
894- async def tinker_temp_offset (smile , dev_id ):
910+ async def tinker_temp_offset (smile , dev_id , unhappy = False ):
895911 """Change temperature_offset to test functionality."""
896912 new_offset = 1.0
897913 _LOGGER .info ("- Adjusting temperature offset to %s" , new_offset )
@@ -902,9 +918,16 @@ async def tinker_temp_offset(smile, dev_id):
902918 except pw_exceptions .PlugwiseError :
903919 _LOGGER .info (" + tinker_temp_offset failed as intended" )
904920 return False
921+ except pw_exceptions .ConnectionFailedError :
922+ if unhappy :
923+ _LOGGER .info (" + failed as expected before intended failure" )
924+ return True
925+ else : # pragma: no cover
926+ _LOGGER .info (" - succeeded unexpectedly for some reason" )
927+ return False
905928
906929 @staticmethod
907- async def tinker_gateway_mode (smile ):
930+ async def tinker_gateway_mode (smile , unhappy = False ):
908931 """Toggle gateway_mode to test functionality."""
909932 for mode in ["away" , "full" , "vacation" , "!bogus" ]:
910933 warning = ""
@@ -917,6 +940,11 @@ async def tinker_gateway_mode(smile):
917940 _LOGGER .info (" + worked as intended" )
918941 except pw_exceptions .PlugwiseError :
919942 _LOGGER .info (" + found invalid mode, as expected" )
943+ except pw_exceptions .ConnectionFailedError :
944+ if unhappy :
945+ _LOGGER .info (" + failed as expected before intended failure" )
946+ else : # pragma: no cover
947+ _LOGGER .info (" - succeeded unexpectedly for some reason" )
920948
921949 @staticmethod
922950 def validate_test_basics (
0 commit comments