mattludwigs

mattludwigs

Grizzly - Z-Wave Library for Elixir

Grizzly is a library for working with Z-Wave devices. Z-Wave is a low-frequency radio protocol for controlling smart home devices on a mesh network. Grizzly leverages Z-Wave over IP (Z/IP) to communicate to Z-Wave devices via DTLS. Grizzly provides complete support for the various Z-Wave security groups, extensible device behavior, and reliable error isolation between device behaviors.

Hardware requirements are:

  1. Z-Wave bridge controller
  2. zipgaway binary from Silicon Labs
  3. A Nerves system, custom or official.

To get up and running fast with a raspberry pi 3 check out the grizzly quickstart.

The zipgateway binary will need to be cross-compiled for your target. This can be a bit tricky, so if you need help with this part of the setup process please reach out on the forum by using the grizzly tag.

Z-Wave is a complex protocol with many moving parts and pitfalls. We hope that Grizzly provides a simple API for handling these complexities. As home automation and IoT grows in popularity we are excited to help the Elixir ecosystem provide reliable solutions to hard problems in this space.

If you have questions please feel free to reach out on the forum using the grizzly tag.

Special thanks to SmartRent for their support in open sourcing Grizzly!

Happy IoT hacking!

First Post! Switch mode

tielur

tielur

Yay! I can’t wait to try it out! Big thanks to @mattludwigs and the entire SmartRent team!

:heart: :bear: :heart:

Most Liked

mattludwigs

mattludwigs

v0.8.0!

Adds support for handling SmartStart meta extension fields.

These fields give more information about the current status, inclusion methods,
and product information for the SmartStart device.

There are two breaking changes:

  1. All SmartStart meta extensions were moved from Grizzly.CommandClass.NodeProvisioning
    namespace into the Grizzly.SmartStart.MetaExtension namespace.
  2. Upon finalizing the meta extension behaviour and API we made changes to how
    previously supported meta extensions worked. Namely, we added a new/1
    callback that does parameter validation, and returns {:ok, MetaExtension.t()}.
    This breaks the previous behaviour of to_binary/1 functions in previously
    implemented meta extensions.
  • Enhancements
    • Full support for SmartStart meta extensions
    • Add meta_extensions field to Grizzly.CommandClass.NodeProvisioning
      commands that can handle meta extensions
    • Update Grizzly.Conn.Server.Config docs
  • Fixes
    • Invalid keep alive (heart beat) interval
    • Set correct constraints on Time command offset values

Thank you to those who contributed to this release:

  • Jean-Francois Cloutier
  • Ryan Winchester
mattludwigs

mattludwigs

v0.8.1!

  • Enhancements
    • Update docs and resources
  • Fixes
    • An issue when the unsolicited message server would cause a
      no match error that propagated up the supervision tree

Thank you to those who contributed to this release:

  • Ryan Winchester
mattludwigs

mattludwigs

v0.9.0-rc.0

This is release is a massive rework of the entire API and internal works of Grizzly. Please see the release notes for more details as there are a number of breaking changes.

The reasons for this was to provide a better API, better startup times, more robustness with the runtime, and hopefully better long term maintenance. Grizzly does a lot in the way to handle the sequencing of commands the lifecycle of sending and receiving them. Some of this a little complex and was hard to test. Now, while still a little complex, these sections of the code that had a higher risk for regressions are not built in such a way that we can test them. This makes maintaining and releasing code much less low risk.

Also, we did not use OTP in such a way to provide a self-healing system in areas that would greatly benefit from that. With this release all that has better supervision, meaning that the underlining Z-Wave communication should never get into a state that isn’t self-healing. This is very important for embedded devices as they should be able to run indefinitely without human interaction and having a self-healing system is key to achieving this.

For more detailed guide to the breaking changes and how to upgrade please see
our Grizzly v0.8.0 → v0.9.0 guide.

This release presents a simpler API, faster boot time, more robustness in Z-Wave communication,
and resolves all open issues on Grizzly that were reported as bugs.

Removed APIs

  • Grizzly.Node struct
  • Grizzly.Conn module
  • Grizzly.Notifications module
  • Grizzly.Packet module
  • Grizzly.close_connection
  • Grizzly.command_class_versions_known?
  • Grizzly.update_command_class_versions
  • Grizzly.start_learn_mode
  • Grizzly.get_command_class_version
  • Grizzly.has_command_class
  • Grizzly.connected?
  • Grizzly.has_command_class_names
  • Grizzly.config
  • Grizzly.Network.busy?
  • Grizzly.Network.ready?
  • Grizzly.Network.get_state
  • Grizzly.Network.set_state
  • Grizzly.Network.get_node
  • Grizzly.Node.new
  • Grizzly.Node.update
  • Grizzly.Node.put_ip
  • Grizzly.Node.get_ip
  • Grizzly.Node.connect
  • Grizzly.Node.disconnect
  • Grizzly.Node.make_config
  • Grizzly.Node.has_command_class?
  • Grizzly.Node.connected?
  • Grizzly.Node.command_class_names
  • Grizzly.Node.update_command_class_versions
  • Grizzly.Node.get_command_class_version
  • Grizzly.Node.command_class_version_known?
  • Grizzly.Node.update_command_class
  • Grizzly.Node.put_association
  • Grizzly.Node.get_association_list
  • Grizzly.Node.configure_association
  • Grizzly.Node.get_network_information
  • Grizzly.Node.initialize_command_versions

