Added tests for RFxtrx device, updated rfxtrx to ver 0.5, fixed bug in setting brightness for rfxtrx light

This commit is contained in:
Daniel 2016-03-02 20:36:41 +01:00
parent d641cd5eef
commit 2fd0b28c53
7 changed files with 586 additions and 17 deletions

View file

@ -10,8 +10,9 @@ import logging
from homeassistant.util import slugify
REQUIREMENTS = ['https://github.com/Danielhiversen/pyRFXtrx/archive/0.4.zip' +
'#pyRFXtrx==0.4']
REQUIREMENTS = ['https://github.com/Danielhiversen/pyRFXtrx/' +
'archive/master.zip' +
'#pyRFXtrx==0.5']
DOMAIN = "rfxtrx"
@ -22,6 +23,7 @@ ATTR_NAME = 'name'
ATTR_PACKETID = 'packetid'
ATTR_FIREEVENT = 'fire_event'
ATTR_DATA_TYPE = 'data_type'
ATTR_DUMMY = "dummy"
EVENT_BUTTON_PRESSED = 'button_pressed'
@ -37,7 +39,6 @@ def setup(hass, config):
# Declare the Handle event
def handle_receive(event):
""" Callback all subscribers for RFXtrx gateway. """
# Log RFXCOM event
if not event.device.id_string:
return
@ -58,16 +59,22 @@ def setup(hass, config):
global RFXOBJECT
if ATTR_DEVICE not in config[DOMAIN]:
_LOGGER.exception(
"can found device parameter in %s YAML configuration section",
_LOGGER.error(
"can not find device parameter in %s YAML configuration section",
DOMAIN
)
return False
device = config[DOMAIN][ATTR_DEVICE]
debug = config[DOMAIN].get(ATTR_DEBUG, False)
dummy_connection = config[DOMAIN].get(ATTR_DUMMY, False)
RFXOBJECT = rfxtrxmod.Core(device, handle_receive, debug=debug)
if dummy_connection:
RFXOBJECT =\
rfxtrxmod.Core(device, handle_receive, debug=debug,
transport_protocol=rfxtrxmod.DummyTransport2)
else:
RFXOBJECT = rfxtrxmod.Core(device, handle_receive, debug=debug)
return True