Skip to content

Commit

Permalink
fix sensor.py
Browse files Browse the repository at this point in the history
  • Loading branch information
ChessSpider authored Nov 12, 2023
1 parent 5a63f6b commit ac05d7c
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions sensor.py
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ def state(self):

now = datetime.now()
valid_until = datetime.strptime(reservation.get("valid_until", "1900-01-01T00:00:00"), "%Y-%m-%dT%H:%M:%S")
valid_from = datetime.strptime(reservation.get("valid_from", "1900-01-01T00:00:00"), "%Y-%m-%dT%H:%M:%S")
valid_from = datetime.strptime(str(reservation.get("valid_from", "1900-01-01T00:00:00")).split('.')[0], "%Y-%m-%dT%H:%M:%S")

if valid_until > now and valid_from <= now:
return "present"
Expand Down Expand Up @@ -167,8 +167,8 @@ def state(self) -> int:
future_licenseplates = []

for reservation in active_reservations:
valid_until = datetime.strptime(reservation.get("valid_until", "1900-01-01T00:00:00"), "%Y-%m-%dT%H:%M:%S")
valid_from = datetime.strptime(reservation.get("valid_from", "1900-01-01T00:00:00"), "%Y-%m-%dT%H:%M:%S")
valid_until = datetime.strptime(str(reservation.get("valid_until", "1900-01-01T00:00:00")).split('.')[0], "%Y-%m-%dT%H:%M:%S")
valid_from = datetime.strptime(str(reservation.get("valid_from", "1900-01-01T00:00:00")).split('.')[0], "%Y-%m-%dT%H:%M:%S")
license_plate = reservation.get("license_plate")

if license_plate:
Expand Down

0 comments on commit ac05d7c

Please sign in to comment.