Moved APIs

  • Grizzly.reset_controllerGrizzly.Network.reset_controller
  • Grizzly.get_nodesGrizzly.Network.get_node_ids
  • Grizzly.get_node_infoGrizzly.Node.get_node_info
  • Grizzly.Notifications.subscribeGrizzly.subscribe_command and
    Grizzly.subscribe_commands
  • Grizzly.Notifications.unsubscribeGrizzly.unsubscribe
  • Grizzly.add_nodeGrizzly.Inclusions.add_node
  • Grizzly.remove_nodeGrizzly.Inclusions.remove_node
  • Grizzly.add_node_stopGrizzly.Inclusions.add_node_stop
  • Grizzly.remove_node_stopGrizzly.Inclusions.remove_node_stop
  • Grizzly.ClientGrizzly.Transport
  • Grizzly.SecurityGrizzly.ZWave.Security
  • Grizzly.DSKGrizzly.ZWave.DSK
  • Grizzly.Node.add_lifeline_groupGrizzly.Node.set_lifeline_association

We moved all the commands and command classes to be under the the
Grizzly.ZWave module namespace and refactored the command behaviour.

Grizzly.send_command Changes

The main API function to Grizzly has changed in that it only takes a node id,
command name (atom), command args, and command options.

Also it no longer returns a plain map when there is data to report back from
a Z-Wave node but it will return {:ok, %Grizzly.ZWave.Command{}}.

Please see Grizzly and Grizzly.ZWave.Command docs for more information.

Connections

Grizzly uses the zipgateway binary under the hood. The binary has its own
networking stack and provides a DTLS server for us to connect to. Prior to
Grizzly v0.9.0 we greatly exposed that implementation detail. However, starting
in Grizzly v0.9.0 we have hidden that implementation detail away and all
connection functionally is handle by Grizzly internally. This leaves the
consumer of Grizzly to just work about sending and receiving commands.

If you are using %Grizzly.Conn{} directly this is no longer available and you
should upgrade to just using the node id you were sending commands to.

When Grizzly is Ready

We use to send a notification to let the consumer to know when Grizzly is
read. Staring in v0.9.0 the consumer needs to configure Grizzly’s runtime
with the on_ready module, function, arg callback.

config :grizzly,
  runtime: [
    on_ready: {MyApp, :some_function, []}
  ]

See Grizzly.Runtime for more details

Inclusion Handler Behaviour

Adding and removing a Z-Wave node can be a very interactive process that
involves users being able to talk to the including controller and device. The
way Grizzly < v0.9.0 did it wasn’t vary useful or robust. By adding the the
inclusion handler behaviour we allow the consumer to have full control over the
inclusion process, enabling closer to Z-Wave specification inclusion process.

See Grizzly.InclusionHandler and Grizzly.Inclusions for more information.

Command Handler Behaviour

If you need to handle a Z-Wave command lifecycle differently than the default
Grizzly implementation you can make your own handler and pass it into
Grizzly.send_command as an option:

Grizzly.send_command(node_id, :switch_binary_set, [value: :on], handler: MyHandler)

See Grizzly.CommandHandler for more information.

Supporting Commands

At the point of the rc.0 release are not fully 100% supporting the same
commands as in < v0.8.8, but we are really close. The commands that we haven’t
pulled over are not critical to average Z-Wave device control. We will work to
get all the commands back into place.

Thank you to Jean-Francois Cloutier for contributing so much to this release.

Last Post!

mattludwigs

mattludwigs

v0.15.10

Added

  • Support for querying the gateway about the command class versions it supports
    when querying extra supported command classes.

Fixed

  • Spelling error fix for the WakeUpNoMoreInformation command name

Thank you to those who contributed to this release:

  • Jean-Francois Cloutier

Where Next?

Trending in Announcing Top

bluzky
You may know https://ui.shadcn.com/, a UI component library for React. I really love it’s design style and components. I’ve built some co...
385 14863 120
New
JesseHerrick
Hey, I’m Jesse and I’m the main contributor behind Dexter, a full-featured, lightning-fast Elixir LSP optimized for large codebases. It s...
New
shahryarjb
The Chelekom project is a library of Phoenix and LiveView components generated via Mix tasks to fit developer needs seamlessly. One of i...
New
jimsynz
Beam Bots (or just BB for short) is a framework for building fault-tolerant robotics applications in Elixir using familiar OTP patterns. ...
New
Damirados
Hello everyone. After busy few months I am happy to announce v0.1.0 of Emerge &amp; Solve. They are GUI (Emerge) and State management (S...
New
ausimian
Emily is an Elixir library that runs Nx computations on Apple’s MLX. Install it as the default Nx backend and Nx, defn, Axon, Nx.Serving,...
New
zachdaniel
Introducing AshStorage! Attachment and file management that slots directly into your resources :smiling_face_with_sunglasses: I had hope...
New

Other Trending Topics Top

type1fool
I just stumbled on a newly redesigned elixir-lang.org. :tada: It looks like @Software_Mansion did the work, and I think it is generally a...
New
akoutmos
@hugobarauna and I (Alex Koutmos) have been hard at work on writing a book on Nerves that takes you from simply blinking LEDs to building...
New
juhalehtonen
There has been a thread to discuss the Stack Overflow Developer Survey on this forum every year since 2018, so here’s yet another one for...
New
bjorng
We want to introduce a new native datatype to Erlang: native records. Although replacing all tuple records with native records is not our...
New
spammy
I’m looking to build a personal workflow to quickly deploy web applications written in elixir/phoenix, for local consumption (ie not on t...
New
yureehuh
Introduction Founded in 2017 by landscape ecologist and fire mitigation expert Harry Statter, Frontline developed the first fully integra...
New

We're in Beta

About us Mission Statement