mirror of
https://github.com/home-assistant/core.git
synced 2025-07-16 01:37:08 +00:00
Update syntax (#14768)
This commit is contained in:
parent
1ce4c2092a
commit
74b7dabf2d
@ -4,7 +4,6 @@ Support for showing the time in a different time zone.
|
|||||||
For more details about this platform, please refer to the documentation at
|
For more details about this platform, please refer to the documentation at
|
||||||
https://home-assistant.io/components/sensor.worldclock/
|
https://home-assistant.io/components/sensor.worldclock/
|
||||||
"""
|
"""
|
||||||
import asyncio
|
|
||||||
import logging
|
import logging
|
||||||
|
|
||||||
import voluptuous as vol
|
import voluptuous as vol
|
||||||
@ -29,8 +28,8 @@ PLATFORM_SCHEMA = PLATFORM_SCHEMA.extend({
|
|||||||
})
|
})
|
||||||
|
|
||||||
|
|
||||||
@asyncio.coroutine
|
async def async_setup_platform(
|
||||||
def async_setup_platform(hass, config, async_add_devices, discovery_info=None):
|
hass, config, async_add_devices, discovery_info=None):
|
||||||
"""Set up the World clock sensor."""
|
"""Set up the World clock sensor."""
|
||||||
name = config.get(CONF_NAME)
|
name = config.get(CONF_NAME)
|
||||||
time_zone = dt_util.get_time_zone(config.get(CONF_TIME_ZONE))
|
time_zone = dt_util.get_time_zone(config.get(CONF_TIME_ZONE))
|
||||||
@ -62,8 +61,7 @@ class WorldClockSensor(Entity):
|
|||||||
"""Icon to use in the frontend, if any."""
|
"""Icon to use in the frontend, if any."""
|
||||||
return ICON
|
return ICON
|
||||||
|
|
||||||
@asyncio.coroutine
|
async def async_update(self):
|
||||||
def async_update(self):
|
|
||||||
"""Get the time and updates the states."""
|
"""Get the time and updates the states."""
|
||||||
self._state = dt_util.now(time_zone=self._time_zone).strftime(
|
self._state = dt_util.now(time_zone=self._time_zone).strftime(
|
||||||
TIME_STR_FORMAT)
|
TIME_STR_FORMAT)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user