angelnu / docker-ccu

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

HMIP-USB not working: no GPIO/USB connected RF-hardware found #42

Closed David91919 closed 4 years ago

David91919 commented 4 years ago

Hello,

I am trying desperately to make this work on a RPI4 system with OMV5 on it.

So far I managed to get the TTYUSB0 device attached to the docker like this: Host dev: crw-rw---- 1 root dialout 188, 0 Aug 29 20:47 ttyUSB0

Container dev: crw-rw---- 1 root 20 188, 0 Aug 29 21:32 ttyUSB0

However the startup log file always tells me no RF device has been found:

Starting /etc/init.d/S11InitRFHardware Identifying Homematic RF-Hardware: HmIP-RFUSB (1b1f:c020) USB stick is connected -> ensure you do the following on the host:

  • modprobe cp210x
  • echo 1b1f c020 >/sys/bus/usb-serial/drivers/cp210x/new_id BidCos-RF: none, HmIP: none, OK

Starting /etc/init.d/S12UpdateRFHardware Updating Homematic RF-Hardware: no GPIO/USB connected RF-hardware found

What could be the issue? Anything I tried from other similar reported errors doesn´t help. I tried starting the container from the portainer ui as well as from by direct docker command: docker run --device /dev/ttyUSB0 --name CCU angelnu/ccu:latest

Log:

Starting CCU services

Starting /etc/init.d/S00InstallAddon

Starting /etc/init.d/S00watchdog S00watchdog - skipping

Starting /etc/init.d/S01InitHost S01InitHost - defaults Checking device PiVCCU kernel module is not installed and did not recognize HW Hardware : BCM2711 -> Homematic PCB adapter will not work!!!

Starting /etc/init.d/S02InitRTC S02InitRTC - skipping

Starting /etc/init.d/S03InitURandom S03InitURandom - skipping

Starting /etc/init.d/S04CheckFactoryReset Checking for Factory Reset: not required

Starting /etc/init.d/S04CheckResizeLocalFS S04CheckResizeLocal - skipping

Starting /etc/init.d/S05CheckBackupRestore Checking for Backup Restore: not required

Starting /etc/init.d/S05avahi-setup.sh

Starting /etc/init.d/S06InitSystem Initializing System: mkdir: can't create directory '/var/lib/dbus': No such file or directory chmod: /var/lib/dbus: No such file or directory OK

Starting /etc/init.d/S07DisableHdmi /entrypoint.sh: line 21: /etc/init.d/S07DisableHdmi: Permission denied

Starting /etc/init.d/S07logging Starting logging: OK

Starting /etc/init.d/S10udev S10udev - skipping

Starting /etc/init.d/S11InitRFHardware Identifying Homematic RF-Hardware: HmIP-RFUSB (1b1f:c020) USB stick is connected -> ensure you do the following on the host:

  • modprobe cp210x
  • echo 1b1f c020 >/sys/bus/usb-serial/drivers/cp210x/new_id BidCos-RF: none, HmIP: none, OK

Starting /etc/init.d/S12UpdateRFHardware Updating Homematic RF-Hardware: no GPIO/USB connected RF-hardware found

Starting /etc/init.d/S13irqbalance S13irqbalance - skipping

Starting /etc/init.d/S21rngd S21rngd - skipping

Starting /etc/init.d/S30dbus Starting system message bus: done

Starting /etc/init.d/S31bluetooth S31bluetooth - skipping

Starting /etc/init.d/S40network S40network - skipping

Starting /etc/init.d/S45ifplugd S45ifplugd - skipping

Starting /etc/init.d/S48MigrateSecuritySettings Starting : OK

Starting /etc/init.d/S48ntp Starting ntpd: OK

Starting /etc/init.d/S49hs485d Preparing start of hs485d: no Hm-Wired hardware found

Starting /etc/init.d/S49xinetd Starting xinetd: OK

Starting /etc/init.d/S50eq3configd Starting eq3configd: OK

Starting /etc/init.d/S50lighttpd Starting lighttpd: creating new SSL cert... OK

Starting /etc/init.d/S50ssdpd Starting ssdpd: OK

Starting /etc/init.d/S50sshd

Starting /etc/init.d/S55InitAddons Initializing Third-Party Addons: OK

Starting /etc/init.d/S58LGWFirmwareUpdate Starting LGWFirmwareUpdate: ...OK

