Code Monkey home page Code Monkey logo

pyrfxtrx's Introduction

pyRFXtrx Build Status Coverage Status

A Python library to communicate with the RFXtrx family of devices from http://www.rfxcom.com/. Works with http://www.home-assistant.io

Using

Instally via pip

::
$ pip install -U pyRFXtrx

After that, see the examples in the examples directory

Licensing

pyRFXtrx is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.

pyRFXtrx is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.

You should have received a copy of the GNU Lesser General Public License along with pyRFXtrx. See the file COPYING.txt in the distribution. If not, see <http://www.gnu.org/licenses/>.

pyrfxtrx's People

Contributors

alainh avatar arnoo avatar badele avatar bosundmark avatar dakesson avatar danielhiversen avatar db-cl avatar diplix avatar dzukero avatar elupus avatar erikmouw avatar herbdavisy2k avatar jacobtomlinson avatar jamstah avatar jfautley avatar k3xman avatar keigezellig avatar lunar-consultancy avatar mbrrg avatar naterobinsons avatar rhpijnacker avatar robbie1221 avatar samriley avatar sdague avatar timt1961 avatar tipi85 avatar turbokongen avatar tuxick avatar woudt avatar ypollart avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

pyrfxtrx's Issues

Convert doctest to unittest

It would have been great to only have unittest.
So I would appreciate all help moving the doctests into unittests.

Support for RAW

Changelog from RFXcom:

New Pro1 firmware BETA version 1026 and RFXmngr 19.0.0.9
Firmware version 433_1026

Receive decoding changed and multiple protocols can be enabled with less reduction in sensitivity
Livolo appliance changed to Livolo 1 to 10 with more commands supported (needs an application change)
Oregon SL109 added
RAW receive and transmit added

Additional RFY commands

Need some additional RFY commands to control tilt of Somfy RTS venetian blinds from HomeAssistant.

I think I know exactly what needs to be added but since I am new to both github and python, I would ask someone with more experience to add them.

The addition should be in the COMMANDS list in class Rfy:
0x0F: '05SecUp',
0x10: '05SecDown',
0x11: '2SecUp',
0x12: 's2SecDown'

This is based on the RFXtrx implementation used in Domoticz - https://github.com/domoticz/domoticz/blob/development/main/RFXtrx.h

It has (among others) the following RFY commands:

Already existing - pyRFXtrx code in brackets
#define rfy_sStop 0x0 (0x00: 'Stop')
#define rfy_sUp 0x1 (0x01: 'Up')
#define rfy_sDown 0x3 (0x03: 'Down')

To be added - suggested pyRFXtrx code in brackets
#define rfy_s05SecUp 0xF (0x0F: '05SecUp')
#define rfy_s05SecDown 0x10 (0x10: '05SecDown')
#define rfy_s2SecUp 0x11 (0x11: '2SecUp')
#define rfy_s2SecDown 0x12 (0x12: 's2SecDown')

I realize respective commands will need to be implemented in HomeAssistant as well but I assume having them here is the first step.

Thank you!

Support transmit commands for Security1 class devices

It is not possible to add switches in Homeassistant for KD101 smoke detectors. It can be, since they are taking Panic and Pairing KD101 commands which are possible from RFXmngr and Domoticz. Maybe I'm wrong but I believe that the functionality is missing in the pyRFXtrx library.
Is there any chance to include this functionality?
Cheers!

Nexa Door bell button

I have a Nexa Door bell LMLT-711 that appear in HASS but is not responding on button click.
I have fire_event as true.

@Danielhiversen I remember you got a door bell button working, is this the same brand/model?

If so, what FW does your rfxcom have and what protocols are enabled?

Ventus WS155 vind sensor gives wrong temperature.

When receiving packets from a Ventus WS155 vind sensor, the temperature is wrong see example:

RFXTRX: Recv: 0x10 0x56 0x07 0x05 0x2c 0x01 0x00 0x87 0x00 0x04 0x00 0x08 0x68 0x74 0x20 0x52 0x69
<class 'RFXtrx.SensorEvent'> device=[<class 'RFXtrx.RFXtrxDevice'> type='Alecto WS4500' id='2c:01'] values=[('Battery numeric', 9), ('Chill', 827.4), ('Rssi numeric', 6), ('Temperature', 2674.0), ('Wind average speed', 0.4), ('Wind direction', 135), ('Wind gust', 0.8)]
RFXTRX: Recv: 0x0b 0x55 0x07 0x06 0x08 0x01 0x00 0x00 0x00 0x06 0xdb 0x79
<class 'RFXtrx.SensorEvent'> device=[<class 'RFXtrx.RFXtrxDevice'> type='Alecto' id='08:01'] values=[('Battery numeric', 9), ('Rain rate', 0), ('Rain total', 175.5), ('Rssi numeric', 7)]
RFXTRX: Recv: 0x0b 0x55 0x07 0x07 0x08 0x01 0x00 0x00 0x00 0x06 0xdb 0x79
<class 'RFXtrx.SensorEvent'> device=[<class 'RFXtrx.RFXtrxDevice'> type='Alecto' id='08:01'] values=[('Battery numeric', 9), ('Rain rate', 0), ('Rain total', 175.5), ('Rssi numeric', 7)]
RFXTRX: Recv: 0x0a 0x52 0x0e 0x08 0x2c 0x01 0x00 0x88 0x60 0x03 0x69
<class 'RFXtrx.SensorEvent'> device=[<class 'RFXtrx.RFXtrxDevice'> type='Alecto' id='2c:01'] values=[('Battery numeric', 9), ('Humidity', 96), ('Humidity status', 'wet'), ('Humidity status numeric', 3), ('Rssi numeric', 6), ('Temperature', 13.6)]
RFXTRX: Recv: 0x0b 0x55 0x07 0x09 0x08 0x01 0x00 0x00 0x00 0x06 0xdb 0x79
<class 'RFXtrx.SensorEvent'> device=[<class 'RFXtrx.RFXtrxDevice'> type='Alecto' id='08:01'] values=[('Battery numeric', 9), ('Rain rate', 0), ('Rain total', 175.5), ('Rssi numeric', 7)]
RFXTRX: Recv: 0x10 0x56 0x07 0x0a 0x2c 0x01 0x00 0x87 0x00 0x04 0x00 0x14 0x68 0x74 0x20 0x52 0x69
<class 'RFXtrx.SensorEvent'> device=[<class 'RFXtrx.RFXtrxDevice'> type='Alecto WS4500' id='2c:01'] values=[('Battery numeric', 9), ('Chill', 827.4), ('Rssi numeric', 6), ('Temperature', 2674.0), ('Wind average speed', 0.4), ('Wind direction', 135), ('Wind gust', 2.0)]
RFXTRX: Recv: 0x0b 0x55 0x07 0x0b 0x08 0x01 0x00 0x00 0x00 0x06 0xdb 0x79
<class 'RFXtrx.SensorEvent'> device=[<class 'RFXtrx.RFXtrxDevice'> type='Alecto' id='08:01'] values=[('Battery numeric', 9), ('Rain rate', 0), ('Rain total', 175.5), ('Rssi numeric', 7)]
RFXTRX: Recv: 0x0b 0x55 0x07 0x0c 0x08 0x01 0x00 0x00 0x00 0x06 0xdb 0x79
<class 'RFXtrx.SensorEvent'> device=[<class 'RFXtrx.RFXtrxDevice'> type='Alecto' id='08:01'] values=[('Battery numeric', 9), ('Rain rate', 0), ('Rain total', 175.5), ('Rssi numeric', 7)]
RFXTRX: Recv: 0x0b 0x55 0x07 0x0d 0x08 0x01 0x00 0x00 0x00 0x06 0xdb 0x79
<class 'RFXtrx.SensorEvent'> device=[<class 'RFXtrx.RFXtrxDevice'> type='Alecto' id='08:01'] values=[('Battery numeric', 9), ('Rain rate', 0), ('Rain total', 175.5), ('Rssi numeric', 7)]

