Creating Z-Wave controllers and devices

Event Start: 9 Monate, 2 Wochen her // Event Information

Creating Z-Wave controllers and devices
Typ
Self-organized Session
Zeit
18. August 2023 16:00 - 18. August 2023 17:30
Speaker
PoltoS
Sprache
EN, FR, RU
Raum
-
Host
Self Organized Sessions

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

Location: Lemanicus Village (https://map.events.ccc.de/camp/2023/map/#20/53.0324/13.3065)

(this session is the same as on the 16th of Aug)

Please take with you:

  • Your laptop with
  • Access to the internet
  • Arduino IDE or VS code 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 OS (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/WB7 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-2023
  • 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/manual/z-way
  • 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/ttyUSB0 or /dev/ttyUSB1
  • 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/ttyUSB*

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;
}


Empfehlungen