39
39
vol .Required (CONF_COMMAND ): cv .string ,
40
40
vol .Required (CONF_UNIT_OF_MEASUREMENT ): cv .string ,
41
41
vol .Optional (CONF_VALUE_TEMPLATE ): cv .template ,
42
+ vol .Optional (CONF_SCAN , default = MIN_TIME_BETWEEN_UPDATES ): cv .string ,
42
43
})
43
44
44
45
@asyncio .coroutine
@@ -61,6 +62,7 @@ def __init__(self, hass, config):
61
62
self ._command = config .get (CONF_COMMAND )
62
63
self ._value_template = config .get (CONF_VALUE_TEMPLATE )
63
64
self ._unit_of_measurement = config .get (CONF_UNIT_OF_MEASUREMENT )
65
+ self ._scan = config .get (CONF_SCAN )
64
66
self ._ssh = None
65
67
self ._connected = False
66
68
self ._connect ()
@@ -94,7 +96,12 @@ def unit_of_measurement(self):
94
96
"""Return the unit of measurement of this entity, if any."""
95
97
return self ._unit_of_measurement
96
98
97
- @Throttle (MIN_TIME_BETWEEN_UPDATES )
99
+ @property
100
+ def scan (self ):
101
+ """Return the period between executions, if any."""
102
+ return self ._scan
103
+
104
+ @Throttle (self ._scan )
98
105
def update (self ):
99
106
from pexpect import pxssh , exceptions
100
107
@@ -128,7 +135,7 @@ def update(self):
128
135
return None
129
136
130
137
def _connect (self ):
131
- """Connect to the Unifi AP SSH server."""
138
+ """Connect to the SSH server."""
132
139
from pexpect import pxssh , exceptions
133
140
134
141
self ._ssh = pxssh .pxssh ()
0 commit comments