Remove fixed throttle for binary_sensor.command_line and sensor.command_line since the scan_interval is configured trough YAML since #1059 (#4586)
* Remove fixed throttle for binary_sensor.command_line and sensor.command_line since the scan_interval is configured trough YAML since #1059 * Clean up imports * Add SCAN_INTERVAL=60 to put default scan_inteval back to 60
This commit is contained in:
parent
464e843186
commit
0ce3703e30
2 changed files with 2 additions and 6 deletions
|
@ -5,7 +5,6 @@ For more details about this platform, please refer to the documentation at
|
||||||
https://home-assistant.io/components/binary_sensor.command_line/
|
https://home-assistant.io/components/binary_sensor.command_line/
|
||||||
"""
|
"""
|
||||||
import logging
|
import logging
|
||||||
from datetime import timedelta
|
|
||||||
|
|
||||||
import voluptuous as vol
|
import voluptuous as vol
|
||||||
|
|
||||||
|
@ -23,7 +22,7 @@ DEFAULT_NAME = 'Binary Command Sensor'
|
||||||
DEFAULT_PAYLOAD_ON = 'ON'
|
DEFAULT_PAYLOAD_ON = 'ON'
|
||||||
DEFAULT_PAYLOAD_OFF = 'OFF'
|
DEFAULT_PAYLOAD_OFF = 'OFF'
|
||||||
|
|
||||||
MIN_TIME_BETWEEN_UPDATES = timedelta(seconds=60)
|
SCAN_INTERVAL = 60
|
||||||
|
|
||||||
PLATFORM_SCHEMA = PLATFORM_SCHEMA.extend({
|
PLATFORM_SCHEMA = PLATFORM_SCHEMA.extend({
|
||||||
vol.Required(CONF_COMMAND): cv.string,
|
vol.Required(CONF_COMMAND): cv.string,
|
||||||
|
|
|
@ -6,7 +6,6 @@ https://home-assistant.io/components/sensor.command_line/
|
||||||
"""
|
"""
|
||||||
import logging
|
import logging
|
||||||
import subprocess
|
import subprocess
|
||||||
from datetime import timedelta
|
|
||||||
|
|
||||||
import voluptuous as vol
|
import voluptuous as vol
|
||||||
|
|
||||||
|
@ -15,14 +14,13 @@ from homeassistant.const import (
|
||||||
CONF_NAME, CONF_VALUE_TEMPLATE, CONF_UNIT_OF_MEASUREMENT, CONF_COMMAND,
|
CONF_NAME, CONF_VALUE_TEMPLATE, CONF_UNIT_OF_MEASUREMENT, CONF_COMMAND,
|
||||||
STATE_UNKNOWN)
|
STATE_UNKNOWN)
|
||||||
from homeassistant.helpers.entity import Entity
|
from homeassistant.helpers.entity import Entity
|
||||||
from homeassistant.util import Throttle
|
|
||||||
import homeassistant.helpers.config_validation as cv
|
import homeassistant.helpers.config_validation as cv
|
||||||
|
|
||||||
_LOGGER = logging.getLogger(__name__)
|
_LOGGER = logging.getLogger(__name__)
|
||||||
|
|
||||||
DEFAULT_NAME = 'Command Sensor'
|
DEFAULT_NAME = 'Command Sensor'
|
||||||
|
|
||||||
MIN_TIME_BETWEEN_UPDATES = timedelta(seconds=60)
|
SCAN_INTERVAL = 60
|
||||||
|
|
||||||
PLATFORM_SCHEMA = PLATFORM_SCHEMA.extend({
|
PLATFORM_SCHEMA = PLATFORM_SCHEMA.extend({
|
||||||
vol.Required(CONF_COMMAND): cv.string,
|
vol.Required(CONF_COMMAND): cv.string,
|
||||||
|
@ -96,7 +94,6 @@ class CommandSensorData(object):
|
||||||
self.command = command
|
self.command = command
|
||||||
self.value = None
|
self.value = None
|
||||||
|
|
||||||
@Throttle(MIN_TIME_BETWEEN_UPDATES)
|
|
||||||
def update(self):
|
def update(self):
|
||||||
"""Get the latest data with a shell command."""
|
"""Get the latest data with a shell command."""
|
||||||
_LOGGER.info('Running command: %s', self.command)
|
_LOGGER.info('Running command: %s', self.command)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue