Skip to content

Instantly share code, notes, and snippets.

View mattludwigs's full-sized avatar
💭
🚀

Matt Ludwigs mattludwigs

💭
🚀
View GitHub Profile

Grizzly v0.13.0 to v0.14.0 Upgrade Guide

No APIs have changed with Grizzly v0.14.0 however the way Grizzly is configured and started has changed.

Grizzly is no longer an application and now exposes a supervisor that the consuming application can add to its supervision tree. In real life firmware, you might not always want to have Grizzly running and staring everything automatically. We overcame this via application configs, but that has led to some awkward configuration and also the application based setup lead to some awkward implementations at the higher application level when making business logic decisions. This gives full control of consuming applications to start and configure Grizzly.

If all the default configuration options work for your application all you need to do is add Grizzly's supervisor to your supervision tree.

defmodule MyAppApplication do
@mattludwigs
mattludwigs / upgrade_grizzly_v0.12_to_v.13.md
Last active August 10, 2020 17:22
Grizzly v0.12 -> v0.13

Send a Command get a Report

The major breaking change to Grizzly when going from v0.12 or earlier to v0.13 is the main API call Grizzly.send_command/4 now returns {:ok, %Grizzly.Report{}} when the command was successfully sent. A successful command can return 4 primary reports:

  • :ack_response
  • :command
  • :queued
  • :timeout

This types can be accessed in the Grizzly.Report's :type field.

Grizzly v0.9.0 is an almost complete rewrite of Grizzly. It has been a massive overhaul that started nearly 6 months go and I am very excited about this release. Over the years we have learned a lot Z-Wave, Elixir, and OTP and with this refactor we were able to build a more reliable, robust, and consistent solution.

Update Grizzly

{:grizzly, "~> 0.9.0-rc.0"}

Runtime and On Start Notification Change

@mattludwigs
mattludwigs / gist:f1cd3bffa83fbfe28203bb2dcf8489a0
Created November 28, 2018 23:16
Notes on Elixir Nerves Setup (Not complete)

What is Nerves

  • Buildroot
  • Cross compiler tool chains
  • fwup
  • Elixir libraries

Install Nerves

installation

# This file was automatically generated by 'stack init'
#
# Some commonly used options have been documented as comments in this file.
# For advanced use and comprehensive documentation of the format, please see:
# https://docs.haskellstack.org/en/stable/yaml_configuration/
# Resolver to choose a 'specific' stackage snapshot or a compiler version.
# A snapshot resolver dictates the compiler version and the set of packages
# to be used for project dependencies. For example:
#
@mattludwigs
mattludwigs / Main.hs
Created August 15, 2017 14:55
HASKELL: Scotty + Persistent models with custom JSON format
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE ScopedTypeVariables #-}
module Main where
import Control.Monad.IO.Class (liftIO)
import Network.HTTP.Types
import Network.Wai.Middleware.RequestLogger
import Network.Wai.Middleware.Static
defmodule MapComposeTest do
use ExUnit.Case
test "Enum.map function composition" do
not_inner_composed =
"hello world"
|> String.split(" ")
|> Enum.map(&String.reverse/1)
|> Enum.map(&String.upcase/1)
module SumFun where
import Data.Monoid (Sum(..))
sumTheSums =
mconcat [ Sum 1, Sum 2, Sum 4 ]
sumTheSumGetSum = getSum . mconcat
{-
@mattludwigs
mattludwigs / palin.erl
Created April 5, 2017 17:24
Week 1 - Process and Messages (futurelearn.com)
-module(palin).
-compile(export_all).
% Starting a single server %
% erl> Pid = palin:start().
% erl> palin:check_palindrome(Pid, "bob").
% true
%
% Start multi server %
% erl> Pid = palin:start(5).
const update = ({ action, payload }, state) => {
return state;
}
const view = ({name}) => {
return div
([],
[ input([], [])
, button([ onClick({ action: "Click", payload: { name: "bob"}})], [ text("click") ])
, p([], [text(name)])