Fix remote_receiver raw binary sensor (#639)

* Fix remote_receiver raw binary sensor

Fixes https://github.com/esphome/issues/issues/439

* Lint
This commit is contained in:
Otto Winter 2019-06-14 12:53:27 +02:00
parent 11d9c203c1
commit 10cc0b1d5b
No known key found for this signature in database
GPG Key ID: DB66C0BE6013F97E
2 changed files with 9 additions and 2 deletions

View File

@ -2,7 +2,7 @@ import esphome.codegen as cg
import esphome.config_validation as cv import esphome.config_validation as cv
from esphome import automation from esphome import automation
from esphome.components import binary_sensor from esphome.components import binary_sensor
from esphome.const import CONF_DATA, CONF_ID, CONF_TRIGGER_ID, CONF_NBITS, CONF_ADDRESS, \ from esphome.const import CONF_DATA, CONF_TRIGGER_ID, CONF_NBITS, CONF_ADDRESS, \
CONF_COMMAND, CONF_CODE, CONF_PULSE_LENGTH, CONF_SYNC, CONF_ZERO, CONF_ONE, CONF_INVERTED, \ CONF_COMMAND, CONF_CODE, CONF_PULSE_LENGTH, CONF_SYNC, CONF_ZERO, CONF_ONE, CONF_INVERTED, \
CONF_PROTOCOL, CONF_GROUP, CONF_DEVICE, CONF_STATE, CONF_CHANNEL, CONF_FAMILY, CONF_REPEAT, \ CONF_PROTOCOL, CONF_GROUP, CONF_DEVICE, CONF_STATE, CONF_CHANNEL, CONF_FAMILY, CONF_REPEAT, \
CONF_WAIT_TIME, CONF_TIMES, CONF_TYPE_ID, CONF_CARRIER_FREQUENCY CONF_WAIT_TIME, CONF_TIMES, CONF_TYPE_ID, CONF_CARRIER_FREQUENCY
@ -350,7 +350,7 @@ RAW_SCHEMA = cv.Schema({
@register_binary_sensor('raw', RawBinarySensor, RAW_SCHEMA) @register_binary_sensor('raw', RawBinarySensor, RAW_SCHEMA)
def raw_binary_sensor(var, config): def raw_binary_sensor(var, config):
code_ = config[CONF_CODE] code_ = config[CONF_CODE]
arr = cg.progmem_array(config[CONF_ID], code_) arr = cg.progmem_array(config[CONF_CODE_STORAGE_ID], code_)
cg.add(var.set_data(arr)) cg.add(var.set_data(arr))
cg.add(var.set_len(len(code_))) cg.add(var.set_len(len(code_)))

View File

@ -661,6 +661,13 @@ binary_sensor:
number: 1 number: 1
mode: INPUT mode: INPUT
inverted: True inverted: True
- platform: remote_receiver
name: "Raw Remote Receiver Test"
raw:
code: [5685, -4252, 1711, -2265, 1712, -2265, 1711, -2264, 1712, -2266,
3700, -2263, 1712, -4254, 1711, -4249, 1715, -2266, 1710, -2267,
1709, -2265, 3704, -4250, 1712, -4254, 3700, -2260, 1714, -2265,
1712, -2262, 1714, -2267, 1709]
pca9685: pca9685:
frequency: 500 frequency: 500