Cleanup: Improve const correctness
[hmcfgusb] / README.md
CommitLineData
54b55f0f 1This repository contains utilities to use the [HM-CFG-USB(2)][] (HomeMatic USB
0368c8ba
MG
2Konfigurations-Adapter, seems to be discontinued) from [ELV][] on Linux/Unix
3by using [libusb 1.0][].
a3182fa5 4
54b55f0f
MG
5The HM-CFG-USB can be used to send and receive [BidCoS-Packets][] to control
6[HomeMatic][] home automation devices (like remote controllable sockets,
7switches, sensors, ...).
a3182fa5 8
54b55f0f
MG
9This repository contains, amongst others, an application, which emulates the
10HomeMatic LAN configuration adapter-protocol to make it possible to use the
2a7ec3e4 11HM-CFG-USB in [Fhem][] or as a lan configuration tool for the [CCU][] or the
54b55f0f
MG
12HomeMatic windows configuration software, also supporting devices using
13AES-signing like [KeyMatic][].
14
654ffce3 15[HM-CFG-USB(2)]: http://www.eq-3.de/Downloads/eq3/downloads_produktkatalog/homematic/bda/HM-CFG-USB-2_-UM-eQ-3-150129-web.pdf
54b55f0f
MG
16[ELV]: http://www.elv.de/
17[libusb 1.0]: http://www.libusb.org/
18[BidCoS-Packets]: http://homegear.eu/index.php/BidCoS%C2%AE_Packets
19[HomeMatic]: http://www.homematic.com/
20[Fhem]: http://fhem.de/
21[KeyMatic]: http://www.elv.de/homematic-funk-tuerschlossantrieb-keymatic-silber-inkl-funk-handsender.html
2a7ec3e4 22[CCU]: http://www.elv.de/homematic-zentrale-ccu-2.html
a3182fa5
MG
23
24### Short hmland HowTo: ###
25
54b55f0f
MG
261. Install prerequisites:
27 `apt-get install libusb-1.0-0-dev build-essential git`
a3182fa5 282. Get the current version of this software (choose **one** option):
e052333d
MG
29 * Get the current *release*-version as a .tar.gz:
30 1. Download the latest version from the [releases-directory][].
31 Version 0.100 is used as an example for the following commands.
32 2. Extract the archive: `tar xzf hmcfgusb-0.100.tar.gz`
33 3. Change into the new directory: `cd hmcfgusb-0.100`
34 * Get the current *development*-version via git (can be easily updated with `git pull`):
df267f71 35 1. `git clone https://git.zerfleddert.de/git/hmcfgusb`
a3182fa5 36 2. Change into the new directory: `cd hmcfgusb`
e052333d 37 * Get the current *development*-version as an archive:
54b55f0f
MG
38 1. [hmcfgusb-HEAD-xxxxxxx.tar.gz][] (xxxxxxx is part of the commit-id.
39 xxxxxxx is just a placeholder for this HowTo, use your value)
a3182fa5
MG
40 2. Extract the archive: `tar xzf hmcfgusb-HEAD-xxxxxxx.tar.gz`
41 3. Change into the new directory: `cd hmcfgusb-HEAD-xxxxxxx`
423. Build the code: `make`
54b55f0f
MG
434. Optional: Install udev-rules so normal users can access the device:
44 `sudo cp hmcfgusb.rules /etc/udev/rules.d/`
a3182fa5 455. Plug in the HM-CFG-USB
54b55f0f
MG
466. Run hmland (with debugging the first time, see `-h` switch):
47 `./hmland -p 1234 -D`
a3182fa5
MG
487. Configure Fhem to use your new HMLAN device:
49 ``define hmusb HMLAN 127.0.0.1:1234``
50 ``attr hmusb hmId <hmId>``
51
feee6237 52**Important compatibility information:**
2a7ec3e4
MG
53If older Fhem-versions (before 2015-06-19) or [Homegear][] before 2015-07-01
54is used to connect to hmland, the `-I` switch might be needed to
1b2546f2 55impersonate a LAN-interface (this replaces the identity string HM-USB-IF with
2a7ec3e4 56HM-LAN-IF). eQ-3 rfd (CCU and configuration software) works without this switch.
e052333d
MG
57Software which needs this will not keep a stable connection open to
58hmland without this switch. It was the hardcoded default in versions
59< 0.100.
60
61This incompatibility is needed so connecting software is able to
62differentiate between HM-CFG-LAN and HM-CFG-USB.
63
feee6237 64**Important security information:**
fe6f87a9
MG
65Versions before 0.101 do not correctly transmit the AES channel-mask
66to the HM-CFG-USB, which results in signature-requests not being generated
67by the device in most cases. This can lead to processing of unsigned messages
68by the host-software. If you are relying on authenticated messages
69(with e.g. aesCommReq in Fhem) from devices like door-sensors and remotes,
70you should upgrade to at least version 0.101.
71
e052333d 72[releases-directory]: https://git.zerfleddert.de/hmcfgusb/releases/
54b55f0f 73[hmcfgusb-HEAD-xxxxxxx.tar.gz]: https://git.zerfleddert.de/cgi-bin/gitweb.cgi/hmcfgusb/snapshot/HEAD.tar.gz
e052333d 74[Homegear]: https://www.homegear.eu/
54b55f0f 75
a3182fa5
MG
76### Updating the HM-CFG-USB firmware to version 0.967: ###
77
54b55f0f
MG
781. Compile the hmcfgusb utilities like in the hmland HowTo above
79 (steps 1 to 5) and stay in the directory
d08bf87d
MG
802. Download the new firmware: [hmusbif.03c7.enc][] (extracted from the
81 [Firmware update tool][]):
54b55f0f 82 `wget https://git.zerfleddert.de/hmcfgusb/firmware/hmusbif.03c7.enc`
a3182fa5 833. Make sure that hmland is not running
54b55f0f
MG
844. Flash the update to the USB-stick:
85 `./flash-hmcfgusb hmusbif.03c7.enc` (You might need to use `sudo` for this)
86
87[hmusbif.03c7.enc]: https://git.zerfleddert.de/hmcfgusb/firmware/hmusbif.03c7.enc
d08bf87d 88[Firmware update tool]: http://www.eq-3.de/Downloads/Software/Firmware%20Update%20Tool/HM-CFG-USB-2_FW-UpdateTool-Usersoftware_V1_1_eQ-3_140619.zip
a3182fa5 89
654ffce3 90### Updating HomemMatic devices over the air (OTA) (also for CUL- and HM-MOD-UART-devices): ###
a3182fa5 91
54b55f0f
MG
921. Compile the hmcfgusb utilities like in the hmland HowTo above
93 (steps 1 to 5) and stay in the directory
942. Download the new firmware from [eQ-3][], in this example the HM-CC-RT-DN
95 firmware version 1.4
a3182fa5
MG
963. Extract the tgz-file: `tar xvzf hm_cc_rt_dn_update_V1_4_001_141020.tgz`
974. Make sure that hmland is not running
13bb1a62
MG
98* When using the **[HM-CFG-USB(2)][]**, flash the new firmware to the device
99 with serial *KEQ0123456*:
a3182fa5 100 `./flash-ota -f hm_cc_rt_dn_update_V1_4_001_141020.eq3 -s KEQ0123456`
654ffce3
MG
101* When using a **[culfw][]**-, **[a-culfw][]**- or **[tsculfw][]**-based
102 device (**[CUL][]/[COC][]/...**), flash the new firmware to the device
103 with serial *KEQ0123456*:
a3182fa5 104 `./flash-ota -f hm_cc_rt_dn_update_V1_4_001_141020.eq3 -s KEQ0123456 -c /dev/ttyACM0`
654ffce3
MG
105* When using the **[HM-MOD-UART][]**, flash the new firmware to the device
106 with serial *KEQ0123456*:
107 `./flash-ota -f hm_cc_rt_dn_update_V1_4_001_141020.eq3 -s KEQ0123456 -U /dev/ttyAMA0`
54b55f0f 108
07decdba 109**Automatic firmware-updates:**
81f2fd85
MG
110The options `-C` (HMID of central), `-D` (HMID of device) and `-K` (AES key w/
111index) can be used to send a device to the bootloader automatically without
112manually rebooting the device while pressing buttons:
113
114`./flash-ota -f hm_cc_rt_dn_update_V1_4_001_141020.eq3 -C ABCDEF -D 012345 -K 01:00112233445566778899AABBCCDDEEFF`
115
116`-K` is only needed, when AES signing is active on the device.
07decdba 117
e0f1c514 118**Acknowledgments:**
703ac645 119flash-ota uses the public domain [AES implementation by Brad Conte][] to answer
e0f1c514
MG
120signing-requests with culfw-devices.
121
54b55f0f 122[eQ-3]: http://www.eq-3.de/downloads.html
ae679348 123[culfw]: http://culfw.de/culfw.html
654ffce3
MG
124[a-culfw]: https://forum.fhem.de/index.php?topic=35064.0
125[tsculfw]: https://forum.fhem.de/index.php?topic=24436.0
ae679348
MG
126[CUL]: http://busware.de/tiki-index.php?page=CUL
127[COC]: http://busware.de/tiki-index.php?page=COC
654ffce3 128[HM-MOD-UART]: https://www.elv.de/homematic-funkmodul-fuer-raspberry-pi-bausatz.html
e0f1c514 129[AES implementation by Brad Conte]: https://github.com/B-Con/crypto-algorithms
Impressum, Datenschutz