Skip to content

Commit

Permalink
Merge pull request #2004 from jsl12/dev
Browse files Browse the repository at this point in the history
fixed a typo causing a dictionary to get called instead of accessed
  • Loading branch information
acockburn committed May 1, 2024
2 parents 3a9000b + 122d422 commit d288fc0
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions appdaemon/plugins/hass/hassplugin.py
Original file line number Diff line number Diff line change
Expand Up @@ -650,11 +650,11 @@ async def get_history_api(self, **kwargs):
days = max(0, kwargs.get("days", 0))

def as_datetime(args, key):
if key in args:
if isinstance(args[key], str):
return utils.str_to_dt(args(key)).replace(microsecond=0)
elif isinstance(args[key], datetime.datetime):
return self.AD.tz.localize(args[key]).replace(microsecond=0)
if val := args.get(key):
if isinstance(val, str):
return utils.str_to_dt(val).replace(microsecond=0)
elif isinstance(val, datetime.datetime):
return self.AD.tz.localize(val).replace(microsecond=0)
else:
raise ValueError(f"Invalid type for {key}")

Expand Down

0 comments on commit d288fc0

Please sign in to comment.