The correct temperature can be seen on the "'Alecto' id='2c:01'" humidity sensor, as this is the same device.
The wind sensor alternates between two different packets, one with temperature and humidity and one with wind speed, according to http://www.tfd.hu/tfdhu/files/wsprotocol/auriol_protocol_v20.pdf
Thus the packets from RTXcom-device must include some other data or some junk.
Could this be filtered out ?

lighting4 / PT2262 light switch problem

I am unable to control my lighting4 / PT2262 (popular, cheap Brennenstuhl switches from Germany), despite them being correctly detected in HASS. When pushing the on/off button, the following six (!) devices are added to HASS (v0.52):

IDs appearing after pressing the ON button multiple times:
09130000154551014070
0913000115555f013d70
09130002154554013b70

IDs appearing after pressing the OFF button multiple times:
09130016155151013e70
09130019155551013e70
09130021155154013970

I split the ID into the entityID and packetID as listed here:


configuration.yaml:

light:
platform: rfxtrx
automatic_add: True
signal_repetitions: 1
devices:
09130000:
name: LED_1
packetid: 154551014070
09130001:
name: LED_2
packetid: 15555f013d70
09130002:
name: LED_3
packetid: 154554013b70


However I always get an invalid config error:

ERROR (MainThread) [homeassistant.config] Invalid config for [light.rfxtrx]: Rfxtrx device 154551014070 is invalid: Invalid device id for OrderedDict([('09130000', OrderedDict([('name', 'LED_1')])), ('09130001', OrderedDict([('name', 'LED_2'), ('packetid', '15555f013d70')])), ('09130002', OrderedDict([('name', 'LED_3'), ('packetid', '154554013b70')]))]) for dictionary value @ data['devices']. Got OrderedDict([('09130000', OrderedDict([('name', 'LED_1')])), ('09130001', OrderedDict([('name', 'LED_2'), ('packetid', '15555f013d70')])), ('09130002', OrderedDict([('name', 'LED_3'), ('packetid', '154554013b70')]))]). (See ?, line ?). Please check the docs at https://home-assistant.io/components/light.rfxtrx/

See below for the information exported from RFXMgnr:

ON button Code Info:

Packettype = Lighting4
subtype = PT2262
Sequence nbr = 85
Code = 154551 decimal:1394001
S1- S24 = 0001 0101 0100 0101 0101 0001
Pulse = 318 usec
Signal level = 8 -56dBm

OFF button Code Info:

Packettype = Lighting4
subtype = PT2262
Sequence nbr = 87
Code = 154554 decimal:1394004
S1- S24 = 0001 0101 0100 0101 0101 0100
Pulse = 313 usec
Signal level = 8 -56dBm

Finally, when I use the script "receive.py" these are the recored commands for the ON and OFF button:

ON:
Recv: 0x09 0x13 0x00 0x08 0x15 0x45 0x51 0x01 0x3b 0x70
<class 'RFXtrx.ControlEvent'> device=[<class 'RFXtrx.LightingDevice'> type='PT2262' id='154551'] values=[('Command', 'Unknown command (0x154551)'), ('Rssi numeric', 7)]

OFF:
Recv: 0x09 0x13 0x00 0x1d 0x15 0x45 0x54 0x01 0x39 0x60
<class 'RFXtrx.ControlEvent'> device=[<class 'RFXtrx.LightingDevice'> type='PT2262' id='154554'] values=[('Command', 'Unknown command (0x154554)'), ('Rssi numeric', 6)]

I couldn’t find any additional documentation about the "packetid:" flag in configuration.yaml - any clues if I split the detected ID correctly?

FYI, I'm also having an issue with the generated IDs as indicated in this issue report here.

Manual installation or HACS?

Hello,

I am trying to get pyRFXtrx running on Hassio, to get my SEAV sunscreens automated, but I can't install via pip. Is there a possibility to get it installed by manual installation, or make it suitable to find via HACS?

Closing Network transport blocks on receive_blocking call and does not finish

Calling close() on the network transport does not finish. This causes rebooting Home Assistant to take forever and polutes the logging:


2022-12-26 08:30:08.572 INFO (MainThread) [homeassistant.components.websocket_api.http.connection] [281472869385936] Connection closed by client
2022-12-26 08:30:08.611 INFO (Recorder) [homeassistant.components.recorder.pool.RecorderPool] Pool recreating
2022-12-26 08:31:48.570 WARNING (MainThread) [homeassistant.core] Timed out waiting for shutdown stage 1 to complete, the shutdown will continue
2022-12-26 08:31:48.823 WARNING (Thread-3) [homeassistant.util.executor] Thread[SyncWorker_1] is still running at shutdown: File "/usr/local/lib/python3.9/threading.py", line 937, in _bootstrap
    self._bootstrap_inner()
  File "/usr/local/lib/python3.9/threading.py", line 980, in _bootstrap_inner
    self.run()
  File "/usr/local/lib/python3.9/threading.py", line 917, in run
    self._target(*self._args, **self._kwargs)
  File "/usr/local/lib/python3.9/concurrent/futures/thread.py", line 83, in _worker
    work_item.run()
  File "/usr/local/lib/python3.9/concurrent/futures/thread.py", line 58, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/workspaces/core.rhp/homeassistant/components/rfxtrx/__init__.py", line 272, in _shutdown_rfxtrx
    rfx_object.close_connection()
  File "/home/vscode/.local/lib/python3.9/site-packages/RFXtrx/__init__.py", line 1020, in close_connection
    self._thread.join()
  File "/usr/local/lib/python3.9/threading.py", line 1060, in join
    self._wait_for_tstate_lock()
  File "/usr/local/lib/python3.9/threading.py", line 1080, in _wait_for_tstate_lock
    if lock.acquire(block, timeout):
2022-12-26 08:31:49.812 WARNING (Thread-3) [homeassistant.util.executor] Thread[SyncWorker_1] is still running at shutdown: File "/usr/local/lib/python3.9/threading.py", line 937, in _bootstrap
    self._bootstrap_inner()
  File "/usr/local/lib/python3.9/threading.py", line 980, in _bootstrap_inner
    self.run()
  File "/usr/local/lib/python3.9/threading.py", line 917, in run
    self._target(*self._args, **self._kwargs)
  File "/usr/local/lib/python3.9/concurrent/futures/thread.py", line 83, in _worker
    work_item.run()
  File "/usr/local/lib/python3.9/concurrent/futures/thread.py", line 58, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/workspaces/core.rhp/homeassistant/components/rfxtrx/__init__.py", line 272, in _shutdown_rfxtrx
    rfx_object.close_connection()
  File "/home/vscode/.local/lib/python3.9/site-packages/RFXtrx/__init__.py", line 1020, in close_connection
    self._thread.join()
  File "/usr/local/lib/python3.9/threading.py", line 1060, in join
    self._wait_for_tstate_lock()
  File "/usr/local/lib/python3.9/threading.py", line 1080, in _wait_for_tstate_lock
    if lock.acquire(block, timeout):
