RFXtrx 868

I think it will be ready today.
If you think you are doing it correctly, you should report it as a bug

Ok, that was quick :). Indeed, now i have the device id in the log :slight_smile: :

16-08-15 20:44:32 homeassistant.components.rfxtrx: Receive RFXCOM event from (Device_id: 539fae32 Class: RFXtrxDevice Sub: 4)

Autoadd is still not working though. I’ve tried configuring the device as a switch, gives me an error in the log (an HA wont start):

16-08-15 20:37:59 homeassistant.util.yaml: while scanning for the next token found character '\t' that cannot start any token in "/volume1/homeassistant/configuration.yaml", line 69, column 1

No idea why? If i use the same syntax (as described in the getting started guide for rfxtrx components) for a sensor, it starts, but still errors:

Invalid config for [switch.rfxtrx]: Rfxtrx device 66dacf32 is invalid: Invalid device id for OrderedDict([('66dacf32', OrderedDict([('name', 'Contact_achtedeur')]))]) for dictionary value @ data['devices']. Got OrderedDict([('66dacf32', OrderedDict([('name', 'Contact_achtedeur')]))])

So basically the same behaviour as before, only now i can see the device ids. If i grep my log on rfxtrx this is the output:

16-08-15 20:43:25 homeassistant.loader: Loaded rfxtrx from homeassistant.components.rfxtrx 16-08-15 20:43:52 homeassistant.core: Bus:Handling <Event component_loaded[L]: component=rfxtrx> 16-08-15 20:43:53 homeassistant.loader: Loaded switch.rfxtrx from homeassistant.components.switch.rfxtrx 16-08-15 20:43:53 homeassistant.bootstrap: Invalid config for [switch.rfxtrx]: Rfxtrx device 66dacf32 is invalid: Invalid device id for OrderedDict([('66dacf32', OrderedDict([('name', 'Contact_achtedeur')]))]) for dictionary value @ data['devices']. Got OrderedDict([('66dacf32', OrderedDict([('name', 'Contact_achtedeur')]))]) 16-08-15 20:43:53 homeassistant.loader: Loaded sensor.rfxtrx from homeassistant.components.sensor.rfxtrx 16-08-15 20:44:20 homeassistant.components.rfxtrx: Receive RFXCOM event from (Device_id: 0f9fae32 Class: RFXtrxDevice Sub: 4) 16-08-15 20:44:22 homeassistant.components.rfxtrx: Receive RFXCOM event from (Device_id: 1bd2c332 Class: RFXtrxDevice Sub: 5) 16-08-15 20:44:32 homeassistant.components.rfxtrx: Receive RFXCOM event from (Device_id: 539fae32 Class: RFXtrxDevice Sub: 4) 16-08-15 20:45:46 homeassistant.components.rfxtrx: Receive RFXCOM event from (Device_id: 66dacf32 Class: RFXtrxDevice Sub: 5) 16-08-15 20:45:47 homeassistant.components.rfxtrx: Receive RFXCOM event from (Device_id: 66dacf32 Class: RFXtrxDevice Sub: 5) 16-08-15 20:45:48 homeassistant.components.rfxtrx: Receive RFXCOM event from (Device_id: 66dacf32 Class: RFXtrxDevice Sub: 5) 16-08-15 20:45:51 homeassistant.components.rfxtrx: Receive RFXCOM event from (Device_id: 539fae32 Class: RFXtrxDevice Sub: 4) 16-08-15 20:45:52 homeassistant.components.rfxtrx: Receive RFXCOM event from (Device_id: 539fae32 Class: RFXtrxDevice Sub: 4) 16-08-15 20:46:02 homeassistant.components.rfxtrx: Receive RFXCOM event from (Device_id: 9492c932 Class: RFXtrxDevice Sub: 5) 16-08-15 20:46:38 homeassistant.components.rfxtrx: Receive RFXCOM event from (Device_id: 659fae32 Class: RFXtrxDevice Sub: 4) 16-08-15 20:46:47 homeassistant.components.rfxtrx: Receive RFXCOM event from (Device_id: 059fae32 Class: RFXtrxDevice Sub: 4) 16-08-15 20:46:51 homeassistant.components.rfxtrx: Receive RFXCOM event from (Device_id: 679fae32 Class: RFXtrxDevice Sub: 4) 16-08-15 20:46:57 homeassistant.components.rfxtrx: Receive RFXCOM event from (Device_id: 1492c932 Class: RFXtrxDevice Sub: 5) 16-08-15 20:47:01 homeassistant.components.rfxtrx: Receive RFXCOM event from (Device_id: dd12c932 Class: RFXtrxDevice Sub: 5) 16-08-15 20:47:07 homeassistant.components.rfxtrx: Receive RFXCOM event from (Device_id: 6b9fae32 Class: RFXtrxDevice Sub: 4) 16-08-15 20:47:37 homeassistant.components.rfxtrx: Receive RFXCOM event from (Device_id: 1d9fae32 Class: RFXtrxDevice Sub: 4) 16-08-15 20:48:25 homeassistant.components.rfxtrx: Receive RFXCOM event from (Device_id: 5b9fae32 Class: RFXtrxDevice Sub: 4) 16-08-15 20:48:44 homeassistant.components.rfxtrx: Receive RFXCOM event from (Device_id: 3b9fae32 Class: RFXtrxDevice Sub: 4) 16-08-15 20:49:20 homeassistant.components.rfxtrx: Receive RFXCOM event from (Device_id: 0f9fae32 Class: RFXtrxDevice Sub: 4) 16-08-15 20:49:35 homeassistant.components.rfxtrx: Receive RFXCOM event from (Device_id: 539fae32 Class: RFXtrxDevice Sub: 4) 16-08-15 20:50:50 homeassistant.components.rfxtrx: Receive RFXCOM event from (Device_id: 9492c932 Class: RFXtrxDevice Sub: 5) 16-08-15 20:51:28 homeassistant.components.rfxtrx: Receive RFXCOM event from (Device_id: d60ec332 Class: RFXtrxDevice Sub: 5) 16-08-15 20:51:39 homeassistant.components.rfxtrx: Receive RFXCOM event from (Device_id: 659fae32 Class: RFXtrxDevice Sub: 4) 16-08-15 20:51:47 homeassistant.components.rfxtrx: Receive RFXCOM event from (Device_id: 059fae32 Class: RFXtrxDevice Sub: 4) 16-08-15 20:51:48 homeassistant.components.rfxtrx: Receive RFXCOM event from (Device_id: 1492c932 Class: RFXtrxDevice Sub: 5) 16-08-15 20:51:50 homeassistant.components.rfxtrx: Receive RFXCOM event from (Device_id: 679fae32 Class: RFXtrxDevice Sub: 4) 16-08-15 20:51:54 homeassistant.components.rfxtrx: Receive RFXCOM event from (Device_id: dd12c932 Class: RFXtrxDevice Sub: 5) 16-08-15 20:52:11 homeassistant.components.rfxtrx: Receive RFXCOM event from (Device_id: 6b9fae32 Class: RFXtrxDevice Sub: 4) 16-08-15 20:52:40 homeassistant.components.rfxtrx: Receive RFXCOM event from (Device_id: 1d9fae32 Class: RFXtrxDevice Sub: 4) 16-08-15 20:53:26 homeassistant.components.rfxtrx: Receive RFXCOM event from (Device_id: 5b9fae32 Class: RFXtrxDevice Sub: 4) 16-08-15 20:54:20 homeassistant.components.rfxtrx: Receive RFXCOM event from (Device_id: 0f9fae32 Class: RFXtrxDevice Sub: 4) 16-08-15 20:54:36 homeassistant.components.rfxtrx: Receive RFXCOM event from (Device_id: 539fae32 Class: RFXtrxDevice Sub: 4) 16-08-15 20:55:39 homeassistant.components.rfxtrx: Receive RFXCOM event from (Device_id: fa3ecb32 Class: RFXtrxDevice Sub: 5) 16-08-15 20:55:39 homeassistant.components.rfxtrx: Receive RFXCOM event from (Device_id: 9492c932 Class: RFXtrxDevice Sub: 5)

