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