hass-core/homeassistant/components/switch
Matthew Treinish 1f1115f631 Serialize mochad requests (#11029)
All mochad devices are sharing a single socket interface. When multiple
threads are issuing requests to the mochad daemon at the same time the
write read cycle might get crossed between the threads. This is normally
not an issue for 1-way X10 devices because as long as the request issued
successfully and data is read over the socket then we know as much as
mochad will tell us (since there is no ACK from the request for most
X10 devices). However, where it does matter is on the device __init__()
because we're relying on the mochad daemon's internal state to take an
educated guess at the device's state to intialize things with. When
there are multiple devices being initialized at the same time the wires
can get crossed between and the wrong device state may be read.

To address this potential issue this commit adds locking using a
semaphore around all pairs of send_cmd() and read_data() (which is what
pymochad.device.Device.get_status() does internally) calls to the mochad
controller to ensure we're only ever dealing with a single request at a
time.

Fixes mtreinish/pymochad#4
2017-12-08 09:18:52 -08:00
..
__init__.py Fix async probs (#9924) 2017-10-19 10:56:25 +02:00
abode.py Fixed bug with all switch devices being excluded (#9555) 2017-09-24 08:22:15 +02:00
acer_projector.py Fix a bunch of typos (#9545) 2017-09-23 17:15:46 +02:00
ads.py Add ADS component (#10142) 2017-12-05 09:44:22 +01:00
android_ip_webcam.py Fix a bunch of typos (#9545) 2017-09-23 17:15:46 +02:00
anel_pwrctrl.py Update docstrings (#7405) 2017-05-02 22:47:20 +02:00
arduino.py Migrate to voluptuous (#3737) 2016-10-11 00:56:57 -07:00
arest.py Fix some issues for PyLint 1.7.2 (#8356) 2017-07-05 20:02:16 -07:00
bbb_gpio.py Fix some issues for PyLint 1.7.2 (#8356) 2017-07-05 20:02:16 -07:00
broadlink.py pad packets to multiple of 4 characters (#10560) 2017-11-14 09:18:06 +01:00
command_line.py Do not call update() in constructor (#8892) 2017-08-08 22:36:59 +02:00
deluge.py Add Deluge Switch Component (#9979) 2017-10-24 16:44:12 +02:00
demo.py Update docstrings (#7374) 2017-05-02 09:18:47 -07:00
digital_ocean.py Use 'hass.data' instead of global (#8245) 2017-06-30 08:46:03 +02:00
digitalloggers.py Fix and optimize digitalloggers platform (#9203) 2017-08-29 15:38:42 +02:00
dlink.py Change attribute names (#9277) 2017-09-03 16:07:12 +02:00
doorbird.py DoorBird Component (#9281) 2017-09-17 20:47:30 +02:00
edimax.py Revise power and energy units and property names. (#6212) 2017-03-19 22:02:11 +01:00
enocean.py Update docstrings (#7374) 2017-05-02 09:18:47 -07:00
flux.py Move constant to 'const.py' and use already definied ones (#10204) 2017-10-29 12:32:02 +01:00
fritzdect.py Update fritzhome to 1.0.3 (#9951) 2017-10-18 20:57:53 +02:00
gc100.py Add gc100 platforms and component (#10159) 2017-10-30 08:40:14 +01:00
hdmi_cec.py Update docstrings (#7405) 2017-05-02 22:47:20 +02:00
hikvisioncam.py Fix Hikvision (motion) switch bug (#10608) 2017-11-16 01:15:45 +01:00
hive.py New Hive Component / Platforms (#9804) 2017-11-23 13:10:23 +01:00
homematic.py WIP: Homematic improvments with new hass interfaces (#9058) 2017-08-31 21:16:44 +02:00
hook.py Fix some issues for PyLint 1.7.2 (#8356) 2017-07-05 20:02:16 -07:00
insteon_local.py Refactored to new global json saving and loading (#10677) 2017-11-19 19:47:55 -08:00
insteon_plm.py Fix a bunch of typos (#9545) 2017-09-23 17:15:46 +02:00
isy994.py Add ISY programs and support for all device types (#3082) 2016-09-11 20:18:53 +02:00
kankun.py Update docstrings (#7405) 2017-05-02 22:47:20 +02:00
knx.py renamed add_devices to async_add_devices according to hass naming scheme (second try after failed #9485) (#9505) 2017-09-20 01:15:20 -04:00
linode.py Linode (#9936) 2017-10-27 16:19:47 +02:00
litejet.py Do not call update() in constructor (#8878) 2017-08-08 20:21:33 +02:00
lutron_caseta.py upgrade to new pylutron_caseta with TLS (#10286) 2017-11-10 12:17:25 +01:00
mfi.py Fix some issues for PyLint 1.7.2 (#8356) 2017-07-05 20:02:16 -07:00
mochad.py Serialize mochad requests (#11029) 2017-12-08 09:18:52 -08:00
modbus.py Modbus switch register support (#10563) 2017-11-15 22:17:10 -08:00
mqtt.py Cleanup and simplitfy the async state update (#9390) 2017-09-12 10:01:03 +02:00
mysensors.py Refactor mysensors callback and add validation (#9069) 2017-08-25 08:58:05 -07:00
mystrom.py myStrom WiFi bulbs (#7161) 2017-04-18 09:03:56 -07:00
neato.py Refactor Neato botvac components as a vacuum (#9946) 2017-11-03 14:25:26 +01:00
netio.py Fix more deprecation warnings (#7778) 2017-05-26 13:12:17 -07:00
orvibo.py Update docstrings (#7420) 2017-05-03 10:11:39 +02:00
pilight.py Pilight switch: restore last state after restart (#8580) 2017-08-22 16:40:14 +02:00
pulseaudio_loopback.py Fix some issues for PyLint 1.7.2 (#8356) 2017-07-05 20:02:16 -07:00
qwikswitch.py Use constants (#5390) 2017-01-17 23:40:34 +01:00
rachio.py Remove not needed call to update (#8930) 2017-08-11 19:55:57 -07:00
rainbird.py cleanup 2017-10-24 12:25:12 +02:00
raincloud.py Introducing support to Melnor RainCloud sprinkler systems (#9287) 2017-09-29 10:08:41 +02:00
rainmachine.py Fixes (#9912) 2017-10-17 09:24:52 +02:00
raspihats.py Add raspihats switch (#7665) 2017-06-04 23:56:21 -07:00
rest.py Add HTTP Basic auth to RESTful Switch (#9162) 2017-09-09 10:20:48 -07:00
rflink.py Add test cases and fix for device_defaults fire_event option. (#9567) 2017-09-24 15:47:59 -07:00
rfxtrx.py Refactor rfxtrx (#9117) 2017-08-29 16:22:28 +02:00
rpi_gpio.py Fix some issues for PyLint 1.7.2 (#8356) 2017-07-05 20:02:16 -07:00
rpi_pfio.py Support for the PiFace Digital I/O module (#7494) 2017-05-09 22:36:33 -07:00
rpi_rf.py Bugfix rpi_rf cleanup (#6513) 2017-03-10 14:56:13 +01:00
scsgate.py Update docstrings (#7374) 2017-05-02 09:18:47 -07:00
services.yaml Update services.yaml files (#10229) 2017-10-30 21:39:12 +01:00
skybell.py Skybell (#9681) 2017-10-08 20:14:39 +02:00
snmp.py Upgrade pysnmp to 4.4.2 (#10539) 2017-11-13 09:24:07 -08:00
tellduslive.py Update docstrings (#7374) 2017-05-02 09:18:47 -07:00
tellstick.py Tellstick Duo acync callback fix (#10384) 2017-11-09 15:03:35 +01:00
telnet.py Telnet switch (#8913) 2017-09-18 17:35:35 +02:00
template.py WIP: Cleanup async stuff on templates (#10275) 2017-11-01 15:48:09 +01:00
tesla.py Tesla bug fixes. (#9774) 2017-10-09 14:38:00 +03:00
thinkingcleaner.py Update docstrings (#7374) 2017-05-02 09:18:47 -07:00
toon.py Fix PEP8 and PEP257 issues (#10108) 2017-10-24 18:36:08 +02:00
tplink.py Allow disabling the LEDs on TP-Link smart plugs (#10980) 2017-12-06 08:38:27 +01:00
transmission.py Update docstrings (#7374) 2017-05-02 09:18:47 -07:00
velbus.py Velbus (#8076) 2017-07-26 14:03:29 +02:00
vera.py Added Vera scenes (#10424) 2017-12-07 07:47:19 +01:00
verisure.py verisure component names (#8251) 2017-06-30 08:53:14 +02:00
volvooncall.py Update docstrings (#7374) 2017-05-02 09:18:47 -07:00
vultr.py Add platform and sensors for Vultr VPS (#9928) 2017-11-05 14:10:14 +01:00
wake_on_lan.py Do not call update() in constructor (#8878) 2017-08-08 20:21:33 +02:00
wemo.py Fix pylint 1.7.2 no-else-return issues (#8361) 2017-07-05 23:30:01 -07:00
wink.py Moved siren to Wink from switch (#9879) 2017-10-20 10:18:32 -04:00
xiaomi_aqara.py Rename xiaomi #9425 (#9426) 2017-09-14 18:49:03 -04:00
xiaomi_miio.py python-miio version bumped for improved device support. (#10720) 2017-11-21 09:23:39 +01:00
zha.py Update docstrings (#7374) 2017-05-02 09:18:47 -07:00
zigbee.py Update docstrings (#7374) 2017-05-02 09:18:47 -07:00
zoneminder.py Maintenance zoneminder (#4102) 2016-10-29 13:10:42 -07:00
zwave.py Update docstrings (#7405) 2017-05-02 22:47:20 +02:00