Skip to content

Latest commit

 

History

History
63 lines (44 loc) · 1.07 KB

README.md

File metadata and controls

63 lines (44 loc) · 1.07 KB

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.2.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:
J1605.subscribe()
  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.turn_on(0) # between 0 and 15
  1. Turn off a switch:
J1605.turn_off(0) # between 0 and 15
  1. Update states:
J1605.update_states()