angelnu / docker-ccu

Script to create a docker container with the CCU2 firmware
Apache License 2.0
33 stars 14 forks source link

Added support for HM-MOD-RPI-PCB via USB but not working #41

Closed jollyjinx closed 3 years ago

jollyjinx commented 4 years ago

I've tried this Homematic installation as I wanted to have it inside a container on my raspberry pi4. I've bought a HM-MOD-RPI-PCB which I connect via USB ( I had a fd232 lying around ). I've changed the boot up process so that /etc/init.d/S11InitRFHardware correctly initializes the /var/hm_mode to something like (numbers changed)

/ # cat /var/hm_mode
HM_HMIP_ADDRESS='0x0627BF'
HM_HMIP_DEV='HM-MOD-RPI-PCB-USB'
HM_HMIP_DEVNODE='/dev/mmd_hmip'
HM_HMIP_SERIAL='8947CE04FD'
HM_HMIP_SGTIN='1F34E5A39F23958947CE04FD'
HM_HMIP_VERSION='2.8.6'
HM_HMRF_ADDRESS='0x2d32F1'
HM_HMRF_DEV='HM-MOD-RPI-PCB-USB'
HM_HMRF_DEVNODE='/dev/mmd_bidcos'
HM_HMRF_SERIAL='QEQ0123456'
HM_HMRF_VERSION='2.8.6'
HM_HOST='pivvcu'
HM_HOST_GPIO_RESET=''
HM_HOST_GPIO_UART='/dev/ttyUSB0'
HM_LED_GREEN=''
HM_LED_GREEN_MODE1='none'
HM_LED_GREEN_MODE2='none'
HM_LED_RED=''
HM_LED_RED_MODE1='none'
HM_LED_RED_MODE2='none'
HM_LED_YELLOW=''
HM_LED_YELLOW_MODE1='none'
HM_LED_YELLOW_MODE2='none'
HM_MODE='NORMAL'
HM_RTC=''

rfd also looks good to me:

