Join GitHub today
GitHub is home to over 28 million developers working together to host and review code, manage projects, and build software together.Sign up
Rflink 433Mhz gateway platform and components #4547
Description: The change is intended to add support for the Rflink gateway devices (http://www.nemcon.nl/blog2/ & https://www.nodo-shop.nl/nl/21-rflink-gateway) which allow receiving and sending of 433Mhz packets much like rfxtrx. It builds on the rflink python package (https://pypi.python.org/pypi/rflink) which was initiated for this cause.
At the moment this is a very rough (but working) sketch with a lot of debugging. Expect much of the code to be changed, move around or migrate towards the rflink package to be available for a broader audience.
Feel free to leave feedback or feature requests.
I try to model this close to the rfxtrx platform but since this platform is developed asyncio first not a lot can be shared (yet).
Please help by testing this out with your own Rflink device and providing feedback.
What works at the moment:
Example entry for
rflink: port: /dev/serial/by-id/usb-Arduino__www.arduino.cc__0042_55632313338351B08080-if00 # send simultaneous commands as quickly as possible (may cause commands to fail) # wait_for_ack: false # ignore_device: # - digitech_* light: - platform: rflink # adds new devices to this group if not configured below new_devices_group: New Rflink Lights devices: newkaku_00000001_a: name: bedroom newkaku_00000001_b: name: kitchen aliasses: - kaku_000000_3 sensor: - platform: rflink # adds new devices to this group if not configured below new_devices_group: New Rflink Sensors devices: digitech_002f: # a single rflink packet can contain multiple values (eg: temperature and humidity) # setting value_key allows to specify which key should be used from the packet value_key: temperature switch: - platform: rflink devices: newkaku_00000001_1: name: ventilator icon: mdi:fan
If you want to test this on for example your laptop/desktop without having to modify your existing HASS server but you don't want to have your Rflink hooked to the serial port of your laptop/desktop, this module support connecting through TCP as well. On the host connected to the Rflink install
socat -ddd /dev/ttyACM0,b57600 TCP-LISTEN:1234,reuseaddr
This will expose the serial line on a tcp connection.
Then configure the component like this:
rflink: host: hostname port: 1234 light: - platform: rflink
If you are interested, I used your first beta and added:
Two things to add to your todo list:
I have attached my modifications to your code in a zip file (based on rflink 0.0.7 library)
But can you describe step by step how add RFLink Gateway(i have on Arduino Mega by USB) to Home Assistan and then how add devices like sensor temp, like blinds somfy, like switch anslut(from Jula Shop) or sensor/switch contact ? Please i am begginer and i want to go to working HA but now i use Domoticz and Domoticz is no good.
@aequitas: Big thumbs up for this, I'm using this with success now for my Kaku lights and a oregon weather station. However I have a couple of small issues, my Kaku lights are also linked to a group switch on my remote but HomeAssitants doesn't pick this up. I was able to capture the command with
Can this also be integrated?
Another minor thing, HomeAssistant complained about the weather sensor's 'sensor_type' should be required but I'm not sure this is true I though I've read somewhere in the docs they're optional right?
pushed a commit
this pull request
Feb 9, 2017
Hi @aequitas, sorry for delay, these motion sensors are based on chip EV1527, as You can see, only ON command was sent:
DEBUG:rflink.protocol:received data: 20;06;EV1527;ID=045a42;SWITCH=06
@Lampy09 I will start working on group support.
Sensor type is mandatory for sensors from configuration. I documented this wrong.
Do you only receive the unpack exception on restart/startup? This is a known issue that the initial data is incomplete and can be ignored. I will try to suppress that error.
@lmolent no problem. The
Hi, @aequitas "fire_event: true" in "device_defaults:" section e.g:
probably doesn't works. It must be configured in every device section e.g:
Tested with rflink.light and rflink.switch and homeassistant==0.38.4. No button_pressed event is fired.
@aequitas : really nice work so far!
Tested working for now:
I also own the ACDB-7000AC doorbell. I had some struggles getting it to work but I found a workaround.
Some debug data:
It sends the 'allon' command but this is a group command. Looking at the RFLink source code group commands only seems to be supported yet in the Light component and not in the Switch component.
I added the following in my lights configuration:
And I used this automation rule:
When the doorbell is pressed the automation rule is triggered and I see an entry in the logbook.
Any idea when full support for a doorbell (as a switch) will be implemented?
@MacDennis76 hi, thanks for providing the feedback. I don't have a doorbell so I'm not able to test it myself. Nice to see how Kaku implements this.
I think the doorbell implementation you wrote is as close as it can get. However I would not use the
There is not really a 'doorbell' concept in HA that i'm aware of (I can't find any other than the Ring component). So I would't not what else to implement. If you have a use case example I can work with I can have a look or if you have a implementation idea feel free to create a PR.
I think for now subscribing to the event is the best solution to implement a doorbell and further logic.
@aequitas , thanks for the quick reply!
The doorbell does not send an 'alloff' command.
I am new to HASS & Python (background is C#) but looking at this line 'allon' will be handled as a group command/event:
But the rflink switch component has no logic which initializes the DATA_ENTITY_GROUP_LOOKUP collection, the rflink light component does have this logic and by default a light is part of a group.
When using rflink switch this line is called in the end:
Is my conclusion correct that group support is still to be implemented in the rflink switch component?
@MacDennis76 ah yes, sorry, forgot about that. There is no reason a switch cannot be part of a group. I think I forgot it in the implementation. The event handling is to be overhauled anyways (#6767) so I will include it with that change.
For the short term you can keep using light as functionally it is not really different from a switch for what matters here I think.
Create the switch, which will fire an event when the doorbell is pressed.
Create the automation to react to the event and also set the switch back to the OFF State ready for the next button press.
Change the actions to whatever you would like.
guys - experimenting with RFLink now. I am a little familiar with HA (did some development myself) but do not get how this RFLINK component is meant to work. I see in the logs lots of 'device_id not known, adding new device'. Afaik nothing is happening afterwards. What is supposed to happen? I do not see my devices show up in the UI nor do I see anything happening in the configuration.yaml...
@jeroenterheerdt devices should appear on the homepage when detected. If not it might be your configuration hides them by default.
Alternatively add the device id's manually to the config as described in the documentation and see if that works.
I have not worked on supporting double receivers. The current implementation of python-rflink supports only one device at a time. I don't know if HA allows you to configure a component twice, never tried this.
This could be implemented in either https://github.com/aequitas/python-rflink or the HA component. Currently all connection logic is handled in the HA component (https://github.com/home-assistant/home-assistant/blob/dev/homeassistant/components/rflink.py#L179). So that means either moving all that logic to python-rflink and simplifying the HA component or extend the HA component to allow creating and handling multiple connections. Both are pretty big tasks which I'm unable to put on my roadmap atm, but if you want to give a shot at implementing it yourself I can assist if needed.