Improve type hint in brottsplatskartan sensor entity (#77019)
This commit is contained in:
parent
63dcd8ec08
commit
039c071a80
1 changed files with 3 additions and 3 deletions
|
@ -87,7 +87,7 @@ class BrottsplatskartanSensor(SensorEntity):
|
|||
|
||||
_attr_attribution = brottsplatskartan.ATTRIBUTION
|
||||
|
||||
def __init__(self, bpk, name):
|
||||
def __init__(self, bpk: brottsplatskartan.BrottsplatsKartan, name: str) -> None:
|
||||
"""Initialize the Brottsplatskartan sensor."""
|
||||
self._brottsplatskartan = bpk
|
||||
self._attr_name = name
|
||||
|
@ -103,8 +103,8 @@ class BrottsplatskartanSensor(SensorEntity):
|
|||
return
|
||||
|
||||
for incident in incidents:
|
||||
incident_type = incident.get("title_type")
|
||||
incident_counts[incident_type] += 1
|
||||
if (incident_type := incident.get("title_type")) is not None:
|
||||
incident_counts[incident_type] += 1
|
||||
|
||||
self._attr_extra_state_attributes = incident_counts
|
||||
self._attr_native_value = len(incidents)
|
||||
|
|
Loading…
Add table
Reference in a new issue