@@ -620,6 +620,7 @@ def register_service(
620620 ttl : Optional [int ] = None ,
621621 allow_name_change : bool = False ,
622622 cooperating_responders : bool = False ,
623+ strict : bool = True ,
623624 ) -> None :
624625 """Registers service information to the network with a default TTL.
625626 Zeroconf will then respond to requests for information for that
@@ -635,7 +636,7 @@ def register_service(
635636 assert self .loop is not None
636637 run_coro_with_timeout (
637638 await_awaitable (
638- self .async_register_service (info , ttl , allow_name_change , cooperating_responders )
639+ self .async_register_service (info , ttl , allow_name_change , cooperating_responders , strict )
639640 ),
640641 self .loop ,
641642 _REGISTER_TIME * _REGISTER_BROADCASTS ,
@@ -647,6 +648,7 @@ async def async_register_service(
647648 ttl : Optional [int ] = None ,
648649 allow_name_change : bool = False ,
649650 cooperating_responders : bool = False ,
651+ strict : bool = True ,
650652 ) -> Awaitable :
651653 """Registers service information to the network with a default TTL.
652654 Zeroconf will then respond to requests for information for that
@@ -662,7 +664,7 @@ async def async_register_service(
662664
663665 info .set_server_if_missing ()
664666 await self .async_wait_for_start ()
665- await self .async_check_service (info , allow_name_change , cooperating_responders )
667+ await self .async_check_service (info , allow_name_change , cooperating_responders , strict )
666668 self .registry .async_add (info )
667669 return asyncio .ensure_future (self ._async_broadcast_service (info , _REGISTER_TIME , None ))
668670
@@ -810,11 +812,15 @@ def unregister_all_services(self) -> None:
810812 )
811813
812814 async def async_check_service (
813- self , info : ServiceInfo , allow_name_change : bool , cooperating_responders : bool = False
815+ self ,
816+ info : ServiceInfo ,
817+ allow_name_change : bool ,
818+ cooperating_responders : bool = False ,
819+ strict : bool = True ,
814820 ) -> None :
815821 """Checks the network for a unique service name, modifying the
816822 ServiceInfo passed in if it is not unique."""
817- instance_name = instance_name_from_service_info (info )
823+ instance_name = instance_name_from_service_info (info , strict = strict )
818824 if cooperating_responders :
819825 return
820826 next_instance_number = 2
@@ -829,7 +835,7 @@ async def async_check_service(
829835 # change the name and look for a conflict
830836 info .name = f'{ instance_name } -{ next_instance_number } .{ info .type } '
831837 next_instance_number += 1
832- service_type_name (info .name )
838+ service_type_name (info .name , strict = strict )
833839 next_time = now
834840 i = 0
835841
0 commit comments