Smoke Detector ESP32

by Ben Jones

SKU: OXRS-BMD-SMOKEDETECTOR-ESP32-FW

Introduction

Originally designed to work with Clipsal FireTek Smoke Alarmsopen in new window fitted with the Clipsal Fire Tek Mounting/Relay Baseopen in new window.

A single CAT5/6 cable can be used to monitor the alarm state, as well as trigger the remote TEST/HUSH functions (i.e. 2x outputs, 1x input per port).

Each port on a Smoke Detector 16-port (SD16) can control 2 outputs and monitor 1 input and are numbered;

IndexPortChannelTypeRJ45 Pin
111Output2
212Output3
313Input6
421Output2
522Output3
623Input6
...
46161Output2
47162Output3
48163Input6

How does it work?

When an input state change is detected an MQTT message is published to the configured MQTT broker for further processing by your home automation system.

Outputs can be switched by publishing an MQTT message to the configured MQTT broker. Each output can be configured as a relay, for simple on/off control. A motor, again with on/off control but longer interlock delays if interlocking is configured. Or a timer, for on and then timed off control.

Interlocking

Interlocking two outputs allows them to control equipment such as roller blinds, garage doors, louvre roofing etc.

However if you are planning to control a motor of any sort then it is important that the two outputs are configured as type motor and that both are interlocked with each other. This is to ensure that both outputs will not be commanded to operate at the same time and adds a 2 second delay between any changes of output.

Example payload to configure outputs 4 & 5 to control a set of roller blinds;

{
  "outputs": [
    { "index": 4, "type": "motor", "interlockIndex": 5 },
    { "index": 5, "type": "motor", "interlockIndex": 4 }
  ]
}

The operation of the interlocked outputs should be verified before connecting to any external equipment. External interlocking equipment may be required for some equipment. Most importantly, the manufacturers wiring and installation guides must be adhered to.

Timers

Timers allow an output to automatically turn off a set number of seconds after being turned on (configurable via timerSeconds, which defaults to 60 seconds).

If another on command is sent while the timer is running, it will reset to zero and begin counting down again. If an off command is sent the timer will be cancelled and the output turned off immediately.

Configuration

The firmware can be configured by publishing an MQTT message to this topic;

[PREFIX/]conf/CLIENTID[/SUFFIX]

where:

  • PREFIX: Optional topic prefix if required
  • CLIENTID: Client id of device, defaults to <MACADDRESS>
  • SUFFIX: Optional topic suffix if required

The message payload should be JSON and it's format is defined in a JSON schema document included in the adoption payload published here;

[PREFIX/]stat/CLIENTID[/SUFFIX]/adopt

See the config value in the /adopt payload.

Input Config

Each INPUT can be configured via the following properties;

KeyMandatoryValue
indexMandatoryIndex of the input to configure
typeOptionalEither button, contact, press, switch or toggle
invertOptionalEither true or false

Output Config

Each OUTPUT can be configured via the following properties;

KeyMandatoryValue
indexMandatoryIndex of the output to configure
typeOptionalEither motor, relay, or timer
interlockIndexOptionalIndex to interlock with (lock the opposite for interlocking both ways or self-lock to disable interlocking)
timerSecondsOptionalNumber of seconds an output stays on when type set to timer (defaults to 60 seconds)

The only difference between motor and relay outputs is the interlock delay (if an interlock is configured).

Output TypeInterlock delay
motor2000ms
relay500ms

Examples

To configure input 3 to be an inverted contact sensor and output 2 to be a 30 second timer;

{ 
  "inputs": [
    { "index": 3, "type": "contact", "invert": true }
  ],
  "outputs": [
    { "index": 2, "type": "timer", "timerSeconds": 30 }
  ]
}

To configure input 9 to be a button and outputs 7 & 8 to drive a motor and be interlocked;

