Duplicate Integrations Possible? (RFXCOM)

Hi All,

I’ve recently migrated from DomoticzHomeAssistant.
The adventure is great! And so far manageable :slight_smile:.
But there is one thing I can’t find any documentation for and that is duplicate integrations.
It might not be possible for each integration but in this case I’m specifically looking for the RFXCOM integration duplication.

Due to range issues I cannot position a RFXCOM receiver in my house that covers all sensors. Therefor in my old Domoticz situation I had 2 receives positioned on 2 different locations. Domoticz was able to duplicate integrations which worked fine for years.

When switching to HomeAssistant I managed to (easly) integrate one receiver over ethernet (ser2net) but I’m stuck getting the locally connected (usb-serial) receiver to work (or vice versa). Is there any possibility to include a integration twice with different settings?

If this is not possible I might have to resort to this or this. But all-in-all not very practical :frowning:

Thanks!
TimelessNL

To answer my own question, yes this is possible:
afbeelding

Steps to reproduce (easy way):

  1. Create RFXCOM integration with 1st receiver.
  2. Backup rfxcom section from .storage/core.config_entries
  3. Remove RFXCOM integration from HomeAssistant
  4. Create RFXCOM integration with 2nd receiver
  5. Stop HomeAssistant
  6. Open .storage/core.config_entries and re-add backup-ed section from step 2
  7. Add uniqueness to unique_id and title
    (Ex. 1st: rfxcom-local` & 2nd: rfxcom-remote)
  8. Start HomeAssistant
  9. Enjoy :partying_face:

Alternatively you can manually copy & edit the rfxcom section entirely, but that requires more knowledge of each parameter and default value. Also the UI clearly seems to support multiple (atleast 2) integrations of the same type, it could be that I’m somehow missing the magic add additional button :thinking:

To continue on the topic: Also the UI clearly seems to support multiple (atleast 2) integrations
Sensors received by both receivers do even combine to one entry:
afbeelding
I don’t know which sensor update from either rfxcom is eventually saved to the DB but I guess its both.
I’m curious what will happen with devices like powerplugs and if commands are transmitted from both transceivers based on the UI design above :thinking:

So normally,
you click on Add Integration to add the integration that you want.
Then if you want to add a second copy of the integration, you click on the add integration button again…

With the RFXCOM integration this is not the case? It will just say that it is already configured.

It may be necessary to raise an issue on the Home Assistant Github then - there may be a technical reason why it doesn’t support multiple instances out of the box.

For what it’s worth (for other people who might stumble across this), because I don’t have my RFXComm in the same location as my Home Assistant server, I actually use NodeRed on a Pi.

[{"id":"111625d3.9a936a","type":"mqtt out","z":"14d24653.cce13a","name":"","topic":"","qos":"","retain":"true","broker":"e2d4663.ba31a98","x":640,"y":160,"wires":[]},{"id":"472ea41a.8a277c","type":"function","z":"14d24653.cce13a","name":"","func":"var topic = \"dhjm/rfxgateway/\" + msg.topic;\nmsg.new_topic = topic;\nvar out = {};\n//out.data = msg.payload;\n//msg.payload = out;\nmsg.topic = topic;\nif (typeof msg.raw !== 'undefined') {\n    out.data = msg.payload;\n    out.raw = msg.raw;\n    msg.payload = out;\n}\nreturn msg;","outputs":1,"noerr":0,"x":380,"y":80,"wires":[["4e9846d5.9e7b68","111625d3.9a936a","3ca4d25e.29941e"]]},{"id":"c033a41c.8a82c8","type":"rfx-lights-in","z":"14d24653.cce13a","name":"RFX Lights","port":"32c78c31.961204","topicSource":"all","topic":"","x":100,"y":60,"wires":[["472ea41a.8a277c"]]},{"id":"5904b83b.af5e18","type":"rfx-doorbell-in","z":"14d24653.cce13a","name":"RFX Doorbell","port":"32c78c31.961204","topicSource":"all","topic":"","x":110,"y":120,"wires":[["472ea41a.8a277c","4e9846d5.9e7b68"]]},{"id":"374d3427.be949c","type":"rfx-meter","z":"14d24653.cce13a","name":"RFX Meter","port":"32c78c31.961204","topicSource":"all","topic":"","x":100,"y":200,"wires":[["472ea41a.8a277c"]]},{"id":"edc661f3.48312","type":"rfx-sensor","z":"14d24653.cce13a","name":"RFX Sensor","port":"32c78c31.961204","topicSource":"all","topic":"","x":110,"y":280,"wires":[["472ea41a.8a277c"]]},{"id":"f2bf95f1.f21088","type":"rfx-detector-in","z":"14d24653.cce13a","name":"RFX Alarm","port":"32c78c31.961204","topicSource":"all","topic":"","outputHeartbeats":false,"x":100,"y":360,"wires":[["472ea41a.8a277c"]]},{"id":"16bcbc7c.2e0414","type":"rfx-PT2262-in","z":"14d24653.cce13a","name":"PT2262 Devices","port":"32c78c31.961204","deviceList":"4774fc7c.21e7e4","topicSource":"all","topic":"","x":180,"y":440,"wires":[["472ea41a.8a277c","86459039.cc30f"]]},{"id":"e2d4663.ba31a98","type":"mqtt-broker","z":"","broker":"192.168.2.9","port":"1883","clientid":"","usetls":false,"compatmode":true,"keepalive":"60","cleansession":true,"birthTopic":"","birthQos":"0","birthPayload":"","willTopic":"","willQos":"0","willPayload":""},{"id":"32c78c31.961204","type":"rfxtrx-port","z":"","port":"/dev/ttyUSB0","enableDebug":false,"rfyVenetianMode":"EU"},{"id":"4774fc7c.21e7e4","type":"PT2262-device-list","z":"","name":"Found Devices","devices":[]}]

That’s my RFX Input flow

and this is my RFX Output flow:

[{"id":"caf0c94d.3b5e68","type":"tab","label":"RFX Out","disabled":false,"info":""},{"id":"c548bdf4.b0a78","type":"mqtt in","z":"caf0c94d.3b5e68","name":"","topic":"dhjm/rfxgateway/command","qos":"2","datatype":"json","broker":"e2d4663.ba31a98","x":150,"y":40,"wires":[["d35d04ca.cc7b68"]]},{"id":"90b2d12d.64a24","type":"function","z":"caf0c94d.3b5e68","name":"","func":"if (typeof msg.payload.address == 'undefined') {\n    return null;\n}\nif (typeof msg.payload.data == 'undefined') {\n    return null;\n}\nreturn msg;","outputs":1,"noerr":0,"x":490,"y":40,"wires":[["227e7717.9ec9c8"]]},{"id":"d35d04ca.cc7b68","type":"switch","z":"caf0c94d.3b5e68","name":"","property":"payload.device","propertyType":"msg","rules":[{"t":"nempty"}],"checkall":"true","repair":false,"outputs":1,"x":350,"y":40,"wires":[["90b2d12d.64a24"]]},{"id":"227e7717.9ec9c8","type":"switch","z":"caf0c94d.3b5e68","name":"","property":"payload.device","propertyType":"msg","rules":[{"t":"eq","v":"light","vt":"str"},{"t":"eq","v":"doorbell","vt":"str"}],"checkall":"true","repair":false,"outputs":2,"x":280,"y":120,"wires":[["2fde47bb.cdf9d8"],["a40d56bb.1ad6e8"]]},{"id":"2fde47bb.cdf9d8","type":"function","z":"caf0c94d.3b5e68","name":"","func":"msg.topic = msg.payload.address;\nvar o = msg.payload;\nmsg.payload = {};\nmsg.payload = o.data;\nreturn msg;","outputs":1,"noerr":0,"x":430,"y":120,"wires":[["ff47f4be.821368","4e165f83.159e2","fadbdb64.5f4648"]]},{"id":"ff47f4be.821368","type":"rfx-lights-out","z":"caf0c94d.3b5e68","name":"AC/ARC Control","port":"32c78c31.961204","topicSource":"msg","retransmit":"once","retransmitInterval":"10","topic":"","x":640,"y":120,"wires":[]},{"id":"a40d56bb.1ad6e8","type":"function","z":"caf0c94d.3b5e68","name":"","func":"msg.topic = msg.payload.address;\nvar o = msg.payload;\nmsg.payload = {};\nmsg.payload = o.data;\nreturn msg;","outputs":1,"noerr":0,"x":430,"y":160,"wires":[["f340fd6c.a6998","4e165f83.159e2"]]},{"id":"f340fd6c.a6998","type":"rfx-doorbell-out","z":"caf0c94d.3b5e68","name":"Doorbell Control","port":"32c78c31.961204","topicSource":"msg","topic":"","x":630,"y":180,"wires":[]},{"id":"4e165f83.159e2","type":"debug","z":"caf0c94d.3b5e68","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","x":540,"y":280,"wires":[]},{"id":"fadbdb64.5f4648","type":"function","z":"caf0c94d.3b5e68","name":"","func":"var t = msg.topic;\nmsg.topic = \"dhjm/rfxgateway/\" + t;\nreturn msg;","outputs":1,"noerr":0,"x":280,"y":260,"wires":[["32ac634f.f5816c"]]},{"id":"32ac634f.f5816c","type":"mqtt out","z":"caf0c94d.3b5e68","name":"","topic":"","qos":"","retain":"true","broker":"e2d4663.ba31a98","x":300,"y":320,"wires":[]},{"id":"e2d4663.ba31a98","type":"mqtt-broker","z":"","broker":"192.168.2.9","port":"1883","clientid":"","usetls":false,"compatmode":true,"keepalive":"60","cleansession":true,"birthTopic":"","birthQos":"0","birthPayload":"","willTopic":"","willQos":"0","willPayload":""},{"id":"32c78c31.961204","type":"rfxtrx-port","z":"","port":"/dev/ttyUSB0","enableDebug":false,"rfyVenetianMode":"EU"}]

Then in Home Assistant my sensors are like this:

  - platform: mqtt
    name: "House Electric"
    state_topic: "dhjm/rfxgateway/CM119_160/0xC872"
    device_class: power
    unit_of_measurement: 'W'
    value_template: "{{ value_json.power.value | int }}"

and switches like this:

  - platform: mqtt
    command_topic: dhjm/rfxgateway/command
    name: "Event Lights"
    optimistic: true
    payload_off: >
      {"device":"light","address":"AC/0x0002A95/1","data":"Off"}
    payload_on: >
      {"device":"light","address":"AC/0x0002A95/1","data":"On"}
    state_off: "Off"
    state_on: "On"
    state_topic: dhjm/rfxgateway/AC/0x0002A95/1

This way I can just stick a USB stick in the Pi and deploy the NodeRed flows. I can deploy this on multiple Pis if I need to.

Your problem is familiar to me. I also moved from Domoticz to HA and had problems with 433 MHz signal range to see all my sensors. RFXCOM transceiver is good in one way - covers many useful protocols, but its serial connection and support software on Windows kills all its advantages. Poor you, you had to buy two of these expensive beasts.

I came to the optimal (for myself) solution long way - trying various alternatives. But from the beginning it was clear, I need a device serving as 433 MHz to MQTT bridge. I tried HW bridges like Sonoff RFBridge with custom firmare, and some libraries to build such a 433 to MQTT bridge in a ESP8266 compatible device. I tried also solutions involving SDR with rtl_433. The latter pushed me into right direction: with proper antenna and receiver sensitivity I am able to see all sensors in my household, and even a bunch of sensors from the neighborhood.

Another problem is being that not all protocols that I may need is available. When I made a list of sensors and 433MHz protocols they use I found that it is not that long, and most important I do not need signal transmission, only reception. I ended up building a custom 433MHz to MQTT bridge including all protocols I need and integrate it into HA. Now this bridge with antenna is located in the best point to get all signals and RPi with HA is independent of it and can be freely relocated.

I described one example of such bridge with only one protocol. I have plans to publish examples with more protocols: Keeloq, PT2262. I use Tasmota firmware as a foundation for all such IoT devices.