2022-12-26 08:31:58.817 WARNING (MainThread) [homeassistant.util.executor] Thread[SyncWorker_1] is still running at shutdown: File "/usr/local/lib/python3.9/threading.py", line 937, in _bootstrap
    self._bootstrap_inner()
  File "/usr/local/lib/python3.9/threading.py", line 980, in _bootstrap_inner
    self.run()
  File "/usr/local/lib/python3.9/threading.py", line 917, in run
    self._target(*self._args, **self._kwargs)
  File "/usr/local/lib/python3.9/concurrent/futures/thread.py", line 83, in _worker
    work_item.run()
  File "/usr/local/lib/python3.9/concurrent/futures/thread.py", line 58, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/workspaces/core.rhp/homeassistant/components/rfxtrx/__init__.py", line 272, in _shutdown_rfxtrx
    rfx_object.close_connection()
  File "/home/vscode/.local/lib/python3.9/site-packages/RFXtrx/__init__.py", line 1020, in close_connection
    self._thread.join()
  File "/usr/local/lib/python3.9/threading.py", line 1060, in join
    self._wait_for_tstate_lock()
  File "/usr/local/lib/python3.9/threading.py", line 1080, in _wait_for_tstate_lock
    if lock.acquire(block, timeout):
2022-12-26 08:31:59.807 WARNING (MainThread) [homeassistant.util.executor] Thread[SyncWorker_1] is still running at shutdown: File "/usr/local/lib/python3.9/threading.py", line 937, in _bootstrap
    self._bootstrap_inner()
  File "/usr/local/lib/python3.9/threading.py", line 980, in _bootstrap_inner
    self.run()
  File "/usr/local/lib/python3.9/threading.py", line 917, in run
    self._target(*self._args, **self._kwargs)
  File "/usr/local/lib/python3.9/concurrent/futures/thread.py", line 83, in _worker
    work_item.run()
  File "/usr/local/lib/python3.9/concurrent/futures/thread.py", line 58, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/workspaces/core.rhp/homeassistant/components/rfxtrx/__init__.py", line 272, in _shutdown_rfxtrx
    rfx_object.close_connection()
  File "/home/vscode/.local/lib/python3.9/site-packages/RFXtrx/__init__.py", line 1020, in close_connection
    self._thread.join()
  File "/usr/local/lib/python3.9/threading.py", line 1060, in join
    self._wait_for_tstate_lock()
  File "/usr/local/lib/python3.9/threading.py", line 1080, in _wait_for_tstate_lock
    if lock.acquire(block, timeout):
Found 2 non-daemonic threads.

New release

Think it might be time for a new pypi release.

Class Wind average_speed, gust factor 10

looks like the average speed and gust calculation is off by factor 10.
Current:
1818: self.average_speed = data[8] * 256.0 + data[9] / 10.0
1819: self.gust = data[10] * 256.0 + data[11] / 10.0
should be using brackets
1818: self.average_speed = (data[8] * 256.0 + data[9]) / 10.0
1819: self.gust = (data[10] * 256.0 + data[11]) / 10.0

Support for other blinds types

Hi,

Back in April I posted on home assistant forum about an issues that's blocking me from giving Hass a shot. Here's the post: https://community.home-assistant.io/t/help-with-rfxtrx-cover/10768/18

Unfortunately no one answered, so I'm giving it another shot here.

Basically I have blinds of a type that isn't supported by pyRFXtrx but works fine on domoticz. I could really use some pointers to add it here :)

Here's the data I got from the RFXtrx software:

Packettype = BLINDS1
subtype = ASP
Sequence nbr = 1
id1-3 = 0020AA decimal:8362
Command = Open
Signal level = 8 -56dBm

Thanks!

Error local variable 'data' referenced before assignment

I try to use rfxtrx on Home assistant and .i have this error.

Send: 0x0d 0x00 0x00 0x01 0x02 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00
Exception in thread Thread-22:
Traceback (most recent call last):
  File "/usr/lib/python3.5/threading.py", line 914, in _bootstrap_inner
    self.run()
  File "/usr/lib/python3.5/threading.py", line 862, in run
    self._target(*self._args, **self._kwargs)
  File "/home/thomas/homeassistant/lib/python3.5/site-packages/RFXtrx/__init__.py", line 705, in _connect
    self.transport.reset()
  File "/home/thomas/homeassistant/lib/python3.5/site-packages/RFXtrx/__init__.py", line 640, in reset
    return self.receive_blocking()
  File "/home/thomas/homeassistant/lib/python3.5/site-packages/RFXtrx/__init__.py", line 613, in receive_blocking
    if not data or data == '\x00':
UnboundLocalError: local variable 'data' referenced before assignment

my python version is 3.5.3.

this error append on if not data or data == '\x00': on line 621 on file __init__.py.

the if not not work if there are an exception on try. To fix it localy I have add
data = False before the Try

device not recognised TFA

hello guys

I have added a device (TFA Rainsensor) to my home assistant and it shows up as an unknown device.
but it's detected as the correct rain type.
(within rfxmngr it reports data and gets updates)
does this mean that the device is correctly working for RFXtrx ? As in Home assistant I can see a new device but of course it's unknown. It gets 1 time detected and doesn't update data. After a reboot it goes to an unavailable state.

Just figuring it out where to go to get this thing working properly.

Thanks

This is my debug info in home assistant

2020-09-26 06:43:58 DEBUG (MainThread) [homeassistant.components.rfxtrx] Receive RFXCOM event: {'packet_type': 85, 'sub_type': 9, 'type_string': 'Unknown type (0x55/0x09)', 'id_string': '3c:eb', 'data': '0b5509003ceb000000006d79', 'values': {'Rain rate': 0, 'Rain total': 10.9, 'Battery numeric': 9, 'Rssi numeric': 7}}

Support for Revolt NC-5461 energy meter

http://www.pearl.de/a-NC5462-5452.shtml

this is what rfxtrx reports:
bildschirmfoto 2017-02-08 um 22 53 45

i guess these are the parameters pyRFXtrx needs to recognise:

  • Instant Power
  • total usage

would of course be nice to also get:

  • Voltage
  • Current
  • Frequency

right now rfxtrx reports the values every 4 seconds, but pyRFXtrx (and home assistant) don’t recognise it.

if i knew how to get the raw output from rfxtrx, i’m glad to provide it.

Auto detect path

I want to see if we can auto detect the rfxcom device, and need some help to test the code

On a Linux computer, is this code detecting the path to your device?
import glob
glob.glob( '/dev/serial/by-id/usb-RFXCOM_*-port0')

Any idea how we can do this on Windows or Mac?

Closing Network transport takes long time

After a recent Home Assistant update, I noticed that it takes a very long time to perform a reboot (minutes!).
Looking at the log file I noticed that the RFXtrx module is causing this:

