Allow 64 bit codes and add nexa remote support. (#662)

* add nexa remote support.

This is inspired by: https://github.com/sui77/rc-switch/pull/124
As described there: "The remotes sold in ClasOhlson in scandinavia have
a slightly longer sync sequence(added a skip pulse field in the
protocol) and a 64 bit code word. Part of the code gets lost but that
seems to be OK until support for 64 bit codes is added."

* add default value to ctor

* allow 64bit codes

* lint

* make vars 64 bits
This commit is contained in:
Abílio Costa
2019-10-12 13:42:27 +01:00
committed by Otto Winter
parent f4f1164b94
commit 4d31ad3bdc
3 changed files with 42 additions and 41 deletions
+5 -5
View File
@@ -420,7 +420,7 @@ def rc5_action(var, config, args):
RC_SWITCH_TIMING_SCHEMA = cv.All([cv.uint8_t], cv.Length(min=2, max=2))
RC_SWITCH_PROTOCOL_SCHEMA = cv.Any(
cv.int_range(min=1, max=7),
cv.int_range(min=1, max=8),
cv.Schema({
cv.Required(CONF_PULSE_LENGTH): cv.uint32_t,
cv.Optional(CONF_SYNC, default=[1, 31]): RC_SWITCH_TIMING_SCHEMA,
@@ -438,8 +438,8 @@ def validate_rc_switch_code(value):
if c not in ('0', '1'):
raise cv.Invalid(u"Invalid RCSwitch code character '{}'. Only '0' and '1' are allowed"
u"".format(c))
if len(value) > 32:
raise cv.Invalid("Maximum length for RCSwitch codes is 32, code '{}' has length {}"
if len(value) > 64:
raise cv.Invalid("Maximum length for RCSwitch codes is 64, code '{}' has length {}"
"".format(value, len(value)))
if not value:
raise cv.Invalid("RCSwitch code must not be empty")
@@ -454,8 +454,8 @@ def validate_rc_switch_raw_code(value):
raise cv.Invalid(
"Invalid RCSwitch raw code character '{}'.Only '0', '1' and 'x' are allowed"
.format(c))
if len(value) > 32:
raise cv.Invalid("Maximum length for RCSwitch raw codes is 32, code '{}' has length {}"
if len(value) > 64:
raise cv.Invalid("Maximum length for RCSwitch raw codes is 64, code '{}' has length {}"
"".format(value, len(value)))
if not value:
raise cv.Invalid("RCSwitch raw code must not be empty")