-
-
Notifications
You must be signed in to change notification settings - Fork 1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Support for RPI-RF-MOD/HM-MOD-RPI-PCB for HomeMatic/homematicIP communication #1266
Conversation
package to global buildroot-external Config.in
RPI-RF-MOD/HM-MOD-RPI-PCB support. Added commented section to /boot/config.txt to allow users to enable GPIO support for RPI-RF-MOD or HM-MOD-RPI-PCB and modified hassos-hook.sh to put the necessary device tree overlays in /boot/overlays
and ova defconfig files to be able to use HB-RF-XXX devices to connect the rf modules via ethernet or usb accordingly.
I'm the author of the generic_raw_uart kernel modules. As Jens included them in a way, that is not the supposed way, I would prefer, that this PR is not merged. I mentioned this to Jens a month ago, but he did not react on it. |
@alexreinert When you initially brought up your concerns I immediately replied and explicitly asked you to raise your technical arguments and contribute to the development of the HomeAssistant integration of the RaspberryMatic add-on before I am going to submit a PR. Neither did you contact me directly nor contribute in any way, but simply initially stated that this is not the "right" way of doing it. However, I still don't see any real technical reasons why the proposed changes in this PR (which also integrates your generic_raw_uart) might not be done in a sensible or technically valid way or might be harmful for any component of HAos. All previous testers and reviewers of these changes (cf. jens-maus/RaspberryMatic#1087) didn't raise any technical reasons why this should be done in another way or how this should be done different. That you are using these kernel drivers in your own HomeMatic-related endeavours (piVCCU, debmatic) in a different way is perfectly valid but might not be directly valid in the present context of HomeAssistant or the RaspberryMatic HA add-on. So please, state what you think might be the "supposed way" of integrating your kernel modules and what you think might be wrong in the way I am proposing it and where you feel my changes might do harm to the HAos eco system. Then I would be happy to start a technical discussion with potentially integrating changes that you think might be more optimal or smooth than the proposed way in this PR. |
You removed my conserns together with the branch, there I write it down, there were some technical arguments. Either way: |
Sorry. For preparing this PR I had to redo my fork and cleaned up the patches which unfortunately wiped our previous conversation on that matter.
To be more specific, you are talking about the following two minor changes, right? https://github.com/home-assistant/operating-system/pull/1266/files#diff-595139ce2051b540bc46854789004a236c36e642328cbc82a8f56069965707d6 So namely, the change of disabling the However, there are reasons behind these changes:
If you could assist, I would of course try to integrate some more changes that might comply more to your "reference implementation" and also then adapt the way the RaspberryMatic add-on is using these device tree overlays. So what do you think might be required here? But in terms of flexibility I still think that my approach is not only technically valid but also provides more flexibility than fixing these pins explicitly in these device tree overlays and doesn't immediately pose a problem here. And in terms of "other users" I am still unsure which other users are you talking about? We are talking here only about the native "HomeMatic CCU" and the new "RaspberryMatic CCU" add-on IMHO.
Which "breaking changes" are you talking about? Actually, I don't know of any HAos users using a
Yes, I am perfectly willing (and actually missed to propose it above) to take the role of the maintainer for all the new integrated buildroot packages including the generic_raw_uart one, if the HAos devs would allow me to take that role. |
The way how the pins are used in the device tree and in the generic-raw-uart kernel module are not locking them. They are only referenced because the GPIO numbers are not absolutly stable, they can change from kernel version to kernel version (like it was on the tinkerboard shortly after the first release). The way in the reference implementation is using the way how device tree should be used, as an abstraction layer to the underlying hardware, so that the software layers above do not need to implement hardware specific parts. You can see that in piVCCU and debmatic, which supports more than 30 different single board computers without the need of special treatment inside the scripts just by using different device tree overlays.
Even this the unpatched device tree overlay you can use your custom way of RaspberryMatic. And as we discussed some time ago: Resetting the RPI-RF-MOD using the GPIO pin is not absolutly needed as you can do a reset by switching to bootloader and back to app mode.
Currently there is no other system, right. But you try to add changes outside your addon, imho they should be generic and not RaspberryMatic specific.
You can use the combination HB-RF-USB(-2)/HM-MOD-RPI-PCB with the BidCos only firmware without own kernel drivers just using the existing default kernel modules just using an udev rule. And I know at least two persons, which are using that. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is quite some kernel code which gets loaded here, and I am not a huge fan of out-of-tree code. That said, as long as things only get loaded when manually enabled/the hardware is actually used (which from what I understand is the case), I am ok with merging this.
buildroot-external/package/generic_raw_uart/generic_raw_uart.mk
Outdated
Show resolved
Hide resolved
home-assistant#1266 (comment) Now a new config option (BR2_PACKAGE_GENERIC_RAW_UART_DTS) have to be used together with selection of the respective target platform so that the generic_raw_uart package compiles the selected device tree overlay.
Ok, I will see if I can test it again because I still recall that there was a locking issue back when I added the patches against the
Would be really good if you could implement that change in your kernel modules ASAP so that we could merge them in future for a IMHO smoother support for the
I agree, if there is a way to do this generic easily I am all fine with it. But as said, I do recall that there were good reasons for these patches back then. If these reasons still exist or are still valid in the context of Home Assistant have to be seen, thought. And still, I highly doubt that there will be any further homematic-related add-on coming up anytime soon. And if so, we could propose further changes with subsequent PRs. So even if we would not be able to create a 100% generic solution in the first iteration, the current set of changes already pose a clear improvement IMHO.
Well, but this is not an official feature of the HomeMatic CCU add-on nor is it documented in any way anywhere. Thus, I wouldn't really count it a breaking change. And even if, IMHO the benefit of adding general support for the HB-RF-USB(-2) adapter pcbs overrules this undocumented use. |
mainline rtc-ds1307 kernel module which in fact also comes with supercap charging functionality in recent 5.10.x kernels. Thus there does not seem to be a reason for the seperate kernel module anymore which is used on a RPI-RF-MOD. This refs home-assistant#1266 (review)
and replaced it by dedciated TARGET_RPI/TINKER config options to match the way this is done in other buildroot packages in HAos.
reset_pin,red/greeen/blue_pin pointer to zero. In addition, the rpi-rf-mod package is now a meta package taking care to define all required dependencies in its Config.in.
@agners This, together with the other previous changes (e.g. replacement of the dedicated Please note, that the only thing that is still missing is the device tree overlay support for the tinkerboard platform. I saw that you already integrated a newer u-boot version. Hopefully this version will already provide the necessary changes to support device tree overlays on the tinkerboard, so that just a change of the u-boot bootscript is required to allow u-boot on the tinkerboard to load the |
package to use 'alt_reset_pin' device tree node entry to implement different reset pins for RPI-RF-MOD and HM-MOD-RPI-PCB.
bootEnv.txt loading support to uboot boot script.
@agners FYI: I just committed the last missing bit regarding this PR. I added device tree overlay support for the ASUS Tinkerboard and adapted its u-boot boot script to load Looking forward to seeing this PR merged in the near future. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks quite good I would say. Still don't like downstream kernel modules of course :) It will be a pain to upgrade kernels etc. But its fairly separated so we can disable them/fix them in separate pull request when we have troubles on kernel updates.
Are there any plans to make things work with upstream kernels?
buildroot-external/board/asus/tinker/patches/uboot/add-overlay-support.patch
Outdated
Show resolved
Hide resolved
Maybe the Device Tree Overlays should be separated. Even when a HM-MOD-RPI-PCB is used, the GPIO pins 36,38,40 are blocked. This could be fixed by separating the stuff in two DTOs, one for the generic_raw_uart and one for the RPI-RF-MOD gpio-led. |
As said before. I would volunteer as a maintainer of all these changes and these new Buildroot patches and as I am regularly updating my own project (RaspberryMatic), which is also buildroot based and is using the same patches/functionality, there should be low risk that we end up in this situation. But yes, if this might come up you can disable all these packages as this functionality is anyway just optional.
I doubt that there is any chance to get these kernel modules accepted/integrated in upstream kernels. First of all, these GPIO RF modules are quite unique and so are the kernel modules they unfortunately require. And secondly, these hardware rf HATs are mainly just popular in Germany/Europe. So chances are quite low that they ever will be integrated by the upstream linux devs. But as said before. As soon as these HATs or HomeMatic/homematicIP might get obsolete or not vendor supported anymore, it should be fairly easy to remove all this again with only minor effort. |
…ainst the U-boot Kconfig file.
eq-3/occu repository directly and patch all required changes to get version 1.1 rather than directly maintaining its sources downstream.
than maintaining them downstream.
@agners
Thus, I do hope that now with having fulfilled your change request, this PR should be finally clean enough (e.g. no downstream sources anymore) to get it merged ASAP. Any further adaptions to this functionality we could then IMHO tune via subsequent PRs as specific requirements from users might come up. |
@jens-maus looks good to me now, thanks for your work! |
Thanks! So the last question here is: What is the ETA for seeing this integrated in an upcoming official HAos release? |
@jens-maus I renamed the boot config file from One thing I still wondered: You also enable |
I don't really care. Thought I use
Yes, you have to keep in mind that there are solutions to use a |
@agners Final thanks for having integrated this PR. This will be definitely highly appreciated by the HomeMatic community, I guess. Until this will be part of one of the next official releases, can you please trigger a new haos development build with this PR integrated so that the current beta testers of this functionality can use these development builds rather than the manual builds I provided them some time ago? And what about an ETA for landing of this functionality in an official stable release? |
I am doing some tests with the last night build right now, I'll start a development release somewhat later today. OS release 6 starts to get where it should be: U-Boot, Kernel and Buildroot are updated, and my initial tests look good. There is still some more testing planned, and we need to have OS Agent somewhat settled. But I don't think we have big road blocks, so hopefully sometime mid/end April. |
Abstract
In its' current form, the native HA provided HomeMatic CCU add-on in combination with HAos is largely limited in terms of functionality, simply because HAos does not come with the necessary kernel and software requirements to utilize the dual-stack HomeMatic/homematicIP communication channels provided by recent firmware versions of the
RPI-RF-MOD
orHM-MOD-RPI-PCB
rf modules developed by eQ3 / ELV, which are - however - required for seamless integration of modern homematic devices.cf. home-assistant/addons#1751
cf. home-assistant/addons#1796
cf. https://community.home-assistant.io/t/can-t-get-homematic-addon-working/275528/11
Therefore, this pull request proposes integration of changes to bring up direct support for the
RPI-RF-MOD
andHM-MOD-RPI-PCB
GPIO HATs to HAos while at the same time leaving a default HAos system unchanged if no such hardware is used or installed.Furthermore, in a separate HomeMatic/homematicIP-related endeavour a new RaspberryMatic CCU HomeAssistant add-on has been recently developed and published as an early beta version. This version comes with basic functionality, but also still lacks the fundamental functionality of being able to use the
RPI-RF-MOD
/HM-MOD-RPI-PCB
rf modules for a full-fledged "HomeMatic CCU" functionality because the underlying operating system (HAos) lacks the necessary drivers.Proposed Changes
eq3_char_loop
,generic_raw_uart
) for building+installing all necessary kernel modules for low-latency HomeMatic/homematicIP dual-stack communication required when using aRPI-RF-MOD
/HM-MOD-RPI-PCB
either directly on the GPIO bus or by using USB/LAN adapter PCBs (HB-RF-USB-2
,HB-RF-ETH
).rpi-rf-mod
) which generates RaspberryPi and ASUS Tinkerboard device tree overlays for the GPIO pins used by theRPI-RF-MOD
/HM-MOD-RPI-PCB
(including pins to drive LEDs and module reset).hassos-hook.sh
hook for RaspberryPi and Tinkerboard to install the new device tree overlays to/mnt/boot/overlays
.raspberrypi/boot-env.txt
by adding a commented section toconfig.txt
on how a user can manually enable direct GPIO support forRPI-RF-MOD
/HM-MOD-RPI-PCB
CONFIG_GPIOLIB
andCONFIG_GPIO_SYSFS
kernel config options indevice-support.config
providing the necessary GPIO kernel infrastructure for the above mentioned kernel modules and allowing to set GPIO pins viasysfs
.Technology Preview
The proposed changes has already been integrated and tested by a group of RaspberryMatic CCU add-on beta testers. For this purpose, developer builds of HAos were generated and are publically available at
https://github.com/jens-maus/operating-system/releases/tag/rm-testversion
Discussions and latest state-of-affairs on the integration and testing of the proposed changes in the context of the RaspberryMatic CCU add-on can be found here:
jens-maus/RaspberryMatic#1087
Technical Dependencies
The changes proposed here are largely based on functionality and knowhow gained during development of the OSS RaspberryMatic project, which - similar to HAos - is based on buildroot and provides functionality to build an own HomeMatic CCU central on RaspberryPi, Tinkerboard system or even on virtual OVA environments. Thus, the new proposed buildroot packages for kernel driver integration have been largely borrowed from the respective buildroot-external section in the RaspberryMatic project (see https://github.com/jens-maus/RaspberryMatic/tree/master/buildroot-external/package). Thus, future updates on the necessary kernel drivers+dependencies can be easily ported via additional pull requests.
Limitations
The following known limitation exist, which will be, however, addressed with further PullRequests in future:
Licensing Dependencies
eq3_char_loop
is licensed under GPL2generic_raw_uart
and sub modules are licensed under GPL2rpi-rf-mod
is licensed under Apache-2.0RaspberryMatic
is licensed under Apache-2.0