/etc/init.d # /bin/rfd  -f /etc/config/rfd.conf -l 0 -c
2020/07/30 07:20:19.566 <Info> BidCoS-Service started
2020/07/30 07:20:19.567 <Info> XmlRpc Server is listening on TCP port 32001
2020/07/30 07:20:19.569 <Warning> opendir(/etc/config/firmware//) failed
2020/07/30 07:20:19.570 <Debug> CCU2CommController::init() - Improved initialization.
2020/07/30 07:20:19.570  CCU2CommController::SendSystemCommdand()
2020/07/30 07:20:19.570  CCU2CommController::SendSystemCommdand() sending: fd 00 03 00 00 00 18 00 
2020/07/30 07:20:19.571  RX SERIAL: fd 00 0d 00 00 00 43 6f 5f 43 50 55 5f 41 70 70 d8 31 
2020/07/30 07:20:19.572  RX FRAME: 00 00 00 43 6f 5f 43 50 55 5f 41 70 70 
2020/07/30 07:20:19.572 <Debug> () CCU2CommController::handleIdentifyEvent(): Handling incoming identify event.
2020/07/30 07:20:19.574  RX SERIAL: fd 00 0e 00 00 04 02 43 6f 5f 43 50 55 5f 41 70 70 0f 97 
2020/07/30 07:20:19.574  RX FRAME: 00 00 04 02 43 6f 5f 43 50 55 5f 41 70 70 
2020/07/30 07:20:19.575 <Debug> CCU2CommController::improvedInit() - Coprocessor is in application.
2020/07/30 07:20:19.602  RX SERIAL: fd 00 15 01 02 05 00 ff 40 87 86 10 24 01 25 00 00 00 0a 24 e0 0a 00 40 69 e4 
2020/07/30 07:20:19.603  RX FRAME: 01 02 05 00 ff 40 87 86 10 24 01 25 00 00 00 0a 24 e0 0a 00 40 
2020/07/30 07:20:19.825  CCU2CommController::SendSystemCommdand()
2020/07/30 07:20:19.826  CCU2CommController::SendSystemCommdand() sending: fd 00 03 00 01 02 1e 0c 
2020/07/30 07:20:19.826  RX SERIAL: fd 00 0a 00 01 04 02 01 00 03 02 08 06 16 a7 
2020/07/30 07:20:19.828  RX FRAME: 00 01 04 02 01 00 03 02 08 06 
2020/07/30 07:20:19.828 <Info> CCU2CommController::init(): Coprocessor Bootloader Version is: 1.0.3
2020/07/30 07:20:19.828 <Info> CCU2CommController::init(): Coprocessor Firmware Version is: 2.8.6
2020/07/30 07:20:19.828  CCU2CommController::SendSystemCommdand()
2020/07/30 07:20:19.829  CCU2CommController::SendSystemCommdand() sending: fd 00 04 00 02 0a 00 3d 10 
2020/07/30 07:20:19.829  RX SERIAL: fd 00 04 00 02 04 01 19 16 
2020/07/30 07:20:19.830  RX FRAME: 00 02 04 01 
2020/07/30 07:20:19.830 <Info> () CCU2CommController::setCSMACAEnabled(): CSMA/CA disabled.
2020/07/30 07:20:19.831  CCU2CommController::SendSystemCommdand()
2020/07/30 07:20:19.831  CCU2CommController::SendSystemCommdand() sending: fd 00 03 00 03 0b 92 39 
2020/07/30 07:20:19.832  RX SERIAL: fd 00 0e 00 03 04 02 51 45 51 30 34 31 32 36 38 34 0a 1f 
2020/07/30 07:20:19.833  RX FRAME: 00 03 04 02 51 45 51 30 34 31 32 36 38 34 
2020/07/30 07:20:19.834  CCU2CommController::SendSystemCommdand()
2020/07/30 07:20:19.834  CCU2CommController::SendSystemCommdand() sending: fd 00 08 00 04 0e 5f 22 58 93 04 b4 79 
2020/07/30 07:20:19.835  RX SERIAL: fd 00 04 00 04 04 01 19 6e 
2020/07/30 07:20:19.836  RX FRAME: 00 04 04 01 
2020/07/30 07:20:19.837 <Debug> Default interface is now QEQ0123456
2020/07/30 07:20:19.838 <Info> Current AES key=0, previous AES key=0
2020/07/30 07:20:19.838  CCU2BidcosRemoteInterface::SetAesKeyUser(): Trying to change user keys...
2020/07/30 07:20:19.839  RX SERIAL: fd 00 04 01 05 04 01 0d 7a 
2020/07/30 07:20:19.839  RX FRAME: 01 05 04 01 
2020/07/30 07:20:19.840 <Debug> (QEQ0123456) Response status: OK.
2020/07/30 07:20:19.840  (QEQ0123456) CCU2CommController::handleIncomingSerialFrame(): Got an bidcos msg. Response waiting --> Handling as response...
2020/07/30 07:20:19.841  (QEQ0123456) CCU2CommController::handleIncomingSerialFrame(): Response ok
2020/07/30 07:20:19.841  CCU2BidcosRemoteInterface::SetAesKeyUser(): Previous key empty. Skip setting previous key.
2020/07/30 07:20:19.841 <Debug> CCU2BidcosRemoteInterface::StartInterface(): addr=6d 16 03 
2020/07/30 07:20:19.843  RX SERIAL: fd 00 04 01 06 04 01 0d 46 
2020/07/30 07:20:19.843  RX FRAME: 01 06 04 01 
2020/07/30 07:20:19.843 <Debug> (QEQ0123456) Response status: OK.
2020/07/30 07:20:19.844  (QEQ0123456) CCU2CommController::handleIncomingSerialFrame(): Got an bidcos msg. Response waiting --> Handling as response...
2020/07/30 07:20:19.844  (QEQ0123456) CCU2CommController::handleIncomingSerialFrame(): Response ok

The Website comes ok and shows a duty cycle but for whatever reason it does not show a teach-in device page - it only shows 'back' and 'inbox'

Edit: I've directly put in the board into the raspberry pi 4 directly and have the same result - it's recognized and multimacd and rfd run fine, but no teach in on the webpage. So it seems to me it has nothing to do with the fact that I was adding it via usb first.

where should I look to get hints on what's going wrong ?

jollyjinx commented 4 years ago

Just a followup for others that might come here in the future. I was able to get it working in BidCos only mode and it works fine. I restored a backup and was able to switch switches and read values (like power values form a measuring plug). The empty teach-in devices window is still there, so I suspect some else being awry with the Homematic software system itself.

angelnu commented 4 years ago

If the adapter is recognized by pyvccu then it should work out of the box. Check the install script to ensure the code is added to the host to init the kernel module.

The error you describe (no HM-IP) should be because the "old" firmware is loaded or the manufacturing firmware is left untouched. The CCU updates the firmware at /etc/S12UpdateRFHardware. I patch this at https://github.com/angelnu/docker-ccu/blob/master/additions/patches/S12UpdateRFHardware.patch

If everything goes well you should actually get two virtual devices, each one for one of the protocols. The rfd daemon only handless the old one while the java daemon does the homematic IP one.

jollyjinx commented 3 years ago

I've put it in the GPIO of the Raspberry and have had no luck. The only way I can get to the correct teach in page (both ip and bidcos ) is via booting it in RaspberryMatic - so the hardware works it seems ( actually I have two of the devices now as I first thought it was not working). So this is a plain raspberry pi, raspberry pi os, docker and the plain HM-MOD-RPI-PCB in the GPIO port and it does not show the teach window correctly.

On a side note: How can I check that it's recognized by pivccu ? and why do we need pivccu anyways ? I thought the whole multiplexing of bidcos/hmip is done by multimcad ?

angelnu commented 3 years ago

You need the pivccu for the USB adapter. When you connect it directly to GPIO it should work without pivccu but then you need to ensure that the board is detected at https://github.com/angelnu/docker-ccu/blob/master/additions/files/etc/init.d/S01InitHost

Since I moved to use pivccu I did not check with the Raspberry PI 4 without pivccu but it should be possible to add. Please do a PR if you add it.

angelnu commented 3 years ago

Closing issue since migrated to RaspberryMatic -> see https://github.com/jens-maus/RaspberryMatic/wiki/Docker

If issue is still there in RaspberryMatic please open an issue there - I will provide support there.