diff --git a/esphomeyaml/components/binary_sensor/remote_receiver.py b/esphomeyaml/components/binary_sensor/remote_receiver.py index c3f6c87d5d..9e1cf50d99 100644 --- a/esphomeyaml/components/binary_sensor/remote_receiver.py +++ b/esphomeyaml/components/binary_sensor/remote_receiver.py @@ -9,14 +9,15 @@ from esphomeyaml.components.remote_transmitter import RC_SWITCH_RAW_SCHEMA, \ from esphomeyaml.const import CONF_ADDRESS, CONF_CHANNEL, CONF_CODE, CONF_COMMAND, CONF_DATA, \ CONF_DEVICE, CONF_FAMILY, CONF_GROUP, CONF_LG, CONF_NAME, CONF_NBITS, CONF_NEC, \ CONF_PANASONIC, CONF_PROTOCOL, CONF_RAW, CONF_RC_SWITCH_RAW, CONF_RC_SWITCH_TYPE_A, \ - CONF_RC_SWITCH_TYPE_B, CONF_RC_SWITCH_TYPE_C, CONF_RC_SWITCH_TYPE_D, CONF_SONY, CONF_STATE + CONF_RC_SWITCH_TYPE_B, CONF_RC_SWITCH_TYPE_C, CONF_RC_SWITCH_TYPE_D, CONF_SAMSUNG, CONF_SONY, \ + CONF_STATE from esphomeyaml.helpers import ArrayInitializer, Pvariable, get_variable DEPENDENCIES = ['remote_receiver'] -REMOTE_KEYS = [CONF_NEC, CONF_LG, CONF_SONY, CONF_PANASONIC, CONF_RAW, CONF_RC_SWITCH_RAW, - CONF_RC_SWITCH_TYPE_A, CONF_RC_SWITCH_TYPE_B, CONF_RC_SWITCH_TYPE_C, - CONF_RC_SWITCH_TYPE_D] +REMOTE_KEYS = [CONF_NEC, CONF_LG, CONF_SONY, CONF_PANASONIC, CONF_SAMSUNG, CONF_RAW, + CONF_RC_SWITCH_RAW, CONF_RC_SWITCH_TYPE_A, CONF_RC_SWITCH_TYPE_B, + CONF_RC_SWITCH_TYPE_C, CONF_RC_SWITCH_TYPE_D] CONF_REMOTE_RECEIVER_ID = 'remote_receiver_id' CONF_RECEIVER_ID = 'receiver_id' @@ -26,6 +27,7 @@ LGReceiver = remote_ns.LGReceiver NECReceiver = remote_ns.NECReceiver PanasonicReceiver = remote_ns.PanasonicReceiver RawReceiver = remote_ns.RawReceiver +SamsungReceiver = remote_ns.SamsungReceiver SonyReceiver = remote_ns.SonyReceiver RCSwitchRawReceiver = remote_ns.RCSwitchRawReceiver RCSwitchTypeAReceiver = remote_ns.RCSwitchTypeAReceiver @@ -42,6 +44,9 @@ PLATFORM_SCHEMA = cv.nameable(binary_sensor.BINARY_SENSOR_PLATFORM_SCHEMA.extend vol.Required(CONF_ADDRESS): cv.hex_uint16_t, vol.Required(CONF_COMMAND): cv.hex_uint16_t, }), + vol.Optional(CONF_SAMSUNG): vol.Schema({ + vol.Required(CONF_DATA): cv.hex_uint32_t, + }), vol.Optional(CONF_SONY): vol.Schema({ vol.Required(CONF_DATA): cv.hex_uint32_t, vol.Optional(CONF_NBITS, default=12): vol.All(vol.Coerce(int), cv.one_of(12, 15, 20)), @@ -71,6 +76,8 @@ def receiver_base(full_config): return NECReceiver.new(name, config[CONF_ADDRESS], config[CONF_COMMAND]) elif key == CONF_PANASONIC: return PanasonicReceiver.new(name, config[CONF_ADDRESS], config[CONF_COMMAND]) + elif key == CONF_SAMSUNG: + return SamsungReceiver.new(name, config[CONF_DATA]) elif key == CONF_SONY: return SonyReceiver.new(name, config[CONF_DATA], config[CONF_NBITS]) elif key == CONF_RAW: diff --git a/esphomeyaml/components/remote_receiver.py b/esphomeyaml/components/remote_receiver.py index 7bd3ff5b2f..8cb6be5a93 100644 --- a/esphomeyaml/components/remote_receiver.py +++ b/esphomeyaml/components/remote_receiver.py @@ -15,6 +15,7 @@ DUMPERS = { 'nec': remote_ns.NECDumper, 'panasonic': remote_ns.PanasonicDumper, 'raw': remote_ns.RawDumper, + 'samsung': remote_ns.SamsungDumper, 'sony': remote_ns.SonyDumper, 'rc_switch': remote_ns.RCSwitchDumper, } diff --git a/esphomeyaml/components/switch/remote_transmitter.py b/esphomeyaml/components/switch/remote_transmitter.py index 88a4f1cec9..058e84d44e 100644 --- a/esphomeyaml/components/switch/remote_transmitter.py +++ b/esphomeyaml/components/switch/remote_transmitter.py @@ -10,15 +10,15 @@ from esphomeyaml.const import CONF_ADDRESS, CONF_CARRIER_FREQUENCY, CONF_CHANNEL CONF_COMMAND, CONF_DATA, CONF_DEVICE, CONF_FAMILY, CONF_GROUP, CONF_INVERTED, CONF_LG, \ CONF_NAME, CONF_NBITS, CONF_NEC, CONF_PANASONIC, CONF_PROTOCOL, CONF_RAW, CONF_RC_SWITCH_RAW, \ CONF_RC_SWITCH_TYPE_A, CONF_RC_SWITCH_TYPE_B, CONF_RC_SWITCH_TYPE_C, CONF_RC_SWITCH_TYPE_D, \ - CONF_REPEAT, CONF_SONY, CONF_STATE, CONF_TIMES, \ + CONF_REPEAT, CONF_SAMSUNG, CONF_SONY, CONF_STATE, CONF_TIMES, \ CONF_WAIT_TIME from esphomeyaml.helpers import App, ArrayInitializer, Pvariable, add, get_variable DEPENDENCIES = ['remote_transmitter'] -REMOTE_KEYS = [CONF_NEC, CONF_LG, CONF_SONY, CONF_PANASONIC, CONF_RAW, CONF_RC_SWITCH_RAW, - CONF_RC_SWITCH_TYPE_A, CONF_RC_SWITCH_TYPE_B, CONF_RC_SWITCH_TYPE_C, - CONF_RC_SWITCH_TYPE_D] +REMOTE_KEYS = [CONF_NEC, CONF_LG, CONF_SAMSUNG, CONF_SONY, CONF_PANASONIC, CONF_RAW, + CONF_RC_SWITCH_RAW, CONF_RC_SWITCH_TYPE_A, CONF_RC_SWITCH_TYPE_B, + CONF_RC_SWITCH_TYPE_C, CONF_RC_SWITCH_TYPE_D] CONF_REMOTE_TRANSMITTER_ID = 'remote_transmitter_id' CONF_TRANSMITTER_ID = 'transmitter_id' @@ -28,6 +28,7 @@ LGTransmitter = remote_ns.LGTransmitter NECTransmitter = remote_ns.NECTransmitter PanasonicTransmitter = remote_ns.PanasonicTransmitter RawTransmitter = remote_ns.RawTransmitter +SamsungTransmitter = remote_ns.SamsungTransmitter SonyTransmitter = remote_ns.SonyTransmitter RCSwitchRawTransmitter = remote_ns.RCSwitchRawTransmitter RCSwitchTypeATransmitter = remote_ns.RCSwitchTypeATransmitter @@ -46,6 +47,9 @@ PLATFORM_SCHEMA = cv.nameable(switch.SWITCH_PLATFORM_SCHEMA.extend({ vol.Required(CONF_ADDRESS): cv.hex_uint16_t, vol.Required(CONF_COMMAND): cv.hex_uint16_t, }), + vol.Optional(CONF_SAMSUNG): vol.Schema({ + vol.Required(CONF_DATA): cv.hex_uint32_t, + }), vol.Optional(CONF_SONY): vol.Schema({ vol.Required(CONF_DATA): cv.hex_uint32_t, vol.Optional(CONF_NBITS, default=12): vol.All(vol.Coerce(int), cv.one_of(12, 15, 20)), @@ -84,6 +88,8 @@ def transmitter_base(full_config): return NECTransmitter.new(name, config[CONF_ADDRESS], config[CONF_COMMAND]) elif key == CONF_PANASONIC: return PanasonicTransmitter.new(name, config[CONF_ADDRESS], config[CONF_COMMAND]) + elif key == CONF_SAMSUNG: + return SamsungTransmitter.new(name, config[CONF_DATA]) elif key == CONF_SONY: return SonyTransmitter.new(name, config[CONF_DATA], config[CONF_NBITS]) elif key == CONF_RAW: diff --git a/esphomeyaml/const.py b/esphomeyaml/const.py index 987e27217f..20e80af34c 100644 --- a/esphomeyaml/const.py +++ b/esphomeyaml/const.py @@ -161,6 +161,7 @@ CONF_COMMAND = 'command' CONF_DATA = 'data' CONF_NBITS = 'nbits' CONF_LG = 'lg' +CONF_SAMSUNG = 'samsung' CONF_SONY = 'sony' CONF_PANASONIC = 'panasonic' CONF_REPEAT = 'repeat' diff --git a/tests/test1.yaml b/tests/test1.yaml index 626f660c19..997de4aa48 100644 --- a/tests/test1.yaml +++ b/tests/test1.yaml @@ -699,6 +699,11 @@ switch: data: 4294967295 nbits: 28 repeat: 25 + - platform: remote_transmitter + name: "Panasonic TV Off" + samsung: + data: 0xABCDEF + repeat: 25 - platform: remote_transmitter name: "Panasonic TV Off" sony: