core/homeassistant
Jan Losinski 52eb816c62 Introduce a send_delay for pilight component (#4051)
* Add a method to throttle calls to services

This adds CallRateDelayThrottle. This is a class that provides an
decorator to throttle calls to services. Instead of the Throttle in
homeassistant.util it does this by delaying all subsequent calls
instead of just dropping them. Dropping of calls would be bad if we
call services to actual change the state of a connected hardware (like
rf controlled power plugs).

Ihe delay is done by rescheduling the call using
track_point_in_utc_time from homeassistant.helpers.event so it should
not block the mainloop at all.

* Add unittests for CallRateDelayThrottle

Signed-off-by: Jan Losinski <losinski@wh2.tu-dresden.de>

* Introduce a send_delay for pilight component

If pilight is used with a "pilight USB Nano" between the daemon and the
hardware, we must use a delay between sending multiple signals.
Otherwise the hardware will just skip random codes. We hit this
condition for example, if we switch a group of pilight switches on or
off. Without the delay, random switch signals will not be transmitted by
the RF transmitter.

As this seems not necessary, if the transmitter is directly connected
via GPIO, we introduce a optional configuration to set the delay.

* Add unittests for pilight send_delay handling

This adds an unittest to test the delayed calls to the send_code
service.
2016-11-01 21:50:27 -07:00
..
components Introduce a send_delay for pilight component (#4051) 2016-11-01 21:50:27 -07:00
helpers Disable too-many-* (#4107) 2016-10-30 22:18:53 +01:00
scripts Disable too-many-* (#4107) 2016-10-30 22:18:53 +01:00
util Lazy initialise the worker pool (#4110) 2016-10-31 08:47:29 -07:00
__init__.py Fix PEP257 issues 2016-03-08 00:06:04 +01:00
__main__.py Monkey-patch a weakref set in Task to be a no-op. (#3639) 2016-10-01 12:08:25 -07:00
bootstrap.py Lazy initialise the worker pool (#4110) 2016-10-31 08:47:29 -07:00
config.py Disable too-many-* (#4107) 2016-10-30 22:18:53 +01:00
const.py Use voluptuous for Pilight switch (#3819) 2016-10-31 13:18:47 +01:00
core.py Lazy initialise the worker pool (#4110) 2016-10-31 08:47:29 -07:00
exceptions.py Fix PEP257 issues 2016-03-08 00:06:04 +01:00
loader.py fix some comments spell (#4082) 2016-10-28 21:26:52 +02:00
remote.py Disable too-many-* (#4107) 2016-10-30 22:18:53 +01:00