2024-03-13 07:34:51.635 WARNING (MainThread) [homeassistant.util.executor] Thread[SyncWorker_29] is still running at shutdown: File "/usr/local/lib/python3.12/threading.py", line 1030, in _bootstrap
    self._bootstrap_inner()
  File "/usr/local/lib/python3.12/threading.py", line 1073, in _bootstrap_inner
    self.run()
  File "/usr/local/lib/python3.12/threading.py", line 1010, in run
    self._target(*self._args, **self._kwargs)
  File "/usr/local/lib/python3.12/concurrent/futures/thread.py", line 92, in _worker
    work_item.run()
  File "/usr/local/lib/python3.12/concurrent/futures/thread.py", line 58, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/usr/src/homeassistant/homeassistant/components/rfxtrx/__init__.py", line 283, in _shutdown_rfxtrx
    rfx_object.close_connection()
  File "/usr/local/lib/python3.12/site-packages/RFXtrx/__init__.py", line 1090, in close_connection
    self._thread.join()
  File "/usr/local/lib/python3.12/threading.py", line 1147, in join
    self._wait_for_tstate_lock()
  File "/usr/local/lib/python3.12/threading.py", line 1167, in _wait_for_tstate_lock
    if lock.acquire(block, timeout):
2024-03-13 07:34:52.634 WARNING (MainThread) [homeassistant.util.executor] Thread[SyncWorker_29] is still running at shutdown: File "/usr/local/lib/python3.12/threading.py", line 1030, in _bootstrap
    self._bootstrap_inner()
  File "/usr/local/lib/python3.12/threading.py", line 1073, in _bootstrap_inner
    self.run()
  File "/usr/local/lib/python3.12/threading.py", line 1010, in run
    self._target(*self._args, **self._kwargs)
  File "/usr/local/lib/python3.12/concurrent/futures/thread.py", line 92, in _worker
    work_item.run()
  File "/usr/local/lib/python3.12/concurrent/futures/thread.py", line 58, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/usr/src/homeassistant/homeassistant/components/rfxtrx/__init__.py", line 283, in _shutdown_rfxtrx
    rfx_object.close_connection()
  File "/usr/local/lib/python3.12/site-packages/RFXtrx/__init__.py", line 1090, in close_connection
    self._thread.join()
  File "/usr/local/lib/python3.12/threading.py", line 1147, in join
    self._wait_for_tstate_lock()
  File "/usr/local/lib/python3.12/threading.py", line 1167, in _wait_for_tstate_lock
    if lock.acquire(block, timeout):

This looks a lot like issue #146 that I previously posted (and fixed).
The rework done in #150 seems to have re-introduced this issue for me.

Error with Oregon Thermo/Hygro sensor (Exception: must be type, not classobj)

Hello.

I am receiving the error below every time a sensor read is performed. The sensor is an Oregon THGR122N. Any ideea how to fix this? The bytes received from sensor are listed below.

Sep 16 22:14:20 pi-face start.sh[15068]: RFXTRX: Recv: 0x0a 0x52 0x01 0x01 0xcc 0x01 0x00 0xfb 0x1e 0x02 0x59
Sep 16 22:13:20 pi-face start.sh[15068]: Traceback (most recent call last):
Sep 16 22:13:20 pi-face start.sh[15068]: File "/home/haiot/PYC/sensor/rfxcom_run.py", line 87, in thread_run
Sep 16 22:13:20 pi-face start.sh[15068]: __rfx_reading(P.transport.receive_blocking())
Sep 16 22:13:20 pi-face start.sh[15068]: File "/home/haiot/PYC/sensor/RFXtrx/init.py", line 661, in receive_blocking
Sep 16 22:13:20 pi-face start.sh[15068]: return self.parse(pkt)
Sep 16 22:13:20 pi-face start.sh[15068]: File "/home/haiot/PYC/sensor/RFXtrx/init.py", line 591, in parse
Sep 16 22:13:20 pi-face start.sh[15068]: pkt = lowlevel.parse(data)
Sep 16 22:13:20 pi-face start.sh[15068]: File "/home/haiot/PYC/sensor/RFXtrx/lowlevel.py", line 70, in parse
Sep 16 22:13:20 pi-face start.sh[15068]: pkt = TempHumid()
Sep 16 22:13:20 pi-face start.sh[15068]: File "/home/haiot/PYC/sensor/RFXtrx/lowlevel.py", line 1359, in init
Sep 16 22:13:20 pi-face start.sh[15068]: super(TempHumid, self).init()
Sep 16 22:13:20 pi-face start.sh[15068]: TypeError: must be type, not classobj

Frxtrx light integration in home assistant not working like switch and cover integration

Hi Daniel,
i am using a Rfxcom transciever with 4 Somfy shutters, 3 Kaku (Coco) plug switches and 1 Kaku plug dimmer. i have the shutters and switches functioning, but not the dimmer.
I am new with home assistant. i have a fully working setup with Domoticz but trying to convert everything to home assistant. the dimmer (lighting2 device) is controlled via the same remote as the switches. within domoticz i can control the dim level.
i understood to control teh dim level in home assistant i need to use the RFXtrx light integration. however when i follow the documentation, i get no response.
the automatic_add functionality is not responding to the remote. i tried using the switch integration for obtaining the switch name and using that name in the light integration, but i get configuration errors, saying i need to change the indentation in my configuration.yaml to have the switch name with the same indentation as the line "devices".

what am i doing wrong?

with kind regards,
Ivo

Adding network to rfxtrx [see PR]

I never use Python but would like to give this a try..
Is adding network support to pyRFXtrx feasible, if i implement a Network alternative for the PySerialTransport class? Looks like the code already accounts for swapping this, or am i misinterpreting what a transporter does here.

Source:

pyRFXtrx/RFXtrx/__init__.py

Lines 613 to 685 in df50186

###############################################################################
# PySerialTransport class
###############################################################################
class PySerialTransport(RFXtrxTransport):
""" Implementation of a transport using PySerial """
def __init__(self, port, debug=False):
self.debug = debug
self.port = port
self.serial = None
self._run_event = threading.Event()
self._run_event.set()
self.connect()
def connect(self):
""" Open a serial connexion """
try:
self.serial = serial.Serial(self.port, 38400, timeout=0.1)
except serial.serialutil.SerialException:
import glob
port = glob.glob('/dev/serial/by-id/usb-RFXCOM_*-port0')[0]
self.serial = serial.Serial(port, 38400, timeout=0.1)
def receive_blocking(self):
""" Wait until a packet is received and return with an RFXtrxEvent """
data = None
while self._run_event.is_set():
try:
data = self.serial.read()
except TypeError:
continue
except serial.serialutil.SerialException:
import time
try:
self.connect()
except serial.serialutil.SerialException:
time.sleep(5)
continue
if not data or data == '\x00':
continue
pkt = bytearray(data)
data = self.serial.read(pkt[0])
pkt.extend(bytearray(data))
if self.debug:
print("RFXTRX: Recv: " +
" ".join("0x{0:02x}".format(x) for x in pkt))
return self.parse(pkt)
def send(self, data):
""" Send the given packet """
if isinstance(data, bytearray):
pkt = data
elif isinstance(data, (bytes, str)):
pkt = bytearray(data)
else:
raise ValueError("Invalid type")
if self.debug:
print("RFXTRX: Send: " +
" ".join("0x{0:02x}".format(x) for x in pkt))
self.serial.write(pkt)
def reset(self):
""" Reset the RFXtrx """
self.send(b'\x0D\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00')
sleep(0.3) # Should work with 0.05, but not for me
self.serial.flushInput()
def close(self):
""" close connection to rfxtrx device """
self._run_event.clear()
self.serial.close()

My original topic on HA forum, where i recursed source to this repository:
https://community.home-assistant.io/t/adding-network-to-rfxtrx-component/125615/2

Modes reset on connect?

I'm trying to get a Revolt compatible power meter (as described in #47) to work with pyRFXtrx (and Homeassistant) but even though I get values in the Windows tool, no events are received in Homeassistant.

To debug what's going on I checked out the current master of this library and used the example/receive.py script.

This is what I get:

Send: 0x0d 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00
{}
Send: 0x0d 0x00 0x00 0x01 0x02 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00
Recv: 0x14 0x01 0x00 0x01 0x02 0x53 0x14 0x10 0x00 0x27 0x00 0x01 0x03 0x1c 0x04 0x80 0x00 0x00 0x00 0x00 0x00
{}
{}
{}
{}

To figure out what is going on I added some more print statements. The Recv line gets parsed into a StatusEvent:

<class 'RFXtrx.StatusEvent'> device=[Status [subtype=433.92MHz, firmware=20, devices=['ac', 'arc', 'oregon', 'undecoded', 'x10']]]

If I understand this output correctly, the rfxCom returns that only the modes 'ac', 'arc', 'oregon', 'undecoded', 'x10' are enabled. What is obviously missing is the RSL2 mode.

When I plugin the device back into my windows machine, the RSL2 mode is enabled again.

It seems to me that the initial Send string to reset the device is also resetting the configured modes.

Is that correct? If yes, can that be avoided? Or, even better, would there be a way to set the wanted modes via pyRFXtrx?

lighting4 switch never actually sending commands

tldr; clicking a switch with id 09130001155155019c70 in home assistant doesn't result in commands being sent.

I have a few Chacon RF outlets that seem to use the lighting4 protocol. If I enabled that protocol and set automatic add to true in Home Assistant, the switches show up in the panel, but they don't work.

I verified the received commands using RFXmngr:
The id of the switch in HA was 0913 0001 15 51 55 01 9c70
in RFXmngr, I got this matching output:

Packettype = Lighting4
subtype = PT2262
Code = 155155
Pulse: 412 usec
signal level = 8

If I enter the code in the lighting4 tab and toggle the last bit (155154/155155), I can toggle my light on and off.

I then enabled debugging in HA and noticed that no send events occur when I click the switch in HA.
To eliminate a general issue with my setup, I added a switch with an id I found in some example online (0b1100ce3213c7f210010f70). If I click that switch, a send command shows up in the logs.

I'd be happy to help debugging this.

Some HA log output:

Recv: 0x09 0x13 0x00 0x01 0x15 0x51 0x55 0x01 0x9c 0x70
INFO:homeassistant.components.rfxtrx:Automatic add 155155 rfxtrx device (Class: LightingDevice Sub: 0 Packet_id: 09130001155155019c70)
INFO:homeassistant.core:Bus:Handling <Event state_changed[L]: entity_id=switch.09130001155155019c70, old_state=None, new_state=<state switch.09130001155155019c70=off; friendly_name=09130001155155019c70, assumed_state=True @ 2017-08-01T16:55:31.032072+02:00>>

Note: sometimes an 09130002155557019c70 event shows up in the logs, both after on and off commands.

Support for SEAV TX4 Fan remote

RFXcom supports the SEAV TX4 Fan remote. Make it possible to send remote packets to this device from Home Assistant switch.

Example of command send in RFXmgr

Fan command

Packettype = Fan
subtype = SEAV TXS4
Sequence nbr = 35
Switches = J1=open, SW1=Off, SW2=Off
ID = 10A SW1 1=Off, 2=Off, 3=Off, 4=Off, 5=Off, 6=Off, 7=On, 8=Off, 9=Off, 10=Off
Command = T1
Signal level = 0 -120dBm


Packettype = Receiver/Transmitter Message
subtype = Transmitter Response
Sequence nbr = 35
response = ACK, data correct transmitted

Also see this request in Home Assistant forum.

DC106 Open and Close reversed; request Invert option

Hey,

I have a BREL motor sun cover and my rfxcom is connected through USB to an Home Assistant host and I can control the cover.

However, the commands are inverted; Open is close and vice versa. I am guessing this has to do with the motor being on the left hand side (if looking at the screen from the front) instead of the more common right hand side).

I would like a feature which inverts the open/close mapping. I've seen bug requests about other systems (https://community.home-assistant.io/t/rfxtrx-covers-now-reversed-in-0-78/69261 and )

My system works via Blinds1 ' T6 DC106' , Home Assistant USB connected as Cover

RollerTrol test fails

=================================== FAILURES ===================================
_____________________ RollerTrolTestCase.test_parse_bytes ______________________

self = <test_rollertrol.RollerTrolTestCase testMethod=test_parse_bytes>

    def test_parse_bytes(self):

        rollertrol = RFXtrx.lowlevel.parse(bytearray(b'\x09\x19\x00\x00\x00\x9b\xa8\x01\x01\x00'))
        self.assertEqual(rollertrol.__repr__(), "RollerTrol [subtype=0, seqnbr=0, id=009ba8:1, cmnd=Down, rssi=0]")
        self.assertEqual(rollertrol.packetlength, 9)
        self.assertEqual(rollertrol.subtype, 0)
        self.assertEqual(rollertrol.type_string, "RollerTrol")
        self.assertEqual(rollertrol.seqnbr, 0)
        self.assertEqual(rollertrol.id_string, "009ba8:1")
        self.assertEqual(rollertrol.cmnd, 1)
        self.assertEqual(rollertrol.cmnd_string, "Down")
        self.assertEqual(rollertrol.rssi_byte, 0)
        self.assertEqual(rollertrol.rssi, 0)

        rollertrol = RFXtrx.lowlevel.RollerTrol()
        rollertrol.set_transmit(0, 0, 0x009ba8, 1, 1)
        self.assertEqual(rollertrol.__repr__(), "RollerTrol [subtype=0, seqnbr=0, id=009ba8:1, cmnd=Down, rssi=0]")
        self.assertEqual(rollertrol.packetlength, 9)
        self.assertEqual(rollertrol.subtype, 0)
        self.assertEqual(rollertrol.type_string, "RollerTrol")
        self.assertEqual(rollertrol.seqnbr, 0)
        self.assertEqual(rollertrol.id_string, "009ba8:1")
        self.assertEqual(rollertrol.cmnd, 1)
        self.assertEqual(rollertrol.cmnd_string, "Down")
        self.assertEqual(rollertrol.rssi_byte, 0)
        self.assertEqual(rollertrol.rssi, 0)

        rollertrol = RFXtrx.lowlevel.RollerTrol()
        rollertrol.parse_id(0, "009ba8:2")
        self.assertEqual(rollertrol.unitcode, 2)
        self.assertRaises(ValueError, rollertrol.parse_id, 0, "AA")

        rollertrol = RFXtrx.get_device(0x19, 0, "009ba8:1")
        self.assertEqual(rollertrol.__str__(), "<class 'RFXtrx.RollerTrolDevice'> type='RollerTrol' id='009ba8:1'")
        self.assertEqual(rollertrol.unitcode, 1)

        rollertrol = RFXtrx.lowlevel.parse(bytearray(b'\x09\x19\x02\x00\x00\x9b\xa8\x01\x05\x00'))
        self.assertEqual(rollertrol.cmnd_string, "Unknown command (0x05)")
