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:
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
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:
- All SmartStart meta extensions were moved from
Grizzly.CommandClass.NodeProvisioning
namespace into theGrizzly.SmartStart.MetaExtensionnamespace. - Upon finalizing the meta extension behaviour and API we made changes to how
previously supported meta extensions worked. Namely, we added anew/1
callback that does parameter validation, and returns{:ok, MetaExtension.t()}.
This breaks the previous behaviour ofto_binary/1functions in previously
implemented meta extensions.
- Enhancements
- Full support for SmartStart meta extensions
- Add
meta_extensionsfield toGrizzly.CommandClass.NodeProvisioning
commands that can handle meta extensions - Update
Grizzly.Conn.Server.Configdocs
- Fixes
- Invalid keep alive (heart beat) interval
- Set correct constraints on
Timecommand offset values
Thank you to those who contributed to this release:
- Jean-Francois Cloutier
- Ryan Winchester
mattludwigs
mattludwigs
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.NodestructGrizzly.ConnmoduleGrizzly.NotificationsmoduleGrizzly.PacketmoduleGrizzly.close_connectionGrizzly.command_class_versions_known?Grizzly.update_command_class_versionsGrizzly.start_learn_modeGrizzly.get_command_class_versionGrizzly.has_command_classGrizzly.connected?Grizzly.has_command_class_namesGrizzly.configGrizzly.Network.busy?Grizzly.Network.ready?Grizzly.Network.get_stateGrizzly.Network.set_stateGrizzly.Network.get_nodeGrizzly.Node.newGrizzly.Node.updateGrizzly.Node.put_ipGrizzly.Node.get_ipGrizzly.Node.connectGrizzly.Node.disconnectGrizzly.Node.make_configGrizzly.Node.has_command_class?Grizzly.Node.connected?Grizzly.Node.command_class_namesGrizzly.Node.update_command_class_versionsGrizzly.Node.get_command_class_versionGrizzly.Node.command_class_version_known?Grizzly.Node.update_command_classGrizzly.Node.put_associationGrizzly.Node.get_association_listGrizzly.Node.configure_associationGrizzly.Node.get_network_informationGrizzly.Node.initialize_command_versions
Moved APIs
Grizzly.reset_controller→Grizzly.Network.reset_controllerGrizzly.get_nodes→Grizzly.Network.get_node_idsGrizzly.get_node_info→Grizzly.Node.get_node_infoGrizzly.Notifications.subscribe→Grizzly.subscribe_commandand
Grizzly.subscribe_commandsGrizzly.Notifications.unsubscribe→Grizzly.unsubscribeGrizzly.add_node→Grizzly.Inclusions.add_nodeGrizzly.remove_node→Grizzly.Inclusions.remove_nodeGrizzly.add_node_stop→Grizzly.Inclusions.add_node_stopGrizzly.remove_node_stop→Grizzly.Inclusions.remove_node_stopGrizzly.Client→Grizzly.TransportGrizzly.Security→Grizzly.ZWave.SecurityGrizzly.DSK→Grizzly.ZWave.DSKGrizzly.Node.add_lifeline_group→Grizzly.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.
Popular in Announcing
Other popular topics
Categories:
Sub Categories:
Forums
Popular Tags
- #ecto
- #liveview
- #troubleshooting
- #learning-elixir
- #deployment
- #library
- #erlang
- #testing
- #genserver
- #mix
- #absinthe
- #remote-other
- #otp
- #plug
- #how-to-question
- #macros
- #postgres
- #channels
- #elixirconf
- #exunit
- #discussion
- #code-sync
- #javascript
- #podcasts
- #onsite
- #dialyzer
- #docker
- #authentication
- #umbrella
- #full-time-contract
- #podcasts-by-brainlid
- #ecto-query
- #elixir-ls
- #phoenix_html
- #iex
- #blog-post
- #graphql
- #genstage
- #ai
- #websockets
- #supervisor
- #advent-of-code
- #elixirconf-us
- #distillery
- #processes
- #forms
- #api
- #metaprogramming
- #security
- #performance