Starting /etc/init.d/S59SetLGWKey Setting LAN Gateway keys: OK

Starting /etc/init.d/S59snmpd cat: can't open '/etc/config/snmp/snmpd.conf': No such file or directory

Starting /etc/init.d/S60hs485d Starting hs485d: no Hm-Wired hardware found

Starting /etc/init.d/S60multimacd Starting multimacd: SKIPPING (missing HM_HOST_GPIO_UART)

Starting /etc/init.d/S60openvpn

Starting /etc/init.d/S61rfd Starting rfd: ........................................ERROR

Starting /etc/init.d/S62HMServer Starting HMIPServer: (no HMIP dev) ....OK

Starting /etc/init.d/S69UDSServices Starting eq3-uds-services: OK

Starting /etc/init.d/S70ReGaHss Starting ReGaHss: .OK

Starting /etc/init.d/S97CloudMatic Starting CloudMatic: OK

Starting /etc/init.d/S97NeoServer Starting NeoServer: OK

Starting /etc/init.d/S98StartAddons Starting Third-Party Addons: OK

Starting /etc/init.d/S98crond Starting crond: OK

Starting /etc/init.d/S99SetupLEDs Setup onboard LEDs: booted, OK Done starting CCU services

Register trap for SIGTERM

David91919 commented 4 years ago

HM_mode seems all empty: sudo docker exec CCU cat /var/hm_mode

HM_HMIP_DEV='' HM_HMIP_DEVNODE='' HM_HMRF_DEV='' HM_HMRF_DEVNODE='' HM_HOST='Unknown' HM_HOST_GPIO_RESET='' HM_HOST_GPIO_UART='' 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=''

angelnu commented 4 years ago

Did you try running the commands mentioned by the log?

    modprobe cp210x
    echo 1b1f c020 >/sys/bus/usb-serial/drivers/cp210x/new_id

Another thing that would be useful is that you post the output from deploy.sh. This script takes care of preparing the host to run the container.

David91919 commented 4 years ago

Yes I ran the modprobe and echo commands which make the ttyUSB0 available in the first place. Without these commands the ttyUSB0 doesnt show up at all in /dev/

I watched the dmesg output and it sees the HMIP-USB being connected/disconnected.

How do I find the output of deploy.sh?

I noticed how the ttyUSB0 in the container is part of Group "20" and not "Dialout". Not sure why but could this be a problem? I made sure to run the docker command with a user that is part of the dialout group.

I could find the container inspection:

