Skip to content

Commit

Permalink
Fixed NoneType error on next rocket. Closes #25.
Browse files Browse the repository at this point in the history
  • Loading branch information
djtimca committed Jan 25, 2021
1 parent f2e53b5 commit 4d90bb8
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions custom_components/spacex/sensor.py
Original file line number Diff line number Diff line change
Expand Up @@ -327,13 +327,14 @@ def device_state_attributes(self):
elif self._kind == "spacex_next_launch_rocket":
core_counter = 1
for this_core in launch_data["cores_detail"]:
self.attrs["core_" + str(core_counter) + "_serial"] = this_core.get(
"details",{}).get("serial")
if this_core.get("details"):
self.attrs["core_" + str(core_counter) + "_serial"] = this_core["details"].get("serial")
self.attrs["core_" + str(core_counter) + "_block"] = this_core["details"].get("block")

self.attrs["core_" + str(core_counter) + "_flight"] = this_core.get(
"flight"
)
self.attrs["core_" + str(core_counter) + "_block"] = this_core.get(
"details",{}).get("block")

self.attrs[
"core_" + str(core_counter) + "_landing_intent"
] = this_core.get("landing_attempt")
Expand Down

0 comments on commit 4d90bb8

Please sign in to comment.