Sorry for the long post :sweat:

Grtz,

Oliver

A new release is normally coming every second week.

This means that you have used tabs instead of spaces at line 69 in your configuration file.

Could you set up the configuration like this:

rfxtrx:
  device: PATH_TO_DEVICE
  debug: True

sensor:
  platform: rfxtrx
  automatic_add: True

And remove anything else related to rfxtrx.
Start HA and trigger your sensor.
Grep the log on rfxtrx and post the output here

OK, I’m happy:

`16-08-16 13:16:15 homeassistant.loader: Loaded rfxtrx from homeassistant.components.rfxtrx
16-08-16 13:16:59 homeassistant.loader: Loaded sensor.rfxtrx from homeassistant.components.sensor.rfxtrx
16-08-16 13:16:59 homeassistant.core: Bus:Handling <Event component_loaded[L]: component=rfxtrx>
16-08-16 13:17:08 homeassistant.components.rfxtrx: Receive RFXCOM event from (Device_id: 1bd2c332 Class: RFXtrxDevice Sub: 5)
16-08-16 13:17:08 homeassistant.components.sensor.rfxtrx: Automatic add rfxtrx.sensor: sensor_1bd2c332
16-08-16 13:17:28 homeassistant.components.rfxtrx: Receive RFXCOM event from (Device_id: 5b9fae32 Class: RFXtrxDevice Sub: 4)
16-08-16 13:17:28 homeassistant.components.sensor.rfxtrx: Automatic add rfxtrx.sensor: sensor_5b9fae32

I think I messed up the config, cause now its working :slight_smile:

Thank you!

Now i only need to identify which deviceid is which sensor. They send updates every 3 to 5 minutes so HA is autoadding them all.

Just one more thing: If I want to use this rfxcom together with my 433e, how to configure that?

I tried:

`rfxtrx:
device: PATH_TO_2ND_DEVICE

