J1605

J1605 is a switch hub with 16 relays can be controlled on TCP.

Installation

If available in Hex, the package can be installed by adding j1605 to your list of dependencies in mix.exs:

def deps do
[{:j1605, "~> 0.1.0"}]
end

Documentation can be generated with ExDoc and published on HexDocs. Once published, the docs can be found at https://hexdocs.pm/j1605.

Configuration

use Mix.Config
config :j1605,
device: [
address: "192.168.1.250",
port: 2000
]

Usage

  1. Subscribe the switch events:
Registry.register(J1605.Registry, "subscribers", nil)
  1. Receive the switch states:
{:states, {true, true, false, false, false, false, false, false,
true, false, false, false, false, false, false, false}}
  1. Turn on a switch:
J1605.Device.turn_on(0) # between 0 and 15
  1. Turn off a switch:
J1605.Device.turn_off(0) # between 0 and 15
  1. Update states:
J1605.Device.update_states()