Cloning a Raspberry Pi(Raspi) as a Brematic gateway


Software part:

I wrote a little C program, which makes a Raspberry Pi, act like a real Brennenstuhl Brematic Gateway GWY433

All you need is a Raspberry Pi, and one of those cheap 433 Mhz transmitters, connected to Pi Pin 0.
You can use a different Pin by altering the source code here:

int iTransmitPin = 0;
 

Hardware part:

Picture source: chrisklinger.de

Picture source: Himpler.com/blog

 

Installing on the PI:

Download and compile my main program:

cd ~
wget http://www.ifoedit.com/PiBrematic.tar
tar xvf PiBrematic.tar
cd PiBrematic
make

Now you can start it with:
./PiBrematic

 

The program is now running as a UDP-Server and listening for messages on Port 49880.

The Android Powerswitch App will find the Pi as a Brematic Gateway, and you will be able to switch your powerplugs using this app and your new Raspberry Pi.

You can even use multiple Raspberry PIs. Powerswitch will use every discovered gateway, and send the signal to each gateway (Pi), one after another. This way you can place multiple PIs in every room, using Wifi connection, and control every powerplug in each room.

Creating TXP: Strings for your plugs:

An example of how to build correct TXP: raw codes for any remote control of your choice, check out my post at this forum here (in German).

 

TXP: String definition / description / Syntax format:

TXP:0,0,Repeatings,Pause in us, min Pulse-Length in us, Bit-Count, Pulses as multiplier of "min Pulse-Length";

 

Description:

Repeatings: Is the number of how often the signal is repeated on sending.
Pause: The pause which is sent between each signal
min Pulse-Length: is the minamal pulse length which you can use for multiplying for the final pulses.
Bit-Count: seems to be the half amount of pulses which had been received. See below example.

 

Example "TXP: String" for a Voltomat Powerplug:

TXP:0,0,3,22000,300,66,1,9,1,1,1,4,1,1,1,4,1,1,1,4,1,1,1,4,1,4,1,1,1,4,1,1,1,4,1,1,1,1,1,4,1,4,1,1,1,4,1,1,1,4,1,1,1,1,1,4,1,1,1,4,1,4,1,1,1,1,1,4,1,1,1,4,1,4,1,1,1,4,1,1,1,4,1,1,1,4,1,1,1,4,1,1,1,4,1,1,1,4,1,1,1,4,1,1,1,4,1,1,1,1,1,4,1,1,1,4,1,4,1,1,1,4,1,1,1,4,1,1,1,1,1,4,1,4,1,1,1;

To get above information about your remote control, you can use a Raspberry Pi with any receiver module, and either start my solution for Garage-hacking, or Pilight open-source from Github.

Example: start Pilight with Raw-sniffing mode like this:

sudo pilight-raw -L

Press a button on your remote, and you should see something repeating like this:

433 Mhz:
Detected repeat with 132 bits: at - 2018-10-27 T 18:35:22:
22690 321 2283 318 208 313 1257 314 207 313 1258 317 206 318 1252 314 210 323 1246 318 1249 318 206 318 1254 308 215 316 1252 318 205 318 208 314 1258 312 1254 308 218 306 1262 312 214 310 1257 313 212 314 212 310 1260 309 213 311 1260 310 1257 312 213 310 217 311 1259 300 227 303 1261 311 1256 307 219 306 1263 296 229 309 1257 304 221 304 1267 298 226 297 1271 308 218 307 1261 303 222 307 1261 297 228 305 1265 306 218 302 1269 299 223 303 224 301 1266 298 231 294 1272 300 1266 297 228 299 1270 306 219 306 1264 295 229 301 226 304 1264 295 1271 304 222 301 -#: 132

Now try to find a pattern in above numbers, so you can start creating a TXP: string for it.

If you reformat above trace like below, you can conclude this remote is using 4 pulses to represent a 0 or 1.

22690
321 2283
318 208 313 1257
314 207 313 1258
317 206 318 1252
314 210 323 1246
318 1249 318 206
318 1254 308 215
316 1252 318 205
318 208 314 1258
312 1254 308 218
306 1262 312 214
310 1257 313 212
314 212 310 1260
309 213 311 1260
310 1257 312 213
310 217 311 1259
300 227 303 1261
311 1256 307 219
306 1263 296 229
309 1257 304 221
304 1267 298 226
297 1271 308 218
307 1261 303 222
307 1261 297 228
305 1265 306 218
302 1269 299 223
303 224 301 1266
298 231 294 1272
300 1266 297 228
299 1270 306 219
306 1264 295 229
301 226 304 1264
295 1271 304 222
301
-#: 132

 

The pulses are probably:
300 300 300 1200 for a 0, and
300 1200 300 300 for a 1.

Anyhow, 300 is in this case the lowest pulse length, so you simple put a multiplier for pulses in your TXP string like this:

TXP:0,0,3,22000,300,66,

1,9,
1,1,1,4,
1,1,1,4,
1,1,1,4,
1,1,1,4,
1,4,1,1,
1,4,1,1,
1,4,1,1,
1,1,1,4,
1,4,1,1,
1,4,1,1,
1,4,1,1,
1,1,1,4,
1,1,1,4,
1,4,1,1,
1,1,1,4,
1,1,1,4,
1,4,1,1,
1,4,1,1,
1,4,1,1,
1,4,1,1,
1,4,1,1,
1,4,1,1,
1,4,1,1,
1,4,1,1,
1,4,1,1,
1,1,1,4,
1,1,1,4,
1,4,1,1,
1,4,1,1,
1,4,1,1,
1,1,1,4,
1,4,1,1,
1;

Finally remove the "Return / New Line" from that, so you'll end up with a string like this:

TXP:0,0,3,22000,300,66,1,9,1,1,1,4,1,1,1,4,1,1,1,4,1,1,1,4,1,4,1,1,1,4,1,1,1,4,1,1,1,1,1,4,1,4,1,1,1,4,1,1,1,4,1,1,1,1,1,4,1,1,1,4,1,4,1,1,1,1,1,4,1,1,1,4,1,4,1,1,1,4,1,1,1,4,1,1,1,4,1,1,1,4,1,1,1,4,1,1,1,4,1,1,1,4,1,1,1,4,1,1,1,1,1,4,1,1,1,4,1,4,1,1,1,4,1,1,1,4,1,1,1,1,1,4,1,4,1,1,1;

Put that in your favorite application like PowerSwitch for Android, or FB-Switch as Web Application on your PC, or any Home control like openHAB, ioBroker or FEHM, and it will switch your devices :)

 


Please give a feedback if you like this page. Thank you.

For suggestions or comments send an email to Derrow@yahoo.com


Copyright ©1997-2017 Decision Developments.
All rights reserved. Unauthorized usage of shown material is prohibited.