Skip to content
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

Move alexa integration to use dt_util #26723

Merged
merged 1 commit into from Sep 19, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
4 changes: 2 additions & 2 deletions homeassistant/components/alexa/capabilities.py
@@ -1,5 +1,4 @@
"""Alexa capabilities."""
from datetime import datetime
import logging

from homeassistant.const import (
Expand All @@ -16,6 +15,7 @@
import homeassistant.components.climate.const as climate
from homeassistant.components import light, fan, cover
import homeassistant.util.color as color_util
import homeassistant.util.dt as dt_util

from .const import (
API_TEMP_UNITS,
Expand Down Expand Up @@ -109,7 +109,7 @@ def serialize_properties(self):
"name": prop_name,
"namespace": self.name(),
"value": prop_value,
"timeOfSample": datetime.now().strftime(DATE_FORMAT),
"timeOfSample": dt_util.utcnow().strftime(DATE_FORMAT),
"uncertaintyInMilliseconds": 0,
}

Expand Down
4 changes: 2 additions & 2 deletions homeassistant/components/alexa/flash_briefings.py
@@ -1,9 +1,9 @@
"""Support for Alexa skill service end point."""
import copy
from datetime import datetime
import logging
import uuid

import homeassistant.util.dt as dt_util
from homeassistant.components import http
from homeassistant.core import callback
from homeassistant.helpers import template
Expand Down Expand Up @@ -89,7 +89,7 @@ def get(self, request, briefing_id):
else:
output[ATTR_REDIRECTION_URL] = item.get(CONF_DISPLAY_URL)

output[ATTR_UPDATE_DATE] = datetime.now().strftime(DATE_FORMAT)
output[ATTR_UPDATE_DATE] = dt_util.utcnow().strftime(DATE_FORMAT)

briefing.append(output)

Expand Down
6 changes: 3 additions & 3 deletions homeassistant/components/alexa/handlers.py
@@ -1,5 +1,4 @@
"""Alexa message handlers."""
from datetime import datetime
import logging
import math

Expand Down Expand Up @@ -28,6 +27,7 @@
TEMP_FAHRENHEIT,
)
import homeassistant.util.color as color_util
import homeassistant.util.dt as dt_util
from homeassistant.util.decorator import Registry
from homeassistant.util.temperature import convert as convert_temperature

Expand Down Expand Up @@ -275,7 +275,7 @@ async def async_api_activate(hass, config, directive, context):

payload = {
"cause": {"type": Cause.VOICE_INTERACTION},
"timestamp": "%sZ" % (datetime.utcnow().isoformat(),),
"timestamp": f"{dt_util.utcnow().replace(tzinfo=None).isoformat()}Z",
}

return directive.response(
Expand All @@ -299,7 +299,7 @@ async def async_api_deactivate(hass, config, directive, context):

payload = {
"cause": {"type": Cause.VOICE_INTERACTION},
"timestamp": "%sZ" % (datetime.utcnow().isoformat(),),
"timestamp": f"{dt_util.utcnow().replace(tzinfo=None).isoformat()}Z",
}

return directive.response(
Expand Down