Показаны различия между двумя версиями страницы.
Предыдущая версия справа и слева Предыдущая версия Следующая версия | Предыдущая версия Следующая версия Следующая версия справа и слева | ||
конфигурирование [2021/09/25 04:07] 176.31.125.95 старая версия восстановлена (2021/05/06 22:26) |
конфигурирование [2022/06/28 21:38] prizzrak14 |
||
---|---|---|---|
Строка 1: | Строка 1: | ||
- | # Boot sequence: | + | ==== Boot sequence: |
- | * Trying to load JSON config from NVRAM. If config is valid JSON structure - start to operating (to avoid dependance from network and allow local control) | + | |
- | * Trying to retrieve MAC address, stored in NVRAM. If ok - using retrieved MAC. If not - using CUSTOM_FIRMWARE_MAC (see compilers directives). If not configured - using hardcoded DEFAULT_FIRMWARE_MAC = {0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0} | + | * Trying to retrieve MAC address, stored in NVRAM. If ok - using retrieved MAC. If not - using CUSTOM_FIRMWARE_MAC (see compilers directives). If not configured - using hardcoded DEFAULT_FIRMWARE_MAC = {0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0} |
- | * Starting LAN with DHCP or with static ip if configured | + | * Starting LAN with DHCP or with static ip if configured |
- | * Trying to load JSON config from address " | + | * Trying to load JSON config from address " |
- | * After parsing of loaded config, performing re-initialization of objects, except number of DMX channels. There is possible to store loaded config in NVRAM after some testing using " | + | * After parsing of loaded config, performing re-initialization of objects, except number of DMX channels. There is possible to store loaded config in NVRAM after some testing using " |
- | * Connecting to MQTT server according stored or retrieved config. | + | * Connecting to MQTT server according stored or retrieved config. |
- | * Subscribing to OUTTOPIC (/ | + | * Subscribing to OUTTOPIC (/ |
- | * Unsubscribe from OUTTOPIC, Subscribe for INTOPIC (/ | + | * Unsubscribe from OUTTOPIC, Subscribe for INTOPIC (/ |
- | # Operation | + | ==== Operation |
During normal operation, controller: | During normal operation, controller: | ||
- | * Accepting incoming MQTT message flow and retrieving item name from topic name. For example, / | + | |
- | * Controlling items. | + | * Controlling items. |
- | * Most commands, accepted on INTOPIC passed throw to OUTTOPIC after interpretation. Interpretation is converting of high level commands like ON OFF HALT REST to low-level commands with real values. OUTTOPIC publishing uses " | + | * Most commands, accepted on INTOPIC passed throw to OUTTOPIC after interpretation. Interpretation is converting of high level commands like ON OFF HALT REST to low-level commands with real values. OUTTOPIC publishing uses " |
- | * Polling: Normally, Modbus devices and 1-wire thermometers are polled with reasonable interval. Retrieved values are publishing to OUTTOPIC | + | * Polling: Normally, Modbus devices and 1-wire thermometers are polled with reasonable interval. Retrieved values are publishing to OUTTOPIC |
- | # Useful CLI commands: | + | ==== Useful CLI commands: |
- | * mac 11: | + | |
- | * save - writing currently loaded config from RAM to NVRAM | + | * save - writing currently loaded config from RAM to NVRAM |
- | * get < | + | * get < |
- | * ip [ip[ dns[ gw[ subnet]]]] - configure and save to NVRAM static ip. if no parameters - DHCP will be used | + | * ip [ip[ dns[ gw[ subnet]]]] - configure and save to NVRAM static ip. if no parameters - DHCP will be used |
- | * load - load config from NVRAM | + | * load - load config from NVRAM |
- | * kill - test watchdog timer (normally, causes reboot) | + | * kill - test watchdog timer (normally, causes reboot) |
CLI commands must be send via serial port with 115200 baud rate / 8N1 params: 8 data bits, no parity bit, 1 stop bit. | CLI commands must be send via serial port with 115200 baud rate / 8N1 params: 8 data bits, no parity bit, 1 stop bit. | ||
Example via shell: | Example via shell: | ||
- | ``` | + | < |
> stty -f / | > stty -f / | ||
> echo " | > echo " | ||
> cat / | > cat / | ||
- | ``` | + | </ |
Same can be done via GUI e.g. from Arduino IDE (serial monitor). Serial port must be configured (MacOSX config file ~/ | Same can be done via GUI e.g. from Arduino IDE (serial monitor). Serial port must be configured (MacOSX config file ~/ | ||
- | ``` | + | < |
serial.databits=8 | serial.databits=8 | ||
serial.stopbits=1 | serial.stopbits=1 | ||
Строка 43: | Строка 43: | ||
serial.debug_rate=115200 | serial.debug_rate=115200 | ||
serial.line_ending=1 | serial.line_ending=1 | ||
- | ``` | + | </ |
The example of config files you can find in config folder | The example of config files you can find in config folder | ||
Строка 49: | Строка 49: | ||
Below is brief explanation of basic configuration values: | Below is brief explanation of basic configuration values: | ||
- | ``` | + | < |
{ | { | ||
" | " | ||
Строка 59: | Строка 59: | ||
}, | }, | ||
- | ``` | + | </ |
// Every Lighthub' | // Every Lighthub' | ||
// item is accessible via mqtt bus as / | // item is accessible via mqtt bus as / | ||
- | ``` | + | < |
#define I_TYPE 0 //Type of item | #define I_TYPE 0 //Type of item | ||
#define I_ARG 1 // | #define I_ARG 1 // | ||
Строка 70: | Строка 69: | ||
#define I_CMD 3 //Latest CMD received | #define I_CMD 3 //Latest CMD received | ||
#define I_EXT 4 // | #define I_EXT 4 // | ||
- | ``` | + | </ |
There are two mandatory elements in item's array: type and address | There are two mandatory elements in item's array: type and address | ||
1-st element of array is item type | 1-st element of array is item type | ||
Строка 76: | Строка 75: | ||
# Item types: | # Item types: | ||
^# of type ^ ID ^ Note ^ Parameters ^ | ^# of type ^ ID ^ Note ^ Parameters ^ | ||
- | |0| CH_DIMMER|DMX out 1 ch|| | + | |0| DIMMER|DMX out 1 ch|| |
- | |1| CH_RGBW | + | |1| RGBW |DMX out 4 ch|| |
- | |2| CH_RGB | + | |2| RGB |DMX out 3 ch|| |
- | |3| CH_PWM | + | |3| PWM |PWM output directly to PIN|| |
- | |4| CH_MODBUS|Modbus AC Dimmer|| | + | |4| MODBUS|Modbus AC Dimmer|| |
- | |5| CH_THERMO|Simple ON/OFF thermostat|| | + | |5| THERMO|Simple ON/OFF thermostat|| |
- | |6| CH_RELAY | + | |6| RELAY |ON_OFF relay output|| |
- | |7| CH_GROUP | + | |7| GROUP |Group pseudochannel|| |
- | |8| CH_VCTEMP|Vacom PID thermo - regulator (Ventilation set)|| | + | |8| VCTEMP|Vacom PID thermo - regulator (Ventilation set)|| |
- | |9| CH_VC | + | |9| VC |
- | |10| CH_AC 10|Air Conditioner Haier|| | + | |10|AC 10|Air Conditioner Haier|| |
- | |11| CH_SPILED | + | |11|SPILED |
- | |12| CH_MOTOR | + | |12|MOTOR |Motorized air gateway|| |
- | |13| CH_PID | + | |13|PID |PID regulator|| |
- | |14| CH_MBUS | + | |14|MBUS |
- | |18| CH_MULTIVENT | + | |18|MULTIVENT |
- | Address is channel depended. Pin# for relay, DMX address for DMX-512 channel, array for Modbus channel | + | Address is channel depended. Pin# for relay, DMX address for DMX-512 channel, array for Modbus channel. |
+ | In case of DMX item note that addressees are continuous numbering between decoders and start address of each decoders configurable by jumpers. E.g. if you have two 24-ch decoders and want to control all 48 channels then you must set address " | ||
- | ``` | + | < |
- | " | + | " |
// Example of array | // Example of array | ||
" | " | ||
Строка 116: | Строка 116: | ||
" | " | ||
}, | }, | ||
- | ``` | + | </ |
- | # Inputs configuration chapter | + | ===== Inputs configuration chapter |
- | ``` | + | < |
// " | // " | ||
// " | // " | ||
Строка 154: | Строка 154: | ||
} | } | ||
} | } | ||
- | ``` | + | </ |
- | # Modbus channel | + | ==== Modbus channel |
Currently, Lighthub working with Vacom 10 frequency driver (from Danfos) via Modbus RTU and allows control frequency (item type = 9) and internal PID controller | Currently, Lighthub working with Vacom 10 frequency driver (from Danfos) via Modbus RTU and allows control frequency (item type = 9) and internal PID controller | ||
Строка 164: | Строка 164: | ||
Config example (refer https:// | Config example (refer https:// | ||
- | ``` | + | < |
{ | { | ||
" | " | ||
Строка 171: | Строка 171: | ||
" | " | ||
} | } | ||
- | ``` | + | </ |
Note: this config example available at URL http:// | Note: this config example available at URL http:// | ||
Строка 177: | Строка 177: | ||
Item notation: | Item notation: | ||
- | * 4 - Modbus dimmer item type | + | |
- | + | * Param1: = 96 - Decimal address of modbus device | |
- | * Param1: = 96 - Decimal address of modbus device | + | * Param2: = 0 - Modbus register to write (and read while polling) |
- | * Param2: = 0 - Modbus register to write (and read while polling) | + | * Param3: = 0 - mask (optional. Default value “-1” |
- | * Param3: = 0 - mask (optional. Default value “-1” | + | * Param4:= 255 - Maximum Value for scaling MQTT input value = 100 to register value (Optional. Default MaxValue 0x3f. It is equivalent of “100" |
- | * Param4:= 255 - Maximum Value for scaling MQTT input value = 100 to register value (Optional. Default MaxValue 0x3f. It is equivalent of “100" | + | |
Mask: | Mask: |