Skip to content

Commit

Permalink
Move alexa integration to use dt_util (#26723)
Browse files Browse the repository at this point in the history
  • Loading branch information
tsvi authored and balloob committed Sep 19, 2019
1 parent 770eeaf commit 1041b10
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 7 deletions.
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

0 comments on commit 1041b10

Please sign in to comment.