{ 
  "inputs": [
    { "index": 9, "type": "button" }
  ],
  "outputs": [
    { "index": 7, "type": "motor", "interlockIndex": 8 },
    { "index": 8, "type": "motor", "interlockIndex": 7 }
  ]
}

TIP

A retained message will ensure the device auto-configures on startup.

Below is a table showing possible connected devices and the supported input types. Check marks indicate the recommended configurations to ensure intended behavior.

Connected Devicebuttoncontactpressrotaryswitchtoggle
Bi-Stable Switch
Door / Window Contact
PIR
Push Button

Commands

Outputs

Each OUTPUT can be controlled by publishing an MQTT message to the topic;

[PREFIX/]cmnd/CLIENTID[/SUFFIX]

where;

  • PREFIX: Optional topic prefix if required
  • CLIENTID: Client id of device, defaults to <MACADDRESS>
  • SUFFIX: Optional topic suffix if required

The message payload should be JSON and it's format is defined in a JSON schema document included in the adoption payload published here;

[PREFIX/]stat/CLIENTID[/SUFFIX]/adopt

See the command value in the /adopt payload.

KeyMandatoryValue
indexMandatoryIndex of the output to switched
commandMandatoryEither on, off, or query

TIP

The query command will cause an event to be published, with the current state of that output.

Examples

To turn on output 4 and query the state of output 7;

{ 
  "outputs": [
    { "index": 4, "command": "on" },
    { "index": 7, "command": "query" }
  ]
}

Events

An input EVENT or output STATE CHANGE is reported to a topic of the form:

[PREFIX/]stat/CLIENTID[/SUFFIX]

where;

  • PREFIX: Optional topic prefix if required
  • CLIENTID: Client id of device, defaults to <MACADDRESS>
  • SUFFIX: Optional topic suffix if required

The message payload is JSON and contains:

KeyValue
portPort this event occured on (1-16)
channelChannel this event occured on (1-3)
indexIndex of this event (1-48)
typeEvent type (see below)
eventEvent (see below)

Input Events

Event TypeEvent
buttonsingle, double, triple, quad, penta, hold, or release
contactopen or closed
presspress
switchon or off
toggletoggle

Output Events

Event TypeEvent
motoron or off
relayon or off
timeron or off

Examples

A contact opening on input 6;

{ 
  "port": 2,
  "channel": 3,
  "index": 6, 
  "type": "contact", 
  "event": "open" 
}

A triple button click on input 3;

{ 
  "port": 1, 
  "channel": 3, 
  "index": 3, 
  "type": "button", 
  "event": "triple" 
}

A relay turning on for output 7;

{
  "index": 7, 
  "type": "relay", 
  "event": "on"
}

A timer turning off for output 10;

{
  "index": 10, 
  "type": "timer", 
  "event": "off"
}

Downloads

Download the latest version of the firmware on Githubopen in new window.

Supported Hardware

This firmware is compatible with the Smoke Detectoropen in new window and is designed to run on the Rack32open in new window.

The SD16 hardware provides 12V down the line, which can be used for powering sensors (e.g. PIRs), or illuminating LEDs.

There are 2 relays for each port which connect the OUTPUT wires in the cable to a shared CMN.

A sensor or switch should pull the INPUT wire in the cable to GND to indicate that it has been activated.

The SD16 hardware has physical pull up resistors to pull the INPUT wires high and detects when they are pulled low.

The RJ45 pinout for each port is;

PINDESCRIPTION
1OUTPUT CMN
2OUTPUT 1
3OUTPUT 2
4VIN
5VIN
6INPUT 1
7GND
8GND

More information:

  • https://wiki.bmdesigns.com.au/en/BMD-urc-uio
  • http://www.superhouse.tv/rack32

Credits

License

Copyright 2020-present Bedrock Media Designs Ltd bmdesigns.com.auopen in new window

The software portion of this project is licensed under the Simplified BSD License. The "licence" folder within this project contains a copy of this license in plain text format.