diff --git a/esphomeyaml/components/binary_sensor/remote_receiver.py b/esphomeyaml/components/binary_sensor/remote_receiver.py index ad2f5cac31..b262aef079 100644 --- a/esphomeyaml/components/binary_sensor/remote_receiver.py +++ b/esphomeyaml/components/binary_sensor/remote_receiver.py @@ -7,7 +7,7 @@ from esphomeyaml.components.remote_transmitter import RC_SWITCH_RAW_SCHEMA, \ RC_SWITCH_TYPE_D_SCHEMA, binary_code, build_rc_switch_protocol import esphomeyaml.config_validation as cv 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_DEVICE, CONF_FAMILY, CONF_GROUP, CONF_JVC, 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_SAMSUNG, CONF_SONY, \ CONF_STATE, CONF_ID @@ -16,7 +16,7 @@ from esphomeyaml.cpp_types import int32 DEPENDENCIES = ['remote_receiver'] -REMOTE_KEYS = [CONF_NEC, CONF_LG, CONF_SONY, CONF_PANASONIC, CONF_SAMSUNG, CONF_RAW, +REMOTE_KEYS = [CONF_JVC, 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] @@ -24,6 +24,7 @@ CONF_REMOTE_RECEIVER_ID = 'remote_receiver_id' CONF_RECEIVER_ID = 'receiver_id' RemoteReceiver = remote_ns.class_('RemoteReceiver', binary_sensor.BinarySensor) +JVCReceiver = remote_ns.class_('JVCReceiver', RemoteReceiver) LGReceiver = remote_ns.class_('LGReceiver', RemoteReceiver) NECReceiver = remote_ns.class_('NECReceiver', RemoteReceiver) PanasonicReceiver = remote_ns.class_('PanasonicReceiver', RemoteReceiver) @@ -50,6 +51,9 @@ def validate_raw(value): PLATFORM_SCHEMA = cv.nameable(binary_sensor.BINARY_SENSOR_PLATFORM_SCHEMA.extend({ cv.GenerateID(): cv.declare_variable_id(RemoteReceiver), + vol.Optional(CONF_JVC): vol.Schema({ + vol.Required(CONF_DATA): cv.hex_uint32_t, + }), vol.Optional(CONF_LG): vol.Schema({ vol.Required(CONF_DATA): cv.hex_uint32_t, vol.Optional(CONF_NBITS, default=28): cv.one_of(28, 32, int=True), @@ -84,6 +88,8 @@ PLATFORM_SCHEMA = cv.nameable(binary_sensor.BINARY_SENSOR_PLATFORM_SCHEMA.extend def receiver_base(full_config): name = full_config[CONF_NAME] key, config = next((k, v) for k, v in full_config.items() if k in REMOTE_KEYS) + if key == CONF_JVC: + return JVCReceiver.new(name, config[CONF_DATA]) if key == CONF_LG: return LGReceiver.new(name, config[CONF_DATA], config[CONF_NBITS]) if key == CONF_NEC: diff --git a/esphomeyaml/components/remote_receiver.py b/esphomeyaml/components/remote_receiver.py index d1d6147379..40dfd86c78 100644 --- a/esphomeyaml/components/remote_receiver.py +++ b/esphomeyaml/components/remote_receiver.py @@ -20,6 +20,7 @@ RemoteReceiverComponent = remote_ns.class_('RemoteReceiverComponent', RemoteReceiveDumper = remote_ns.class_('RemoteReceiveDumper') DUMPERS = { + 'jvc': remote_ns.class_('JVCDumper', RemoteReceiveDumper), 'lg': remote_ns.class_('LGDumper', RemoteReceiveDumper), 'nec': remote_ns.class_('NECDumper', RemoteReceiveDumper), 'panasonic': remote_ns.class_('PanasonicDumper', RemoteReceiveDumper), diff --git a/esphomeyaml/components/switch/remote_transmitter.py b/esphomeyaml/components/switch/remote_transmitter.py index 8c6e7e05ac..8ea8eb7a9d 100644 --- a/esphomeyaml/components/switch/remote_transmitter.py +++ b/esphomeyaml/components/switch/remote_transmitter.py @@ -7,17 +7,17 @@ from esphomeyaml.components.remote_transmitter import RC_SWITCH_RAW_SCHEMA, \ remote_ns import esphomeyaml.config_validation as cv from esphomeyaml.const import CONF_ADDRESS, CONF_CARRIER_FREQUENCY, CONF_CHANNEL, CONF_CODE, \ - 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_SAMSUNG, CONF_SONY, CONF_STATE, CONF_TIMES, \ + CONF_COMMAND, CONF_DATA, CONF_DEVICE, CONF_FAMILY, CONF_GROUP, CONF_INVERTED, CONF_JVC, \ + 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_SAMSUNG, CONF_SONY, CONF_STATE, CONF_TIMES, \ CONF_WAIT_TIME, CONF_ID from esphomeyaml.cpp_generator import Pvariable, add, get_variable, progmem_array from esphomeyaml.cpp_types import int32 DEPENDENCIES = ['remote_transmitter'] -REMOTE_KEYS = [CONF_NEC, CONF_LG, CONF_SAMSUNG, CONF_SONY, CONF_PANASONIC, CONF_RAW, +REMOTE_KEYS = [CONF_JVC, 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] @@ -25,6 +25,7 @@ CONF_REMOTE_TRANSMITTER_ID = 'remote_transmitter_id' CONF_TRANSMITTER_ID = 'transmitter_id' RemoteTransmitter = remote_ns.class_('RemoteTransmitter', switch.Switch) +JVCTransmitter = remote_ns.class_('JVCTransmitter', RemoteTransmitter) LGTransmitter = remote_ns.class_('LGTransmitter', RemoteTransmitter) NECTransmitter = remote_ns.class_('NECTransmitter', RemoteTransmitter) PanasonicTransmitter = remote_ns.class_('PanasonicTransmitter', RemoteTransmitter) @@ -52,6 +53,9 @@ def validate_raw(value): PLATFORM_SCHEMA = cv.nameable(switch.SWITCH_PLATFORM_SCHEMA.extend({ cv.GenerateID(): cv.declare_variable_id(RemoteTransmitter), + vol.Optional(CONF_JVC): vol.Schema({ + vol.Required(CONF_DATA): cv.hex_uint32_t, + }), vol.Optional(CONF_LG): vol.Schema({ vol.Required(CONF_DATA): cv.hex_uint32_t, vol.Optional(CONF_NBITS, default=28): cv.one_of(28, 32, int=True), @@ -92,6 +96,8 @@ def transmitter_base(full_config): name = full_config[CONF_NAME] key, config = next((k, v) for k, v in full_config.items() if k in REMOTE_KEYS) + if key == CONF_JVC: + return JVCTransmitter.new(name, config[CONF_DATA]) if key == CONF_LG: return LGTransmitter.new(name, config[CONF_DATA], config[CONF_NBITS]) if key == CONF_NEC: diff --git a/esphomeyaml/const.py b/esphomeyaml/const.py index 0db0031f75..7d073f7413 100644 --- a/esphomeyaml/const.py +++ b/esphomeyaml/const.py @@ -161,6 +161,7 @@ CONF_NEC = 'nec' CONF_COMMAND = 'command' CONF_DATA = 'data' CONF_NBITS = 'nbits' +CONF_JVC = 'jvc' CONF_LG = 'lg' CONF_SAMSUNG = 'samsung' CONF_SONY = 'sony' diff --git a/tests/test1.yaml b/tests/test1.yaml index 70d1437598..c7c2a479d0 100644 --- a/tests/test1.yaml +++ b/tests/test1.yaml @@ -820,6 +820,11 @@ switch: inverted: True command_topic: custom_command_topic restore_mode: ALWAYS_OFF + - platform: remote_transmitter + name: "JVC Off" + jvc: + data: 0x10EF + repeat: 25 - platform: remote_transmitter name: "Panasonic TV Off" nec: