Skip to content

Commit

Permalink
fix: bypass device_pin if not retrieved, references #55 (#56)
Browse files Browse the repository at this point in the history
  • Loading branch information
geertmeersman authored Jul 18, 2023
2 parents d1a8f4a + f9ec235 commit 3743302
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 14 deletions.
4 changes: 3 additions & 1 deletion .github/scripts/get_new_version.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,11 @@
latest_release = response.json()
latest_version = latest_release["tag_name"]

ref = os.environ["GITHUB_REF"]

# Get the commit count since the latest release
response = requests.get(
f"https://api.github.com/repos/{owner}/{repo}/compare/{latest_version}...HEAD",
f"https://api.github.com/repos/{owner}/{repo}/compare/{latest_version}...{ref}",
timeout=10,
)
compare_info = response.json()
Expand Down
27 changes: 14 additions & 13 deletions custom_components/nexxtmove/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -491,19 +491,20 @@ def fetch_data(self):
"""

pin = self.device_pin(charging_device.get("id"))
key = format_entity_name(
f"{self.username} charging device {charging_device_id} pin"
)
data[key] = NexxtmoveItem(
name=f"{charging_device.get('name')} PIN",
key=key,
type="charging_device_pin",
sensor_type="sensor",
device_key=device_key,
device_name=device_name,
device_model=device_model,
state=pin.get("pin"),
)
if pin is not False:
key = format_entity_name(
f"{self.username} charging device {charging_device_id} pin"
)
data[key] = NexxtmoveItem(
name=f"{charging_device.get('name')} PIN",
key=key,
type="charging_device_pin",
sensor_type="sensor",
device_key=device_key,
device_name=device_name,
device_model=device_model,
state=pin.get("pin"),
)

events = self.device_events(charging_device.get("id"))
if events.get("events") and len(events.get("events")):
Expand Down

0 comments on commit 3743302

Please sign in to comment.