-
-
Notifications
You must be signed in to change notification settings - Fork 31.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Update launch library to use datetime #19521
Conversation
Previous version used "start" from pylaunches which is a string that is not parsed by home assistant into a datetime. This change updates launch library to use the timestamp from pylaunches and parses it to make the launch_time attribute easier to template and automate with.
@@ -62,7 +63,7 @@ def __init__(self, launches, name): | |||
try: | |||
data = self.launches.launches[0] | |||
self._state = data['name'] | |||
self._attributes['launch_time'] = data['start'] | |||
self._attributes['launch_time'] = template_help.timestamp_local(data['wsstamp']) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
line too long (92 > 79 characters)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed with commit 2.
Reduced line length to comply with 79 character limit.
IMO this should preferably be changed in pylaunches. |
I agree @amelchio
Since this is used in an attribute I'm not sure if this apply home-assistant/architecture#39, but consistancy is good i guess :) |
@DoloresHA I pushed version |
@@ -62,7 +63,8 @@ def __init__(self, launches, name): | |||
try: | |||
data = self.launches.launches[0] | |||
self._state = data['name'] | |||
self._attributes['launch_time'] = data['start'] | |||
self._attributes['launch_time'] = template_help.timestamp_local( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why can't we use as_local
from util/dt.py
?
@ludeeus hmm I updated my pylaunches dependency to 0.2.0, but |
Previous version used "start" from pylaunches which is a string that is not parsed by home assistant into a datetime. This change updates launch library to use the timestamp from pylaunches and parses it to make the launch_time attribute easier to template and automate with.
Description:
Modified launch library to pass datetime-parsable string instead of string.
**Related issue (if applicable): None
Example entry for
configuration.yaml
(if applicable):Checklist:
tox
. Your PR cannot be merged unless tests passIf user exposed functionality or configuration variables are added/changed:
If the code communicates with devices, web services, or third-party tools: N/A
REQUIREMENTS
variable (example).requirements_all.txt
by runningscript/gen_requirements_all.py
..coveragerc
.If the code does not interact with devices: