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!

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.

Where Next?

Popular in Announcing Top

sasajuric
I’d like to announce a small library called boundaries. This is an experimental project which explores the idea of enforcing boundaries ...
New
sorentwo
Hello! tl;dr Announcing Oban, an Ecto based job processing library with a focus on reliability and historical observability. After spen...
985 42920 311
New
dbern
I’m excited to announce that TaxJar has developed and open-sourced DateTimeParser. We developed it because we found a need to parse user ...
New
brainlid
LangChain is short for Language Chain. An LLM, or Large Language Model, is the “Language” part. This library makes it easier for Elixir a...
New
tmbb
I’ve been working on two packages (not on hex.pm yet) to build admin interfaces for phoenix apps: bureaucrat - which contains a bunch ...
New
mbuhot
Leverage Open Api 3.0 (Swagger) to document, test, validate and explore your Plug and Phoenix APIs. Generate and serve a JSON Open API ...
New
Crowdhailer
Raxx is an alternative to Plug and is inspired by projects such as Rack(Ruby) and Ring(Clojure). 1.0-rc.1 is now available. To use it re...
New
sbs
Only 650 LOC, wrote for fun :slight_smile: https://github.com/sunboshan/qrcode
New
mindok
What is ContEx? A pure Elixir server-side data plotting/charting library outputting SVG. It has nice barcharts in particular and works g...
New
Azolo
Hey everyone, I just released WebSockex which is a Elixir WebSocket client. WebSockex strives to work as a OTP special process, be RFC6...
New

Other popular topics Top

lastday4you
I wanted to check elixir version in phoenix because i found that my elixir is 1.5 but when i use Enum.chunk_by it said the function is un...
New
skosch
To my knowledge, put_in, Map.update etc. all have the one limitation of not automatically creating intermediate keys when needed (for exa...
New
JorisKok
I have a server on AWS, and was running a load test using artillery. When looking at the Phoenix dashboard I see the Ports going to 100% ...
New
dokuzbir
I want to highlight html closing tags when i click a html tag. That works in .html files but doesnt work for html.eex templates. How can...
New
jay1
Why is it that the mnesia database isn’t the most preferred database for use in Elixir/Phoenix?
New
baxterw3b
Hi guys, i’m new in the Elixir world, and i have to say, that i love it! i’m having some problem to understand anonymous functions with ...
New
gausby
I asked this very same question on twitter and got some interesting feedback, but I thought it would be a good question to ask here as we...
1207 39297 209
New
fayddelight
I tried installing elixir 1.11.2 erlang 23.3.4 via asdf in my zsh shell. Enabled the versions locally and globally. When I list them ...
New
romenigld
I am trying to run a deploy with docker and I successfully runned with this command: docker build -t romenigld/blog-prod . but when I t...
New
nsuchy
Hi. I’ve noticed that Windows Powershell has it’s own IEX command and you cannot access Elixir’s IEX due to the conflict. This isn’t a cr...
New

Latest on Elixir Forum

We're in Beta

About us Mission Statement