-
-
Notifications
You must be signed in to change notification settings - Fork 360
Home Accessory Architect
Home Accessory Architect (aka HAA) is an advanced firmware to bring native HomeKit to any device with an esp8266 controller, with OTA updates and fully customizable using a JSON string. It supports multiroom, that means you can put different services/accessories of same device in different HomeKit rooms.
This mode is used to configure device. You can setup Wifi settings, JSON config, and reset HomeKit ID accessory.
If an invalid JSON string is detected, device will enter setup mode atomically.
Once device is in setup mode, you can access to a webGUI connecting to device IP address or hostname http://HAA-XXXXXX (in case a WiFi is configured) or connecting directly to a WiFi AP generated (HAA-XXXXXX) if configured WiFi network is not available.
http://haa-1a2b3c
If you installed it using OTA procedure, there is an option called "Auto OTA Updates" that allows to search updates every time device enters in setup mode, 90 seconds pasts, and setup web page is not loaded.
To enter setup mode, you must toggle quickly any action switch/button 8 times (physical or from Home App). You can secure this method declaring a timeout since device boots to perform it.
Additionally, you can declare a physical method to enter setup mode.
Emergency Setup Mode: If device is powered cut or freezes before 3 seconds since boots, next time it boots will enter in Setup Mode.
If wifi network becomes unreachable, device will keep searching wifi automatically until it can connect again when wifi becomes available.
To configure your device, it is necessary to create a JSON string that contains all information about accessories, GPIOs, button, relays, sensors, LEDs, displays...
See here some examples and templates
Also, you can use the tool Maximilian Beck is developing:
Not all keys are mandatories, and default values will be applied when optional keys are not present. You can use a JSON validator to check your string.
JSON can be written in multiple lines, but it is highly recommended to do in a single line because uses less memory size.
If you make changes in your JSON that involve accessory types, number of used accessories or change order of them, you must check "Reset HomeKit ID" from "Setup mode" and remove your device from HomeKit; and then you must pair it again.
JSON has 2 main sections: "c" and "a".
This section is optional, and default values will be used if you don't use it.
It contains info about general setup of device. Keys are:
- 0: Default. Disable logs.
- 1: Enable UART log output.
- Default: none.
- Set GPIO number where a status LED is connected.
- 0: Normal.
- 1: Default. Inverted.
"b": Array of buttons (or any binary inputs) to enter setup mode. See buttons declarations.
- Default: 10.
- Set button filter parameter from 10 (soft) to 210 (hard) to avoid interferences. This is applied to all buttons.
- Set a custom PWM frequency, from 1 to 65535.
- Default: HAA-XXXXXX
- Set a custom network hostname. It must be between quotes and must not use special characters or blank spaces.
- Default: 0. There are not time limitations.
- 0: Disable.
- 1: Default. Enable.
"u" Enable HomeKit rest API to use with third-party tools without an encrypted connection or authentication.
- 0: Default. Disable.
- 1: Enable.
Enabling this is not recommended for security reasons, because your accessory will be exposed without any security mechanism, but you can use this feature to manage it under other domestic systems.
You can use commands like these:
Get current accessory status:
curl -X GET http://device_ip_address:5556
Set a "turn on" status of accessory with aid 1 and iid 9:
curl -X PUT -d '{"characteristics":[{"aid":1,"iid":9,"value":true}]}' http://device_ip_address:5556/characteristic
You can download HomeKit specifications to know how to build its JSON from here: https://developer.apple.com/homekit/specification/
This section is mandatory. It contains an array of HomeKit accessories.
Select accessory type:
- 1: Default. Switch.
- 2: Outlet.
- 3: ...
Creates simple HomeKit switches to enable or disable the attached accessory or a part of its functions.
- 0: Default: No Kill Switches are used.
- 1: Secure Switch: Accessory only works when this switch is turned on. Automations will not work.
- 2: Kids Switch: Physical button/switches only works when this switch is turned on. Accessory can be managed always with a HomeKit client and automations will work.
- 3: Secure Switch and Kids Switch.
Each digital input (aka button) has these options:
- Mandatory. GPIO connected to the digital input.
- 0: Disable.
- 1: Default. Enable.
- 0: Default. Normal.
- 1: Inverted.
You can have a same digital input (same GPIO) with different type attached to different accessories or functions. To create a toggle, you must declare 2 digital input types with same button/GPIO, type 0 and 1. Type 1 is the default, and it is triggered when you up button; and type 0 is triggered when you down button.
- 0: Single press, opposite to 1.
- 1: Default. Single press.
- 2: Double press.
- 3: Long press.
- 4: Very long press.
- 5: Hold press during 8 seconds.
Actions performed on each state of the accessory. Are defined by a integer number.
Depending of selected accessory type, there will be different actions to configure.
You can copy actions from other Action declaration with "a", for example:
If you have "0":{"r":[{"g":12,"v":1}]}
, you can declare "3":{"a":0}
and action "3" will do same actions of "0".
Each digital output has these options:
- Mandatory. GPIO used.
Value assigned to digital output:
- 0: Default. Low, usually off.
- 1: High, usually on.
Optional. Value in seconds to trigger digital output automatically to its previous state. You can use 2 decimals if you need.
- Min value: 0.02
- Max value: unknown, maybe near to infinite.
"m": Accessory Manager Actions: Array of orders, attached to an action, to manage other accessories from same device:
Each has these options:
"v": Value: Target status that target accessory receives. See "Orders to be received" from each Accessory Type to know what values are valid.
A standard HomeKit switch.
- "0": OFF.
- "1": ON.
- 0: Default. OFF.
- 1: ON.
- 0: Default. OFF.
- 1: ON.
- 4: Defined by fixed inputs.
- 5: Last state.
- 6: Opposite to last state.
"b": Array of buttons (or any binary inputs) attached to the switch. See buttons declarations.
"f0", "f1" ...: Arrays of buttons (or any binary inputs) attached to a specific status. See buttons declarations.
- "f0": Turns off switch.
- "f1": Turns on switch.
Value in seconds to turn off HomeKit switch automatically. You can use 2 decimals if you need.
- Min value: 0.02
- Max value: unknown, maybe near to infinite.
"d" Maximum time in seconds to use with the switch (Timer is only accessible with third-party HomeKit clients). Don't use decimals:
- Default: 0. It means disabled timer.
- Max value: unknown, maybe near to infinite.
A standard HomeKit outlet/plug. Options are same of Type 1
A stateless HomeKit button.
"f0": Array of buttons (or any binary inputs) attached to the stateless button single press event. See buttons declarations.
"f1": Array of buttons (or any binary inputs) attached to the stateless button double press event. See buttons declarations.
"f2": Array of buttons (or any binary inputs) attached to the stateless button long press event. See buttons declarations.
- "0": Stateless button single press event.
- "1": Stateless button double press event.
- "2": Stateless button long press event.
- 0: Default. Single press event.
- 1: Double press event.
- 2: Long press even.
A HomeKit Lock Mechanism.
- "0": UNLOCK.
- "1": LOCK.
- 0: Default. UNLOCK.
- 1: LOCK.
"f0", "f1" ...: Arrays of buttons (or any binary inputs) attached to a specific status. See buttons declarations.
- "f0": Unlocked.
- "f1": Locked.
- 0: Unlocked.
- 1: Default. Locked.
- 4: Defined by fixed inputs.
- 5: Last state.
- 6: Opposite to last state.
"b": Array of buttons (or any binary inputs) attached to the lock. See buttons declarations.
Value in seconds to lock it automatically. You can use 2 decimals if you need.
- Min value: 0.02
- Max value: unknown, maybe near to infinite.
A HomeKit Contact Sensor.
- "0": Sensor deactivated.
- "1": Sensor activated.
- 0: Default. Sensor deactivated.
- 1: Sensor activated.
"f0", "f1" ...: Arrays of buttons (or any binary inputs) attached to a specific status. See buttons declarations.
- "f0": Sensor deactivated.
- "f1": Sensor activated.
Value in seconds to deactivate it automatically. You can use 2 decimals if you need.
- Min value: 0.02
- Max value: unknown, maybe near to infinite.
A HomeKit Occupancy Sensor. Options are same of Type 5
A HomeKit Water Leak Sensor. Options are same of Type 5
A HomeKit Smoke Sensor. Options are same of Type 5
A HomeKit Carbon Monoxide Sensor. Options are same of Type 5
A HomeKit Carbon Dioxide Sensor. Options are same of Type 5
A HomeKit Filter Change Sensor. Options are same of Type 5
A HomeKit Motion Sensor. Options are same of Type 5
A HomeKit Water Valve or Irrigation System.
- "0": OFF.
- "1": ON.
- 0: Default. OFF.
- 1: ON.
- 0: Default. Water Valve.
- 1: Sprinkler.
- 2: Shower.
- 3: Tap.
- Min value: 0. It means disabled timer.
- Default: 3600.
- Max value: unknown, maybe near to infinite.
"f0", "f1" ...: Arrays of buttons (or any binary inputs) attached to a specific status. See buttons declarations.
- "f0": Off.
- "f1": On.
- 0: Default. Off.
- 1: On.
- 4: Defined by fixed inputs.
- 5: Last state.
- 6: Opposite to last state.
"b": Array of buttons (or any binary inputs) attached to the water valve. See buttons declarations.
Value in seconds to turn off it automatically. You can use 2 decimals if you need.
- Min value: 0.02
- Max value: unknown, maybe near to infinite.
A HomeKit Thermostat. It requires a compatible sensor.
- "0": Total OFF.
- "1": Thermostat ON, but heating OFF.
- "2": Thermostat ON, cooling OFF.
- "3": Heating ON.
- "4": Cooling ON.
- "5": Sensor error.
- 0.01: OFF.
- 0.02: ON.
- 0.03: Heater mode.
- 0.04: Cooler mode.
- 0.05: Auto mode.
- XX.Y0: Set heater temperature to XX.Yº.
- XX.Y1: Set cooler temperature to XX.Yº.
- DHT11.
- Default. DHT22 Type 1.
- DS18B20.
- Si7021 and DHT22 Type 2.
- Default: 0.0
- Min value: unknown, maybe near to -infinite
- Max value: unknown, maybe near to infinite.
- Default. Heater.
- Cooler.
- Heater and cooler.
- Default: 10.0
- Min value: unknown, maybe near to -infinite
- Max value: unknown, maybe near to infinite.
- Default: 38.0
- Min value: unknown, maybe near to -infinite
- Max value: unknown, maybe near to infinite.
- Default: 0.0
- Min value: unknown, maybe near to -infinite
- Max value: unknown, maybe near to infinite.
- Default: 30
- Min value: 3.
- Max value: 65535.
"b": Array of buttons (or any binary inputs) attached to the thermostat to cycling current mode. See buttons declarations.
"f0", "f1" ...: Arrays of buttons (or any binary inputs) attached to a specific status. See buttons declarations.
- "f0": OFF.
- "f1": ON.
- "f3": Change target temperature by +0.5º.
- "f4": Change target temperature by -0.5º.
Use these fixed input instead "f1" when you select "w":3 as thermostat type:
- "f5": ON. Mode Heater.
- "f6": ON. Mode Cooler.
- "f7": ON. Mode Auto.
- 0: Default. Off.
- 1: Heating.
- 2: Cooling.
- 4: Defined by fixed inputs.
- 5: Last state.
A HomeKit Temperature sensor. It requires a compatible sensor.
- "5": Sensor error.
- DHT11.
- Default. DHT22 Type 1.
- DS18B20.
- Si7021 and DHT22 Type 2.
- Default: 0.0
- Min value: unknown, maybe near to -infinite
- Max value: unknown, maybe near to infinite.
- Default: 30
- Min value: 3.
- Max value: 65535.
A HomeKit Humidity sensor. It requires a compatible sensor.
- "5": Sensor error.
- DHT11.
- Default. DHT22 Type 1.
- None.
- Si7021 and DHT22 Type 2.
- Default: 0.0
- Min value: unknown, maybe near to -infinite
- Max value: unknown, maybe near to infinite.
- Default: 30
- Min value: 3.
- Max value: 65535.
A HomeKit Temperature and Humidity sensor. It requires a compatible sensor.
- "5": Sensor error.
- DHT11.
- Default. DHT22 Type 1.
- None.
- Si7021 and DHT22 Type 2.
- Default: 0.0
- Min value: unknown, maybe near to -infinite
- Max value: unknown, maybe near to infinite.
- Default: 0.0
- Min value: unknown, maybe near to -infinite
- Max value: unknown, maybe near to infinite.
- Default: 30
- Min value: 3.
- Max value: 65535.
A HomeKit Dimmable Lightbulb with auto-dimmer managed by external switches/buttons. It can be Single Color, 2-channels selectable temperature color, RGB or RGBW. Hardware must be PWM controlled. Max total channels are 8.
To activate it, ensure that light is on. Then, toggle twice switch or double press button. To stop, press it again once.
-
"r": Red channel.
-
"g": Green channel.
-
"v": Blue channel.
-
"w": White channel.
-
Single color: declare only "w".
-
2-channels selectable temperature color: declare "v" for cool white and "w" for warm white.
-
RGB: declare "r", "g" and "v" for Red, Green and Blue colors.
-
RGBW: declare "r", "g", "v" and "w" for Red, Green, Blue and White colors.
RGBW Factor: Define the factor to be applied to the color target value. You can use 2 decimals if you need:
-
Default: 1
-
Min value: 0.01
-
Max value: unknown, maybe near to infinite.
-
"fr": Red factor.
-
"fg": Green factor.
-
"fv": Blue factor.
-
"fw": White factor.
- Default: 1024.
- Min value: 1.
- Max value: 65535.
- Default: 1.0
- Min value: 0.01
- Max value: 65.5
Setting it to 0 will disable autodimmer.
- Default: 10.
- Min value: 0.
- Max value: 50.
- "0": OFF.
- "1": ON.
- 0: Default. OFF.
- 1: ON.
- 0: Default. OFF.
- 1: ON.
- 4: Defined by fixed inputs.
- 5: Last state.
- 6: Opposite to last state.
"b": Array of buttons (or any binary inputs) attached to the lightbulb. See buttons declarations.
"f0", "f1" ...: Arrays of buttons (or any binary inputs) attached to a specific status. See buttons declarations.
- "f0": Turns off lightbulb.
- "f1": Turns on lightbulb.
- "f2": Increase brightness by 10%.
- "f3": Decrease brightness by 10%.
A HomeKit Garage Door accessory. This can be used to manage your actual garage door driver, or be a stand-alone fully working driver.
If you don't use any sensor, or use only one, working time will be used to determine door state. If you use both sensors (for open and close: "f2" to "f5"), working time will be used as security measure alerting like a obstruction is detected if door does not complete operation before working time.
When an obstruction is detected, door stops and can not be operated until obstruction is removed.
- Default: 30.
- Min: 1.
- Max value: unknown, maybe near to infinite.
- "0": Door is opened and receives closing order.
- "1": Door is closed and receives opening order.
- "2": Door is opening and receives closing order.
- "3": Door is closing and receives opening order.
- "4": Sensor detects opened door.
- "5": Sensor detects closed door.
- "6": Sensor detects opening door.
- "7": Sensor detects closing door.
- "8": Obstruction not detected.
- "9": Obstruction detected.
- "10": Emergency stop.
- 0: Default. Open.
- 1: Close.
- 2: Emergency stop.
- 3: Obstruction removed.
- 4: Obstruction detected.
- 0: Opened.
- 1: Default. Closed.
- 5: Last state.
- 6: Opposite to last state.
"f0", "f1" ...: Arrays of buttons, sensors or any binary inputs attached to a specific status. See buttons declarations.
- "f0": Set garage door to open.
- "f1": Set garage door to close.
- "f2": Indicates that garage door is opened.
- "f3": Indicates that garage door is closed.
- "f4": Indicates that garage door is opening.
- "f5": Indicates that garage door is closing.
- "f6": Indicates that there is not obstruction.
- "f7": Indicates that there is obstruction.
- "f8": Emergency stop.
"b": Array of buttons (or any binary inputs) attached to the garage door to open and close it. See buttons declarations.
Home Accessory Architect
Home Accessory
Installation
Setup Mode
HAA Home Manager App
Configuration
About
General
| GPIOs Configuration
Accessory
| Actions
Service Types
Air Quality
Battery
Data History
Fan
Free Monitor
Garage Door
HAA iAirZoning
Heater Cooler
Humidifier
Light Sensor
Lightbulb
Lock Mechanism
Sensors
Power Monitor
Security System
Stateless Button & Doorbell
Switch & Outlet
Temperature & Humidity
TV
Water Valve
Window Covering