File tree Expand file tree Collapse file tree 1 file changed +11
-5
lines changed
Expand file tree Collapse file tree 1 file changed +11
-5
lines changed Original file line number Diff line number Diff line change @@ -884,18 +884,24 @@ def _rank_thermostat(
884884 return None
885885
886886 # Pre-elect new primary
887- if thermo_matching [appl_class ] == location ["primary_prio" ]:
887+ if (
888+ thermo_matching [appl_class ] == location ["primary_prio" ]
889+ and entity_id not in location ["primary" ]
890+ ):
888891 location ["primary" ].append (entity_id )
889892 elif (thermo_rank := thermo_matching [appl_class ]) > location ["primary_prio" ]:
890893 location ["primary_prio" ] = thermo_rank
891894 # Demote former primary
892895 if tl_primary := location ["primary" ]:
893- location ["secondary" ] += tl_primary
896+ for item in tl_primary :
897+ if item not in location ["secondary" ]:
898+ location ["secondary" ].append (item )
894899 location ["primary" ] = []
895900 # Crown primary
896- location ["primary" ].append (entity_id )
897- else :
898- location ["secondary" ].append (entity_id )
901+ if entity_id not in location ["primary" ]:
902+ location ["primary" ].append (entity_id )
903+ elif entity_id not in location ["secondary" ]:
904+ location ["secondary" ].append (entity_id )
899905
900906 def _control_state (self , data : GwEntityData ) -> str | bool :
901907 """Helper-function for _get_location_data().
You can’t perform that action at this time.
0 commit comments