>       self.assertEqual(rollertrol.type_string, "Unknown type (0x19/0x02)")
E       AssertionError: 'BlindsT2 / A-OK RF01' != 'Unknown type (0x19/0x02)'
E       - BlindsT2 / A-OK RF01
E       + Unknown type (0x19/0x02)

tests/test_rollertrol.py:45: AssertionError

Adding support for Bangood PIR sensor

Home Assistant release (hass --version): 0.39.3
Python release (python3 --version): Python 3.4.2
Component/platform: Orange Pi One, Debian GNU/Linux 8.7 (jessie)

I got a couple of:

http://www.banggood.com/433MHZ-Wireless-PIR-Motion-Detector-for-Home-Alarm-Home-Security-p-941723.html

Homeassistant gives me:

Mar 25 17:43:14 red hass[547]: 17-03-25 17:43:14 DEBUG (Thread-13) [homeassistant.components.rfxtrx] Receive RFXCOM event from (Device_id: 92c3d9 Class: LightingDevice Sub: 0, Pkt_id: 0913008c92c3d9018c70)
Mar 25 17:43:14 red hass[547]: 17-03-25 17:43:14 DEBUG (Thread-13) [homeassistant.components.rfxtrx] Device_id: 92c3d9 device_update. Command: Unknown command (0x92c3d9)

It looks like it only transmits when movement is detected.

Within rfxmgr it is known as a Lightning4 device, I do not know myself how to add support for it but,
I'm happy to help with packet captures etc.

New lib release?

Hi @Danielhiversen ; is it possible to tag and release a new version of the lib?
I'll start implementing a "setting the receiving modes" feature in home-assistant soon, and a new version of the pyrfxtrx lib will be needed for that.

Thanks !

Support for Gas fireplace (Mertik Maxitrol) with rfxtrx

RFXcom support the Mertik Maxitrol remotes that can control gas fireplaces.

Example of commands in RFXmgr

Packettype = Thermostat3
subtype = Mertik G6R-H4TB, G6R-H4T5, G6R-H4T, G6R-H4TV21-Z22
Sequence nbr = 10
ID = 0x2B6A3 decimal:177827
Command = On
Signal level = 7 -64dBm


Packettype = Thermostat3
subtype = Mertik G6R-H4TB, G6R-H4T5, G6R-H4T, G6R-H4TV21-Z22
Sequence nbr = 11
ID = 0x2B6A3 decimal:177827
Command = Up
Signal level = 7 -64dBm


Packettype = Thermostat3
subtype = Mertik G6R-H4TB, G6R-H4T5, G6R-H4T, G6R-H4TV21-Z22
Sequence nbr = 12
ID = 0x2B6A3 decimal:177827
Command = Down
Signal level = 7 -64dBm


Packettype = Thermostat3
subtype = Mertik G6R-H4TB, G6R-H4T5, G6R-H4T, G6R-H4TV21-Z22
Sequence nbr = 14
ID = 0x2B6A3 decimal:177827
Command = Off
Signal level = 7 -64dBm

And here an OFF command for a Mertik G6R-H4TB:

Thermostat3 command: 08 42 01 03 02 B6 A3 00 00
Packettype = Thermostat3
subtype = Mertik G6R-H4TB, G6R-H4T5, G6R-H4T, G6R-H4TV21-Z22
Sequence nbr = 3
ID = 0x2B6A3 decimal:177827
Command = Off

Also see this message with comments in Home Assistant forum.

AttributeError: 'NoneType in python3.10/site-packages/RFXtrx/__init__.py

I am running a Raspberry Pi with the official Pi OS, and Home Assistant within Docker. A few days ago the RFXtrx integration stopped working. I asked and searched forums and various search results. I now issues on github is not for regular support, but I have seen a few people with similar issue as me and no one seems to have any answer and I am beginning to think it might be a bug, I ran across something about "AttributeError: 'NoneType' object has no attribute 'write'" that made me suspect this.

I apologize in advance if it is not.

In Home Assistant I get this error in the log

Logger: root
Source: .local/lib/python3.10/site-packages/RFXtrx/__init__.py:828
First occurred: 21:50:24 (1 occurrences)
Last logged: 21:50:24
Uncaught thread exception

Traceback (most recent call last):
  File "/usr/lib/python3.10/threading.py", line 1016, in _bootstrap_inner
    self.run()
  File "/usr/lib/python3.10/threading.py", line 953, in run
    self._target(*self._args, **self._kwargs)
  File "/config/.local/lib/python3.10/site-packages/RFXtrx/__init__.py", line 985, in _connect
    self.transport.reset()
  File "/config/.local/lib/python3.10/site-packages/RFXtrx/__init__.py", line 832, in reset
    self.send(b'\x0D\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00')
  File "/config/.local/lib/python3.10/site-packages/RFXtrx/__init__.py", line 828, in send
    self.serial.write(pkt)
AttributeError: 'NoneType' object has no attribute 'write'

Line 828 is the last line in this segment

 def send(self, data):
        """ Send the given packet """
        if isinstance(data, bytearray):
            pkt = data
        elif isinstance(data, (bytes, str)):
            pkt = bytearray(data)
        else:
            raise ValueError("Invalid type")
        _LOGGER.debug(
            "Send: %s",
            " ".join("0x{0:02x}".format(x) for x in pkt)
        )
        self.serial.write(pkt)

device id_string changes

I have a 433 Mhz thermometer TS34C.
Every few months it seems to change the device id_string.
Here is the history of devices packets defined in home assistant:

0a520704ab0e006a3b0169
0a520711b30e00d1370159
0a520730aa0e00e7280159

The device id_string changes from ab0e to b30e and aa0e.
I think the id is extracted wrong.

RFXTRX: Recv: 0x0a 0x52 0x07 0x01 0xaa 0x0e 0x00 0x4d 0x49 0x03 0x59
<class 'RFXtrx.SensorEvent'> device=[<class 'RFXtrx.RFXtrxDevice'> type='TFA TS34C, Cresta' id='aa:0e'] values=[('Battery numeric', 9), ('Humidity', 73), ('Humidity status', 'wet'), ('Humidity status numeric', 3), ('Rssi numeric', 5), ('Temperature', 7.7)]

0.27.0 wasn't pushed to pypi

ERROR: Could not find a version that satisfies the requirement pyRFXtrx==0.27.0 (from -r requirements_all.txt (line 1247)) (from versions: 0.4, 0.5, 0.6, 0.6.5, 0.7.0, 0.8.0, 0.9.0, 0.10.0, 0.10.1, 0.11.0, 0.12.0, 0.13.0, 0.14.0, 0.15.0, 0.16.0, 0.16.1, 0.17.0, 0.18.0, 0.19.0, 0.20.0, 0.20.1, 0.21.1, 0.22.0, 0.22.1, 0.23.0, 0.24.0, 0.25.0, 0.26.0, 0.26.1)

