Session:Creating Z-Wave controllers and devices

From 36C3 Wiki
Description Hacking around Z-Wave smart home protocol
Website(s) z-uno.z-wave.me
Type Workshop
Kids session No
Keyword(s) hardware, software
Tags z-wave, z-uno, smart home, home automation, iot
Person organizing PoltoS
Language en - English, fr - French, ru - Russian
en - English, fr - French, ru - Russian
Other sessions... ... further results

(Click here to refresh this page.)

Subtitle !! Room has changed !!
Starts at 2019/12/27 18:00
Ends at 2019/12/27 19:30
Duration 90 minutes
Location Assembly:CriticalDecentralisationCluster
Subtitle !! Room changed to CDC Assembly !!
Starts at 2019/12/28 14:00
Ends at 2019/12/28 15:30
Duration 90 minutes
Location Assembly:CriticalDecentralisationCluster
Starts at 2019/12/29 14:00
Ends at 2019/12/29 15:30
Duration 90 minutes
Location Assembly:CriticalDecentralisationCluster
Starts at 2019/12/29 18:00
Ends at 2019/12/29 19:30
Duration 90 minutes
Location Assembly:CriticalDecentralisationCluster

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


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

Z-Way documentation

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

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/test-ucxx/package_z-wave.me_index.json
  • Tools -> Board -> Board Manager -> Z-Uno 2.1.6
  • 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;
}