Skip to content

Commit

Permalink
last_changed_seconds wrong due to timezone AppDaemon#1571
Browse files Browse the repository at this point in the history
  • Loading branch information
acockburn committed Mar 4, 2023
1 parent c81d56d commit 05fedba
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
3 changes: 1 addition & 2 deletions appdaemon/entity.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
import asyncio
import uuid
import iso8601
from datetime import datetime
from collections.abc import Iterable


Expand Down Expand Up @@ -590,7 +589,7 @@ def last_changed_seconds(self) -> float:
"""Get the entity's last changed time in seconds"""

utc = iso8601.parse_date(self.states_attrs.last_changed)
now = self.AD.sched.convert_naive(datetime.now())
now = self.AD.sched.get_now_sync()
return (now - utc).total_seconds()

def __repr__(self) -> str:
Expand Down
1 change: 1 addition & 0 deletions docs/HISTORY.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ Change Log
- Trailing slash on hass url breaks connectivity #999
- parse_time("sunset") and impact of "aware" #1645
- constrain_person not working #1437
- last_changed_seconds wrong due to timezone #1571

**Breaking Changes**

Expand Down

0 comments on commit 05fedba

Please sign in to comment.