But this generates an error (duplicate key), i guess because rfxtrx is already used.

Ok,

Sensors are working perfectly now!

Any clue how to get both rfxtrx devices working?
How do i set the path to a second device?

I cant seem to be able to use rfxtrx: twice, same for device. If i rename it to device 2 or something, it won’t accept it.

Great, that the sensors now are working.

I am unsure how to solve the problem with two devices. I will have a look a the code see if I find a solution.

Maybe a stupid idea, but what if the rfxtrx.py component is copied/renamed for double use? So I mean just adding a new component with a different name, but same code.

I’m no code wizard, so no idea what dependencies exists. Could something like that work?

That would probably work.
You can do that locally for you setup. But having multiple copies of the same file in main repository, would not be an accepted solution.

Ok, seems legit. But as a workaround it would do for now.

The component loads correctly if I create a copy (called rfxtrx2.py).

But then: What platform should I use for the switch? Is the platform name related to the component name?

16-08-19 21:16:07 homeassistant.loader: Loaded rfxtrx2 from homeassistant.components.rfxtrx2 16-08-19 21:16:07 homeassistant.loader: Loaded rfxtrx from homeassistant.components.rfxtrx 16-08-19 21:16:33 homeassistant.loader: Unable to find component switch.rfxtrx2 16-08-19 21:16:33 homeassistant.bootstrap: Unable to find platform switch.rfxtrx2 16-08-19 21:16:34 homeassistant.core: Bus:Handling <Event component_loaded[L]: component=rfxtrx> 16-08-19 21:16:34 homeassistant.loader: Loaded sensor.rfxtrx from homeassistant.components.sensor.rfxtrx

Ok, one step further:

Copied the switch component as well in homeassistant/components/switch/rfxtrx.py
Edited the import in that script so it imports rfxtrx2 from components as rfxtrx.

After this, still got an error: Seems there is a data validation somewhere in a dictionary. Not sure where to look for that.

16-08-19 21:32:23 homeassistant.loader: Loaded switch.rfxtrx2 from homeassistant.components.switch.rfxtrx2 16-08-19 21:32:23 homeassistant.bootstrap: Invalid config for [switch.rfxtrx2]: not a valid value for dictionary value @ data['platform']. Got 'rfxtrx2'

Maybe I’m trying to hard here, doesn’t seem like a workable solution. I would have to change this every update.

1 Like

You also have to change to DOMAIN = "rfxtrx2"
https://github.com/home-assistant/home-assistant/blob/dev/homeassistant/components/rfxtrx.py#L19

You can move your customized files to:
<config_dir>/custom_components/rfxtrx2.py
<config_dir>/custom_components/sensor/rfxtrx2.py
Then they will not change during an update

Ok tnx! Going to give it a try.

Will the config be able to read directly from the custom component dir or is this just for backup purposes when upgrading?

It works! tnx a lot! Now to see if I can get some automation to work!!!

one more thing though (for now :)):

I’ve tried adding my rfxtrx 443E as 2nd device. This doens’t really make sense. It’s more logical for me to use this one in the normal setup, without custom components. I’d like to use my 868 as 2nd custom device as support for new sensors/switches is unlikely to be relevant for me (i only use it for these security sensors).

Now the question is: What happens if i reverse it? How are the device ids I found out created by HA? Will they stay the same for every setup/component? Is some kind of hash used? I want to prevent that i have to reassign all the device ids to names. Same goes for restoring a config on a fresh install. Will the same device ids always be accepted/recognized?

It is not for backup, so can delete the other rfxtrx2.py files. And HA finds it automatically.
If you want to make your own component, you should put it in <config_dir>/custom_components/
You can find more examples of custom components here: Examples - Home Assistant

Yes, they should always stay the same. It is actually the complete packet received from the sensor. So it contains everything as device id and type. Actually also the received sensor value is stored in packet id.

If I move the files to /homeassistant/custom_components/ it doesn’t find the component anymore? If I look at the documentation it should find it though. I copied rfxtrx2.py, created a switch and sensor directory and also copied the rfxtrx.py files in that dir. Shoud be enough right?

Should I enable loading custom components somehow?

Is /homeassistant/ where you have your configuration file?

yes indeed. The config is in /volume1/homeassistant/

Home assistant itself is installed somewhere else, but a link is created in this folder to the install dir. Just like described in the getting started guide. So the components (and custom_components) folder itself is located in /volume1/homeassistant/homeassistant/

custom_components folder should be in the same folder as configuration.yaml file

ah ok…that explains it. Going to give it a try again. Tnx!

Works now :)! Tnx.

Only weird thing is that my custom component doesn’t work if there’s an error in loading the original component.
So if i pull out my rfx433 (which uses the original rfxtrx.py), rfxtrx2.py in custom component does’nt load as well.