Skip to content

Commit

Permalink
fix: naming
Browse files Browse the repository at this point in the history
  • Loading branch information
ml1nk committed Dec 29, 2023
1 parent 0ec91ca commit 35bdabe
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 9 deletions.
20 changes: 13 additions & 7 deletions custom_components/mypyllant/climate.py
Original file line number Diff line number Diff line change
Expand Up @@ -273,7 +273,7 @@ def circuit_name_suffix(self) -> str:
if self.zone.associated_circuit_index is None:
return ""
else:
return f" of Circuit {self.zone.associated_circuit_index}"
return f" (Circuit {self.zone.associated_circuit_index})"

@property
def name_prefix(self) -> str:
Expand Down Expand Up @@ -519,24 +519,30 @@ def ventilation(self) -> Ventilation:
@property
def device_info(self) -> DeviceInfo:
return DeviceInfo(
identifiers={
(DOMAIN, f"{self.system.id}_ventilation_{self.ventilation.index}")
},
name=self.name,
identifiers={(DOMAIN, self.id_infix)},
name=self.name_prefix,
manufacturer=self.system.brand_name,
)

@property
def unique_id(self) -> str:
return f"{DOMAIN}_{self.system.id}_ventilation_{self.ventilation_index}_climate"
return f"{DOMAIN}_{self.id_infix}_climate"

@property
def name(self) -> str:
def id_infix(self) -> str:
return f"{self.system.id}_ventilation_{self.ventilation_index}"

@property
def name_prefix(self) -> str:
vname = [d for d in self.system.devices if d.type == "ventilation"][
0
].name_display
return f"{self.system.home.home_name or self.system.home.nomenclature} Ventilation {vname}"

@property
def name(self) -> str:
return f"{self.name_prefix} Climate"

@property
def extra_state_attributes(self) -> Mapping[str, Any] | None:
attr = {
Expand Down
4 changes: 2 additions & 2 deletions custom_components/mypyllant/sensor.py
Original file line number Diff line number Diff line change
Expand Up @@ -226,7 +226,7 @@ def unique_id(self) -> str:

@property
def name(self):
return f"{DOMAIN} {self.name_prefix} Outdoor Temperature"
return f"{self.name_prefix} Outdoor Temperature"


class SystemWaterPressureSensor(SystemSensor):
Expand Down Expand Up @@ -329,7 +329,7 @@ def circuit_name_suffix(self) -> str:
if self.zone.associated_circuit_index is None:
return ""
else:
return f" of Circuit {self.zone.associated_circuit_index}"
return f" (Circuit {self.zone.associated_circuit_index})"

@property
def name_prefix(self) -> str:
Expand Down

0 comments on commit 35bdabe

Please sign in to comment.