Reconnexion in read loop after USB problem

Hi !

I'm having some troubles with my RFXcom. Sometimes I got some kernel messages indicating that my USB has failed and the port is deconnected/reconnected in a second.

I'm using home assistant which is using this library, and I think there is a problem in the lib. When the usb fail, there is no reconnexion mechanism at all, so even if it becomes available again after that, then the daemon is in a bad state until I restart it.

This is the original problem :

May 10 22:52:53 nifloutch kernel: [207533.260121] usb usb4-port1: disabled by hub (EMI?), re-enabling...
May 10 22:52:53 nifloutch kernel: [207533.260143] usb 4-1: USB disconnect, device number 4
May 10 22:52:53 nifloutch kernel: [207533.261012] ftdi_sio ttyUSB0: error from flowcontrol urb
May 10 22:52:53 nifloutch kernel: [207533.261209] ftdi_sio ttyUSB0: FTDI USB Serial Device converter now disconnected from ttyUSB0
May 10 22:52:53 nifloutch kernel: [207533.261241] ftdi_sio 4-1:1.0: device disconnected
May 10 22:52:53 nifloutch kernel: [207533.500039] usb 4-1: new full-speed USB device number 5 using uhci_hcd
May 10 22:52:53 nifloutch kernel: [207533.698988] usb 4-1: New USB device found, idVendor=0403, idProduct=6001
May 10 22:52:53 nifloutch kernel: [207533.698996] usb 4-1: New USB device strings: Mfr=1, Product=2, SerialNumber=3
May 10 22:52:53 nifloutch kernel: [207533.699000] usb 4-1: Product: RFXtrx433
May 10 22:52:53 nifloutch kernel: [207533.699004] usb 4-1: Manufacturer: RFXCOM
May 10 22:52:53 nifloutch kernel: [207533.699008] usb 4-1: SerialNumber: A135G81
May 10 22:52:53 nifloutch kernel: [207533.706050] ftdi_sio 4-1:1.0: FTDI USB Serial Device converter detected
May 10 22:52:53 nifloutch kernel: [207533.706126] usb 4-1: Detected FT232RL
May 10 22:52:53 nifloutch kernel: [207533.706131] usb 4-1: Number of endpoints 2
May 10 22:52:53 nifloutch kernel: [207533.706136] usb 4-1: Endpoint 1 MaxPacketSize 64
May 10 22:52:53 nifloutch kernel: [207533.706140] usb 4-1: Endpoint 2 MaxPacketSize 64
May 10 22:52:53 nifloutch kernel: [207533.706144] usb 4-1: Setting MaxPacketSize 64
May 10 22:52:53 nifloutch kernel: [207533.708288] usb 4-1: FTDI USB Serial Device converter now attached to ttyUSB1
May 10 22:53:30 nifloutch hass[7916]: Exception in thread Thread-12:
May 10 22:53:30 nifloutch hass[7916]: Traceback (most recent call last):
May 10 22:53:30 nifloutch hass[7916]: File "/root/.homeassistant/deps/serial/serialposix.py", line 501, in read
May 10 22:53:30 nifloutch hass[7916]: 'device reports readiness to read but returned no data '
May 10 22:53:30 nifloutch hass[7916]: serial.serialutil.SerialException: device reports readiness to read but returned no data (device disconnected or multiple access on port?)
May 10 22:53:30 nifloutch hass[7916]: During handling of the above exception, another exception occurred:
May 10 22:53:30 nifloutch hass[7916]: Traceback (most recent call last):
May 10 22:53:30 nifloutch hass[7916]: File "/usr/lib/python3.4/threading.py", line 920, in _bootstrap_inner
May 10 22:53:30 nifloutch hass[7916]: self.run()
May 10 22:53:30 nifloutch hass[7916]: File "/usr/lib/python3.4/threading.py", line 868, in run
May 10 22:53:30 nifloutch hass[7916]: self._target(*self._args, **self._kwargs)
May 10 22:53:30 nifloutch hass[7916]: File "/root/.homeassistant/deps/RFXtrx/__init__.py", line 683, in _connect
May 10 22:53:30 nifloutch hass[7916]: event = self.transport.receive_blocking()
May 10 22:53:30 nifloutch hass[7916]: File "/root/.homeassistant/deps/RFXtrx/__init__.py", line 586, in receive_blocking
May 10 22:53:30 nifloutch hass[7916]: data = self.serial.read()
May 10 22:53:30 nifloutch hass[7916]: File "/root/.homeassistant/deps/serial/serialposix.py", line 508, in read
May 10 22:53:30 nifloutch hass[7916]: raise SerialException('read failed: {}'.format(e))
May 10 22:53:30 nifloutch hass[7916]: serial.serialutil.SerialException: read failed: device reports readiness to read but returned no data (device disconnected or multiple access on port?)

If I'm correct, the reading loop is in the receive_blocking function and I think this is where it should have a reconnexion mechanism.

After this fail, every operation will fail with this error :

