@@ -986,6 +986,35 @@ async def tinker_gateway_mode(api, unhappy=False):
986986
987987 return tinker_gateway_mode_passed
988988
989+ @staticmethod
990+ async def tinker_zone_profile (api , unhappy = False ):
991+ """Toggle gateway_mode to test functionality."""
992+ tinker_zone_profile_passed = False
993+ for profile in ["active" , "off" , "passive" , "!bogus" ]:
994+ warning = ""
995+ if profile [0 ] == "!" :
996+ warning = " Negative test"
997+ profile = profile [1 :]
998+ _LOGGER .info ("%s" , f"- Adjusting zone_profile to { profile } { warning } " )
999+ try :
1000+ await api .set_select ("select_zone_profile" , loc_id , profile )
1001+ _LOGGER .info (" + worked as intended" )
1002+ tinker_zone_profile_passed = True
1003+ except pw_exceptions .PlugwiseError :
1004+ _LOGGER .info (" + found invalid mode, as expected" )
1005+ tinker_zone_profile_passed = False
1006+ except (
1007+ pw_exceptions .ConnectionFailedError
1008+ ): # leave for-loop at connect-error
1009+ if unhappy :
1010+ _LOGGER .info (" + failed as expected before intended failure" )
1011+ return True
1012+ else : # pragma: no cover
1013+ _LOGGER .info (" - succeeded unexpectedly for some reason" )
1014+ return False
1015+
1016+ return tinker_zone_profile_passed
1017+
9891018 @staticmethod
9901019 def validate_test_basics (
9911020 parent_logger ,
0 commit comments