Version 3

Workshop: Hacking around Z-Wave smart home protocol

Hacking around Z-Wave smart home gateway based on Raspberry Pi and making your own Z-Wave device based on Z-Uno.

Please take with you


  • Your laptop with


    • Access to the internet

    • Arduino IDE installed

    • Z-Uno package installed in Arduino IDE (see https://z-uno.z-wave.me/install for details - we will help you with this during the workshop)


  • Your Raspberry Pi 3/4 with Raspbian Stretch (optional)

  • Arduino compatible sensors to build your own Z-Wave sensor (optional)

  • Your Z-Wave stuff if any (optional)

Workshop sections



  • What is Z-Wave and where should you use it

  • Z-Way controller and RaZberry/UZB hardware


    • Controlling switches

    • Reading sensor/switch values

    • Making rules

    • Using JS API


  • Z-Uno prototyping board


    • Making Simple Switch

    • Adding more stuff


  • Z-Uno Shield and Z-Uno Configurator

  • Z-Uno Modules


Usefull links for the workshop

Z-Way controllers on the workshop



  • Controller (EU, 868 MHz)

  • Smart Home UI http://192.168.88.22:8083

  • Expert UI http://192.168.88.22:8083/expert

  • WiFi SSID

  • Z-Wave-RPi-xxxx / PSK: ccc-2019

  • Smart Home User: admin / Password: ccc

Z-Way documentation



  • Installing Z-Way https://z-wave.me/z-way/download-z-way/

  • Z-Way doc https://z-wave.me/essentials

  • Z-Way JS engine GitHub https://github.com/Z-Wave-Me/home-automation/

Z-Way workshop materials



  • Making rules: Settings -> Apps -> Local -> IfThen -> Add

  • Turning on/off a device /ZWaveAPI/Run/devices[NNN].SwitchBinary.Set(0 or 1)

  • Reading switch value /ZWaveAPI/Run/devices[NNN].SwitchBinary.data.level.value

  • Reading sensor value /ZWaveAPI/Run/devices[NNN].SensorBinary.data[12].level.value

  • Using JS API /JS/Run/var v = 1; setInterval(function() { zway.devices[NNN].SwitchBinary.Set(v); v = 1-v;}, 2000);


Z-Uno documentation



  • Quick Intro https://z-uno.z-wave.me/getting-started/quick-introduction-in-z-uno/

  • Installation howto https://z-uno.z-wave.me/install

  • Language Reference https://z-uno.z-wave.me/reference/

  • Examples https://z-uno.z-wave.me/examples/

  • Z-Uno Shield https://z-uno.z-wave.me/shield/

  • Z-Uno Shield Configurator https://z-uno.z-wave.me/shield/configurator/

  • Z-Uno GitHub https://github.com/Z-Wave-Me/Z-Uno-Core/

Z-Uno settings


Make sure to configure in Arduino IDE:

  • File -> Preferences -> Add package source URL http://z-uno.z-wave.me/files/z-uno/package_z-wave.me_index.json

  • Tools -> Board -> Board Manager -> Z-Uno 2.1.5

  • Tools -> Board -> Z-Uno

  • Tools -> Programmer -> Z-Uno

  • Tools -> Port -> /dev/ttyACM0 or /dev/ttyACM1

  • Tools -> Frequency EU/RU (depending on your controller)

  • Tools -> Security none or S0 or S2 - up to you

You might also need to add your user to *dialout* group to have permissions for /dev/ttyACM*

Z-Uno workshop materials


Sketch for Simple Switch:

ZUNO_SETUP_CHANNELS(ZUNO_SWITCH_BINARY(state, 0));

byte state = 0;

void setup() {
pinMode(13, OUTPUT);
}

void loop() {
digitalWrite(13, state ? HIGH : LOW);
}

Sketch in getter/setter style:


ZUNO_SETUP_CHANNELS(
ZUNO_SWITCH_BINARY(getter, setter),
ZUNO_SENSOR_BINARY_DOOR_WINDOW(doorGetter)
);

byte state = 0;
byte door = 0, lastDoor = 0xff;

void setup() {
pinMode(13, OUTPUT);
pinMode(18, INPUT);
}

void loop() {
digitalWrite(13, state ? HIGH : LOW);

door = digitalRead(18) == LOW ? 0xff : 0;
if (door != lastDoor) zunoSendReport(2); // push update of channel 2
lastDoor = door;
}

void setter(byte val) {
state = val;
}

byte getter() {
return state;
}

byte doorGetter() {
return door;
}

Info

Day: 2019-12-27
Start time: 18:00
Duration: 01:30
Room: CDC - Workshop area
Track: Workshop

Links:

Concurrent Events