Project

rzwaveway

0.01
No commit activity in last 3 years
No release in over 3 years
A Ruby API to use the Razberry ZWave ZWay interface
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Development

~> 1.0
~> 3.0.0

Runtime

~> 1.1.10
 Project Readme

rzwaveway

A Ruby library for communicating with the ZWave protocol stack from ZWay, running on the Raspberry Pi "razberry" add-on card (see http://razberry.z-wave.me/).

Usage examples

Initialize the framework

require 'rzwaveway'

z_way = RZWaveWay::ZWay.instance
z_way.setup(hostname: '192.168.1.123', port: 8083)
z_way.start

Listen to events

z_way.on_event(RZWaveWay::DeviceDiscoveredEvent) {|event| puts "A device was discovered" }
z_way.on_event(RZWaveWay::LevelEvent) {|event| puts "A device got triggered" }
while true do
  sleep 5
  z_way.process
end

Switch on/off a device

z_way.execute(4, RZWaveWay::CommandClass::SWITCH_BINARY, :Set, 1)
z_way.execute(4, RZWaveWay::CommandClass::SWITCH_BINARY, :Set, 0)

or

switch = z_way.devices[4]
switch.SwitchBinary.level = 1
switch.SwitchBinary.level = 0