May 10 22:55:00 nifloutch hass[7916]: #033[31m2017-05-10 22:55:00 ERROR (MainThread) [homeassistant.core] Error doing job: Task exception was never retrieved#033[0m
May 10 22:55:00 nifloutch hass[7916]: Traceback (most recent call last):
May 10 22:55:00 nifloutch hass[7916]: File "/root/.homeassistant/deps/serial/serialposix.py", line 534, in write
May 10 22:55:00 nifloutch hass[7916]: n = os.write(self.fd, d)
May 10 22:55:00 nifloutch hass[7916]: OSError: [Errno 5] Input/output error
May 10 22:55:00 nifloutch hass[7916]: During handling of the above exception, another exception occurred:
May 10 22:55:00 nifloutch hass[7916]: Traceback (most recent call last):
May 10 22:55:00 nifloutch hass[7916]: File "/usr/lib/python3.4/asyncio/tasks.py", line 233, in _step
May 10 22:55:00 nifloutch hass[7916]: result = coro.throw(exc)
May 10 22:55:00 nifloutch hass[7916]: File "/usr/local/lib/python3.4/dist-packages/homeassistant/core.py", line 1015, in _event_to_service_call
May 10 22:55:00 nifloutch hass[7916]: yield from service_handler.func(service_call)
May 10 22:55:00 nifloutch hass[7916]: File "/usr/local/lib/python3.4/dist-packages/homeassistant/components/switch/__init__.py", line 104, in async_handle_switch_service
May 10 22:55:00 nifloutch hass[7916]: yield from switch.async_turn_on()
May 10 22:55:00 nifloutch hass[7916]: File "/usr/lib/python3.4/asyncio/futures.py", line 388, in __iter__
May 10 22:55:00 nifloutch hass[7916]: yield self  # This tells Task to wait for completion.
May 10 22:55:00 nifloutch hass[7916]: File "/usr/lib/python3.4/asyncio/tasks.py", line 286, in _wakeup
May 10 22:55:00 nifloutch hass[7916]: value = future.result()
May 10 22:55:00 nifloutch hass[7916]: File "/usr/lib/python3.4/asyncio/futures.py", line 277, in result
May 10 22:55:00 nifloutch hass[7916]: raise self._exception
May 10 22:55:00 nifloutch hass[7916]: File "/usr/lib/python3.4/concurrent/futures/thread.py", line 54, in run
May 10 22:55:00 nifloutch hass[7916]: result = self.fn(*self.args, **self.kwargs)
May 10 22:55:00 nifloutch hass[7916]: File "/usr/local/lib/python3.4/dist-packages/homeassistant/components/switch/rfxtrx.py", line 50, in turn_on
May 10 22:55:00 nifloutch hass[7916]: self._send_command("turn_on")
May 10 22:55:00 nifloutch hass[7916]: File "/usr/local/lib/python3.4/dist-packages/homeassistant/components/rfxtrx.py", line 347, in _send_command
May 10 22:55:00 nifloutch hass[7916]: self._event.device.send_on(RFXOBJECT.transport)
May 10 22:55:00 nifloutch hass[7916]: File "/root/.homeassistant/deps/RFXtrx/__init__.py", line 221, in send_on
May 10 22:55:00 nifloutch hass[7916]: self.send_onoff(transport, True)
May 10 22:55:00 nifloutch hass[7916]: File "/root/.homeassistant/deps/RFXtrx/__init__.py", line 198, in send_onoff
May 10 22:55:00 nifloutch hass[7916]: transport.send(pkt.data)
May 10 22:55:00 nifloutch hass[7916]: File "/root/.homeassistant/deps/RFXtrx/__init__.py", line 608, in send
May 10 22:55:00 nifloutch hass[7916]: self.serial.write(pkt)
May 10 22:55:00 nifloutch hass[7916]: File "/root/.homeassistant/deps/serial/serialposix.py", line 565, in write
May 10 22:55:00 nifloutch hass[7916]: raise SerialException('write failed: {}'.format(v))
May 10 22:55:00 nifloutch hass[7916]: serial.serialutil.SerialException: write failed: [Errno 5] Input/output error#033[0m
May 10 22:55:00 nifloutch hass[7916]: #033[31m2017-05-10 22:55:00 ERROR (MainThread) [homeassistant.core] Error doing job: Task exception was never retrieved#033[0m

Is it possible to work on something like described in this post :
http://stackoverflow.com/questions/24805331/reconnecting-with-pyserial ?

I can help but I'm not even sure this is the good way to handle the problem.

Note : I posted originally on the homeassitant git hub but they sent me here : home-assistant/core#7540

Thanks !

IT mode support

Home Assistant release (hass --version):

I'm using HASS version 0.35.3

Python release (python3 --version):

Python 3.5.2

Component/platform:

Docker container on Synology DSM 6

Description of problem:

Since today i own the RFXcom rfxtrx

I managed to add my Klik aan Klik uit switches.

Now i'm trying to add my Flamingo FA500 switches.
When i add the following lines to the config:

switch:
  platform: rfxtrx
  automatic_add: True

and press on on the remote i get 2 codes:
Image of hass
Here the log entries:

16-12-28 17:04:06 INFO (Thread-13) [homeassistant.components.rfxtrx] Receive RFXCOM event from (Device_id: 001f2042 Class: LightingDevice Sub: 0)
16-12-28 17:04:06 INFO (MainThread) [homeassistant.core] Bus:Handling <Event state_changed[L]: entity_id=switch.0b1100000001f20402000070, old_state=<state switch.0b1100000001f20402000070=off; friendly_name=0b1100000001f20402000070, assumed_state=True @ 2016-12-28T18:04:04.932438+01:00>, new_state=<state switch.0b1100000001f20402000070=on; friendly_name=0b1100000001f20402000070, assumed_state=True @ 2016-12-28T18:04:06.329269+01:00>>
16-12-28 17:04:06 INFO (Thread-13) [homeassistant.components.rfxtrx] Receive RFXCOM event from (Device_id: a11 Class: LightingDevice Sub: 1)
16-12-28 17:04:06 INFO (MainThread) [homeassistant.core] Bus:Handling <Event state_changed[L]: entity_id=switch.07100101410b0070, old_state=<state switch.07100101410b0070=off; friendly_name=07100101410b0070, assumed_state=True @ 2016-12-28T18:04:05.287064+01:00>, new_state=<state switch.07100101410b0070=on; friendly_name=07100101410b0070, assumed_state=True @ 2016-12-28T18:04:06.684900+01:00>>
16-12-28 17:08:48 INFO (Thread-13) [homeassistant.components.rfxtrx] Receive RFXCOM event from (Device_id: 9ddd6632 Class: RFXtrxDevice Sub: 10)
16-12-28 17:08:51 INFO (Thread-13) [homeassistant.components.rfxtrx] Receive RFXCOM event from (Device_id: 9c6d5032 Class: RFXtrxDevice Sub: 10)
16-12-28 17:08:52 INFO (Thread-13) [homeassistant.components.rfxtrx] Receive RFXCOM event from (Device_id: 001f2045 Class: LightingDevice Sub: 0)
16-12-28 17:08:52 INFO (Thread-13) [homeassistant.components.rfxtrx] Automatic add 001f2045 rfxtrx device (Class: LightingDevice Sub: 0 Packet_id: 0b11002b0001f20405010f70)

When i try to turn them on/off from hass it is not working.

I have looked around and with Domoticz it is working, here some info from RFXcom

Switch fa500_remote_A { rfxcom="<2622466.1:Command" } 
Switch fa500_remote_B { rfxcom="<2622466.2:Command" }
Switch fa500_remote_C { rfxcom="<2622466.3:Command" }
Switch fa500_remote_D { rfxcom="<2622466.4:Command" }

// Note: does not mimic the remote but uses another subtype and code which 
// should be learned to the socket separately 
Switch virtual_fa500s_switch_1 { rfxcom=">2061.1:LIGHTING5.IT:Command" } 
Switch virtual_fa500s_switch_2 { rfxcom=">2061.2:LIGHTING5.IT:Command" }

Is it possible to add the IT functionality to pyRFXtrx? Thanks

Mishandled windchill and temperature data from TFA wind sensor

In revision 0.17,0 (and earlier, I believe), the temperature data (attributes) sent by a TFA wind sensor is only reported correctly for values less than 0 degrees C. It appears that the issue is in the handling of the leading bit to detect integers less than zero.

I've modified code that works on my machine, and will attempt to submit a pull request. However, I am an expert in neither python nor GitHub.

Support for DC106 confirm/pair

To pair a (virtual) remote for home assistent I had to buy an old windows laptop to run rfxmngr.
This was ackward, while I guess it could be part of ha itself. For RollerTrolDevice we need
{code}
def send_pair(self, transport):
""" Send a 'Pair/Confirm' command using the given transport """
pkt = lowlevel.RollerTrol()
pkt.set_transmit(
self.subtype,
self.cmndseqnbr,
self.id_combined,
self.unitcode,
0x03
)
self.cmndseqnbr = (self.cmndseqnbr + 1) % 5
transport.send(pkt.data)
{code}
related: https://community.home-assistant.io/t/solved-rfxtrx-cover-t6-blinds-not-working/18914

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.