Skip to content

Commit 5bd8dce

Browse files
committed
fix coordinator var name
1 parent 470053c commit 5bd8dce

File tree

2 files changed

+10
-10
lines changed

2 files changed

+10
-10
lines changed

binary_sensor.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -169,7 +169,7 @@ def is_on(self) -> bool:
169169

170170
hub: SureHub
171171

172-
if hub := self.coordinator.data[self._id]:
172+
if hub := self._coordinator.data[self._id]:
173173

174174
self._attr_extra_state_attributes = {
175175
"led_mode": int(hub.raw_data()["status"]["led_mode"]),
@@ -201,7 +201,7 @@ def __init__(self, coordinator, _id: int, spc: SurePetcareAPI) -> None:
201201
def is_on(self) -> bool:
202202
"""Return True if the pet is at home."""
203203
pet: SurePet
204-
if pet := self.coordinator.data[self._id]:
204+
if pet := self._coordinator.data[self._id]:
205205
return bool(Location(pet.location.where) == Location.INSIDE)
206206

207207

sensor.py

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -176,7 +176,7 @@ def __init__(self, coordinator, _id: int, spc: SurePetcareAPI) -> None:
176176
def state(self) -> str | None:
177177
"""Return battery level in percent."""
178178
if (
179-
state := cast(SureFlap, self.coordinator.data[self._id])
179+
state := cast(SureFlap, self._coordinator.data[self._id])
180180
.raw_data()
181181
.get("status")
182182
):
@@ -196,7 +196,7 @@ def __init__(self, coordinator, _id: int, spc: SurePetcareAPI):
196196
@property
197197
def state(self) -> float | None:
198198
"""Return the remaining water."""
199-
if felaqua := cast(SureFelaqua, self.coordinator.data[self._id]):
199+
if felaqua := cast(SureFelaqua, self._coordinator.data[self._id]):
200200
return int(felaqua.water_remaining) if felaqua.water_remaining else None
201201

202202
@property
@@ -206,7 +206,7 @@ def extra_state_attributes(self) -> dict[str, Any]:
206206
attrs = {}
207207

208208
if (
209-
state := cast(SureFelaqua, self.coordinator.data[self._id])
209+
state := cast(SureFelaqua, self._coordinator.data[self._id])
210210
.raw_data()
211211
.get("status")
212212
):
@@ -221,7 +221,7 @@ def device_info(self):
221221

222222
device = {}
223223

224-
if felaqua := cast(SureFelaqua, self.coordinator.data[self._id]):
224+
if felaqua := cast(SureFelaqua, self._coordinator.data[self._id]):
225225

226226
try:
227227
model = f"{felaqua.type.name.replace('_', ' ').title()}"
@@ -285,7 +285,7 @@ def __init__(
285285
def state(self) -> float | None:
286286
"""Return the remaining water."""
287287

288-
if (feeder := cast(SureFeeder, self.coordinator.data[self.feeder_id])) and (
288+
if (feeder := cast(SureFeeder, self._coordinator.data[self.feeder_id])) and (
289289
weight := feeder.bowls[self.bowl_id].weight
290290
):
291291
return int(weight) if weight and weight > 0 else None
@@ -304,7 +304,7 @@ def __init__(self, coordinator, _id: int, spc: SurePetcareAPI):
304304
@property
305305
def state(self) -> float | None:
306306
"""Return the total remaining food."""
307-
if feeder := cast(SureFeeder, self.coordinator.data[self._id]):
307+
if feeder := cast(SureFeeder, self._coordinator.data[self._id]):
308308
return int(feeder.total_weight) if feeder.total_weight else None
309309

310310
@property
@@ -350,7 +350,7 @@ def __init__(self, coordinator, _id: int, spc: SurePetcareAPI):
350350
@property
351351
def state(self) -> int | None:
352352
"""Return battery level in percent."""
353-
if battery := cast(SurepyDevice, self.coordinator.data[self._id]):
353+
if battery := cast(SurepyDevice, self._coordinator.data[self._id]):
354354
return int(battery.battery_level) if battery.battery_level else None
355355

356356
@property
@@ -360,7 +360,7 @@ def extra_state_attributes(self) -> dict[str, Any]:
360360
attrs = {}
361361

362362
if (
363-
state := cast(SurepyDevice, self.coordinator.data[self._id])
363+
state := cast(SurepyDevice, self._coordinator.data[self._id])
364364
.raw_data()
365365
.get("status")
366366
):

0 commit comments

Comments
 (0)