Skip to content

Migration Guide for HAA V12 Merlin

José Antonio Jiménez Campos edited this page Apr 22, 2023 · 36 revisions

HAA V12 Merlin has some breaking changes from v12 Peregrine. These changes are mainly about GPIO definitions, meaning that scripts must be adapted to be compatible with new version.

GPIO Configuration

Before, GPIOs configurations were taken directly from different parts of the script. Configurations about INPUT, OUTPUT, OPENDRAIN, PULL-UP, PWM, initial state, etc. Now, there is an unique section to do this, avoiding duplicity and confusions.

Since v12, GPIO declarations must be in an array "io":[...] into configuration "c":{...} section.

See GPIOs Configuration details.

Binary Outputs

Declarations of type "r":[{...}] into actions, that set a GPIO LOW or HIGH, to activate a relay, or a LED, for example, uses GPIO that must be declared into "io":[...] as Output.

Example 1:

"r":[{"g":12}] will need the following declaration into "io":

"io":[
  [ [ 12 ], 2 ]
]

Example 2:

"r":[{"g":12},{"g":13,"v":1}] will need the following declaration into "io". Note that GPIOs 12 and 13 has same configuration:

"io":[
  [ [ 12, 13 ], 2 ]
]

Example 3:

"r":[{"g":5,"n":1}] and other action with "r":[{"g":4,"v":1}] will need the following declaration into "io".

"n":1 used to set GPIO 5 to HIGH must be removed, because initial state now is declared in "io":

"io":[
  [ [ 5 ], 2, 0, 1 ],
  [ [ 4 ], 2 ]
]

Buttons/Switches

TO-DO

PWM

TO-DO

NRZ

Lightbulb Service using NRZ protocol uses a GPIO declared in "g":[...] array. This GPIO must be declared as output into "io":[...] array.

Example 1:

A Lightbulb Service {"t":30,"ty":8,"g":[5,1,6]} needs the following declaration into "io", declaring GPIO 5 as output:

"io":[
  [ [ 5 ], 2 ]
]

Binary Inputs

Some Services use special drivers with GPIO, and now they need to declare them into "io":[...] array.

Power Measure Service with HLW8012/BL0937

"dt" : [ CF, CF1, Sel ]: Power Measure service with "n":1 or "n":2 needs to declare used CF and CF1 GPIOs as Input into "io":[...] array, and Sel GPIO as Output. See GPIOs Configuration

For example:

"dt" : [ 12, 13, 15 ] will need:

"io":[
  [ [ 12, 13 ], 1 ],
  [ [ 15 ], 2 ]
]

Free Monitor Service with Pulse

GPIOs from "g" : [ GPIO, Type, Pull-up, Trigger GPIO ] must be declared into "io":array.

Because Pull-up is declared into "io" array, it must be removed from "g":[...] array from Free Monitor, because in v12, declaration is "g" : [ GPIO, Type, Trigger GPIO ].

GPIO must be Input. If Pull-up is missing or 0, remove it from following declaration: [ [ GPIO ], 1, Pull-up ]

Trigger GPIO must be Output: [ [ Trigger GPIO ], 2 ]

For example:

"g" : [ 12, 1, 1, 16 ] will be "g" : [ 12, 1, 16 ], and needs:

"io":[
  [ [ 12 ], 1, 1],
  [ [ 16 ], 2 ]
]

Logs

In V12 Merlin, there are more log types to allow use of ESP32 UART2. Then, some old log types have a different value that must be modified as follow:

v11 v12
"o":3 "o":4
"o":4 "o":5
"o":5 "o":6
"o":6 "o":8
"o":7 "o":9
"o":8 "o":10

UART

UART Logs

If UART logs are enabled in configuration section, like "o":1, in V12 Merlin it is needed to activate UART explicitly with an UART declaration.

Example 1:

A "c":{"o":1, ...} setting will be:

"c":{"o":1, "r":[{"n":0}], ...}

Example 2:

A "c":{"o":2, ...} setting will be:

"c":{"o":2, "r":[{"n":1}], ...}

Free Monitor UART Receiver

Free Monitor Service using UART Receiver must activate receiver mode in UART configuration.

To activate UART receiver mode, simply change UART number "n": from "r":[{...}] UART configuration array according to this table:

v11 v12
"n":0 "n":10
"n":2 "n":12
Clone this wiki locally