In my RFXtrx review I mentioned the Maplin remote control plug sockets and now I’m going to run through getting them set up in Home Assistant.
The first thing to do is understand how the remote control works. If you buy a five pack you’ll notice that there are only four channels on the remote. To control additional sockets you need to use the switch on the back of the remote.
On the back of the plugs there are two control dials to set the communication channel for the plug:
The first, running in Roman numerals from I to IV, corresponds to the switch on the back of the remote. This is sometimes referred to as the house code.
The second, running from 1 to 4, corresponds to the numbers on the front of the remote and is also known as the unit ID. The combination allows you to control up to 16 plugs.
You shouldn’t need to do any configuration of the RFXtrx transceiver to work with the plugs as the protocol to control them is enabled by default.
The next thing to do is configure Home Assistant. The RFXtrx transceiver will show up in Linux as something like:
/dev/serial/by-id/usb-RFXCOM_RFXtrx433_A118W9XU-if00-port0
This will be a symbolic link to the USB device – for example:
/dev/USB0
That device number can change, so either use the first form or, if you want something shorter, you can set a persistent device name using UDEV rules – you’ll need something like:
cat /etc/udev/rules.d/99-usb-serial.rules SUBSYSTEM=="tty", ATTRS{idVendor}=="0403", ATTRS{idProduct}=="6001", SYMLINK+="rfxtrx"
And now you can set up the RFXtrx component with that short name:
rfxtrx: device: /dev/rfxtrx
Unfortunately you can’t use the automatic_add feature of the component to discover the plug sockets. The RFXtrx can only send commands to them – it doesn’t listen for the commands sent by the remote control. You’ll need to find the device IDs manually, and fortunately there’s a handy little tool to help.
You need to know the type and subtype of the plugs, and that’s covered in the RFXtrx manual:
So can see that the type is Lighting1 and the subtype is GDR2. For the final parameter you need the settings on the plug itself – the house code and unit ID. The generateID script uses A – D for the house code rather than I – IV, so to generate the codes for the first two unit IDs on house code I, the commands are:
[sean@linux2 RFXcomIdGenerator]$ python generateId.py -t Lighting1 -s "GDR2" -p A,1 7100a0041010000 [sean@linux2 RFXcomIdGenerator]$ python generateId.py -t Lighting1 -s "GDR2" -p A,2 7100a0041020000
You can probably see the pattern…
These device IDs go into the switch section of your configuration.yaml, where you can set the name that will be used for the entity in HA:
switch: - platform: rfxtrx devices: 07100a0041010000: name: rfxswitch1 07100a0041020000: name: rfxswitch2
Update 27/3/2018: Note that RFXcomIdGenerator may give you 15 digit IDs and as of v0.61 HA requires valid hex numbers – you may need to add a leading zero. See this post for more details.
You can set any name you like here, but I’ve decided to give them generic names and then customise the name in my customisation file. It’s a personal preference, but it means I can have a short name for the actual entities and a more descriptive name set in my customisation:
customize: switch.rfxswitch1: friendly_name: Bedroom Speaker emulated_hue: false switch.rfxswitch2: friendly_name: Bedside Lamp emulated_hue: true
As you can see, you can also set the emulated_hue parameter here so that the devices can be voice controlled with an Amazon Echo or Google Home.
There is a downside. It’s not possible to tell if the plug sockets are switched on or off, so rather than show a switch, you get two icons – one to switch on and one to switch off:
Home Assistant will correctly show the status if you only operate the switches from within Home Assistant itself, but if you use the remote control the front end can get out of sync because it has no way of knowing that a command has been sent from the remote. Compare that with a ZWave plug socket, which is capable of reporting its status back to Home Assistant:
It doesn’t matter for operation – clicking off will always send the off signal to turn the switch off and vice versa – but it’s something you should be aware of. After I’d done the initial testing I put the remote away and control the switches purely through Home Assistant – either in automations or with an Amazon Echo.
It’s certainly only a minor niggle, and is far outweighed by the value for money of the 433MHz sockets.
in Home Automation
Hi there. I’m trying to set up HA with the same kind of hardware. After a bit of a hassle I’ve succeeded. You might wan’t to double check your blog as for me there is a small mistake in the output of RfxComIdGenerator.
Seems like there is a 0 missing at start of the code returned by the tool.
07100A0044010000 => working.
7100A0044010000 => not working.
Cheers,
Nicolas
Thanks Nicolas. In fact the original version did work until v0.61 of HA. You can read about the reason it now needs the extra leading 0 here:
https://seanb.co.uk/2018/02/the-benefit-of-open-source/
This has reminded me to check the RfxComIdGenerator to see if it’s reflecting this change, and if not to suggest the fix there. I’ll update this post as well in case someone else finds it and doesn’t read the comments 🙂