{ "AppArmorProfile": "", "Args": [], "Config": { "AttachStderr": false, "AttachStdin": false, "AttachStdout": false, "Cmd": [ "/entrypoint.sh" ], "Domainname": "", "Entrypoint": null, "Env": [ "PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin" ], "ExposedPorts": { "2001/tcp": {}, "22/tcp": {}, "80/tcp": {}, "8181/tcp": {} }, "Hostname": "35d08af519be", "Image": "angelnu/ccu:latest", "Labels": {}, "OnBuild": null, "OpenStdin": false, "StdinOnce": false, "Tty": false, "User": "", "Volumes": { "/usr/local": {} }, "WorkingDir": "" }, "Created": "2020-08-29T19:32:23.221485484Z", "Driver": "overlay2", "ExecIDs": [ "efb9c2e2e0010ab4284185b2ea682af5684ce2f645f406f252a4fdecdf40a2ff" ], "GraphDriver": { "Data": { "LowerDir": "/var/lib/docker/overlay2/32905d85f111b9c61262b6a44185ba001fff8d0f0a971410d5803175755c5149-init/diff:/var/lib/docker/overlay2/cfee9866d1518b3ffb970c98898ed9c2fc7d998d552db1e7cfa4b91e5ac1c9c0/diff:/var/lib/docker/overlay2/0af05178644a68e6d6ad6bea01a152a446e95864854dab422146d1309cfe3f7b/diff", "MergedDir": "/var/lib/docker/overlay2/32905d85f111b9c61262b6a44185ba001fff8d0f0a971410d5803175755c5149/merged", "UpperDir": "/var/lib/docker/overlay2/32905d85f111b9c61262b6a44185ba001fff8d0f0a971410d5803175755c5149/diff", "WorkDir": "/var/lib/docker/overlay2/32905d85f111b9c61262b6a44185ba001fff8d0f0a971410d5803175755c5149/work" }, "Name": "overlay2" }, "HostConfig": { "AutoRemove": false, "Binds": [], "BlkioDeviceReadBps": null, "BlkioDeviceReadIOps": null, "BlkioDeviceWriteBps": null, "BlkioDeviceWriteIOps": null, "BlkioWeight": 0, "BlkioWeightDevice": null, "CapAdd": [ "AUDIT_WRITE", "CHOWN", "DAC_OVERRIDE", "FOWNER", "FSETID", "KILL", "MKNOD", "NET_BIND_SERVICE", "NET_RAW", "SETFCAP", "SETGID", "SETPCAP", "SETUID", "SYS_CHROOT" ], "CapDrop": [ "AUDIT_CONTROL", "BLOCK_SUSPEND", "DAC_READ_SEARCH", "IPC_LOCK", "IPC_OWNER", "LEASE", "LINUX_IMMUTABLE", "MAC_ADMIN", "MAC_OVERRIDE", "NET_ADMIN", "NET_BROADCAST", "SYSLOG", "SYS_ADMIN", "SYS_BOOT", "SYS_MODULE", "SYS_NICE", "SYS_PACCT", "SYS_PTRACE", "SYS_RAWIO", "SYS_RESOURCE", "SYS_TIME", "SYS_TTY_CONFIG", "WAKE_ALARM" ], "Capabilities": null, "Cgroup": "", "CgroupParent": "", "ConsoleSize": [ 0, 0 ], "ContainerIDFile": "", "CpuCount": 0, "CpuPercent": 0, "CpuPeriod": 0, "CpuQuota": 0, "CpuRealtimePeriod": 0, "CpuRealtimeRuntime": 0, "CpuShares": 0, "CpusetCpus": "", "CpusetMems": "", "DeviceCgroupRules": null, "DeviceRequests": null, "Devices": [ { "CgroupPermissions": "rwm", "PathInContainer": "/dev/ttyUSB0", "PathOnHost": "/dev/ttyUSB0" } ], "Dns": [], "DnsOptions": null, "DnsSearch": null, "ExtraHosts": [], "GroupAdd": null, "IOMaximumBandwidth": 0, "IOMaximumIOps": 0, "Init": false, "IpcMode": "private", "Isolation": "", "KernelMemory": 0, "KernelMemoryTCP": 0, "Links": null, "LogConfig": { "Config": {}, "Type": "json-file" }, "MaskedPaths": null, "Memory": 0, "MemoryReservation": 0, "MemorySwap": 0, "MemorySwappiness": null, "NanoCpus": 0, "NetworkMode": "bridge", "OomKillDisable": null, "OomScoreAdj": 0, "PidMode": "", "PidsLimit": null, "PortBindings": {}, "Privileged": true, "PublishAllPorts": true, "ReadonlyPaths": null, "ReadonlyRootfs": false, "RestartPolicy": { "MaximumRetryCount": 0, "Name": "no" }, "Runtime": "runc", "SecurityOpt": [ "label=disable" ], "ShmSize": 67108864, "UTSMode": "", "Ulimits": null, "UsernsMode": "", "VolumeDriver": "", "VolumesFrom": null }, "HostnamePath": "/var/lib/docker/containers/35d08af519be9d646037c5a9e80364c5e8273d7ddf1da999ee3888caafc758a2/hostname", "HostsPath": "/var/lib/docker/containers/35d08af519be9d646037c5a9e80364c5e8273d7ddf1da999ee3888caafc758a2/hosts", "Id": "35d08af519be9d646037c5a9e80364c5e8273d7ddf1da999ee3888caafc758a2", "Image": "sha256:c6db9288b43f89a37398caaa23abb309b109cd715ec672e15a8cac6527829724", "LogPath": "/var/lib/docker/containers/35d08af519be9d646037c5a9e80364c5e8273d7ddf1da999ee3888caafc758a2/35d08af519be9d646037c5a9e80364c5e8273d7ddf1da999ee3888caafc758a2-json.log", "MountLabel": "", "Mounts": [ { "Destination": "/usr/local", "Driver": "local", "Mode": "", "Name": "01c0a2d351ddd22e1bab956f6db96ab31058942cc3af41ffc2ae2923cf6f4b15", "Propagation": "", "RW": true, "Source": "/var/lib/docker/volumes/01c0a2d351ddd22e1bab956f6db96ab31058942cc3af41ffc2ae2923cf6f4b15/_data", "Type": "volume" } ], "Name": "/CCU", "NetworkSettings": { "Bridge": "", "EndpointID": "22041c401e95b9f9f5374ae3b88c5a11c88e7477fd902701763c8c229a0be9c0", "Gateway": "172.17.0.1", "GlobalIPv6Address": "", "GlobalIPv6PrefixLen": 0, "HairpinMode": false, "IPAddress": "172.17.0.3", "IPPrefixLen": 16, "IPv6Gateway": "", "LinkLocalIPv6Address": "", "LinkLocalIPv6PrefixLen": 0, "MacAddress": "02:42:ac:11:00:03", "Networks": { "bridge": { "Aliases": null, "DriverOpts": null, "EndpointID": "22041c401e95b9f9f5374ae3b88c5a11c88e7477fd902701763c8c229a0be9c0", "Gateway": "172.17.0.1", "GlobalIPv6Address": "", "GlobalIPv6PrefixLen": 0, "IPAMConfig": {}, "IPAddress": "172.17.0.3", "IPPrefixLen": 16, "IPv6Gateway": "", "Links": null, "MacAddress": "02:42:ac:11:00:03", "NetworkID": "9d04939007466f190b61e7cc1e7aa0565b4976540ef9334ed80ac007463618e1" } }, "Ports": { "2001/tcp": [ { "HostIp": "0.0.0.0", "HostPort": "32773" } ], "22/tcp": [ { "HostIp": "0.0.0.0", "HostPort": "32775" } ], "80/tcp": [ { "HostIp": "0.0.0.0", "HostPort": "32774" } ], "8181/tcp": [ { "HostIp": "0.0.0.0", "HostPort": "32772" } ] }, "SandboxID": "131d06bb031c4aac0f1bd8bf0a5a3a51c1cb7f2aff502c424f22fdc75bda0038", "SandboxKey": "/var/run/docker/netns/131d06bb031c", "SecondaryIPAddresses": null, "SecondaryIPv6Addresses": null }, "Path": "/entrypoint.sh", "Platform": "linux", "Portainer": { "ResourceControl": { "Id": 13, "ResourceId": "35d08af519be9d646037c5a9e80364c5e8273d7ddf1da999ee3888caafc758a2", "SubResourceIds": [], "Type": 1, "UserAccesses": [], "TeamAccesses": [], "Public": false, "AdministratorsOnly": true, "System": false } }, "ProcessLabel": "", "ResolvConfPath": "/var/lib/docker/containers/35d08af519be9d646037c5a9e80364c5e8273d7ddf1da999ee3888caafc758a2/resolv.conf", "RestartCount": 0, "State": { "Dead": false, "Error": "", "ExitCode": 0, "FinishedAt": "0001-01-01T00:00:00Z", "OOMKilled": false, "Paused": false, "Pid": 11218, "Restarting": false, "Running": true, "StartedAt": "2020-08-29T19:32:24.47103835Z", "Status": "running" } }

David91919 commented 4 years ago

I found the issue!

The HMIP-RFUSB doesn´t like any sort of USB extension, not even a quality USB hub with 10 cm cable. Whats strange is that it finds the module using lsusb etc. but it won´t be registered by the CCU software, probably since only that software tries to talk to the daughter board inside the stick. I guess the power supply to the RF board might be at its limit on my unit.

BidCos-RF: none, HmIP: HMIP-RFUSB, OK Starting /etc/init.d/S12UpdateRFHardware Updating Homematic RF-Hardware: HMIP-RFUSB: 2.8.6, OK

Just a shame my USB ports are normally blocked for SSDs/HDDs and the chunky HMIp-RFUSB doesn´t fit but thats another issue...

angelnu commented 4 years ago

I had missed your comment that you were using an own serial2usb adapter x-) Glad you got it working.

Exactly: homematic uses a custom serial device driver - this is what limits so much the HW. In the meanwhile the author of pivccu wrote its own device driver for several adapters so I use his in deploy.sh. So in other words: this docker container supports the HW supported by pivccu.

Any reason why you do not connect the PCB to the Raspberry GPIOs directly?

David91919 commented 4 years ago

I am using the official HMIP-RFUSB module. I might look at other USB adapters, good to know there´s more supported through pivccu.

The flexibility of USB is what I prefer, there´s only one GPIO connector but plenty of USB (if adapters work with the devices XD). Still planning to use the GPIO for something else (current monitor).

In any case thanks for your work on making this docker!