Fork of the espurna firmware for `mhsw` switches
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

1776 lines
60 KiB

8 years ago
8 years ago
6 years ago
7 years ago
7 years ago
7 years ago
8 years ago
8 years ago
6 years ago
6 years ago
6 years ago
8 years ago
8 years ago
6 years ago
6 years ago
6 years ago
6 years ago
8 years ago
6 years ago
  1. //------------------------------------------------------------------------------
  2. // Do not change this file unless you know what you are doing
  3. // To override user configuration, please see custom.h
  4. //------------------------------------------------------------------------------
  5. #pragma once
  6. //------------------------------------------------------------------------------
  7. // GENERAL
  8. //------------------------------------------------------------------------------
  9. #ifndef DEVICE_NAME
  10. #define DEVICE_NAME MANUFACTURER "_" DEVICE // Concatenate both to get a unique device name
  11. #endif
  12. // When defined, ADMIN_PASS must be 8..63 printable ASCII characters. See:
  13. // https://en.wikipedia.org/wiki/Wi-Fi_Protected_Access#Target_users_(authentication_key_distribution)
  14. // https://github.com/xoseperez/espurna/issues/1151
  15. #ifndef ADMIN_PASS
  16. #define ADMIN_PASS "fibonacci" // Default password (WEB, OTA, WIFI SoftAP)
  17. #endif
  18. #ifndef USE_PASSWORD
  19. #define USE_PASSWORD 1 // Insecurity caution! Disabling this will disable password querying completely.
  20. #endif
  21. #ifndef LOOP_DELAY_TIME
  22. #define LOOP_DELAY_TIME 10 // Delay for the main loop, in millis [0-250]
  23. // Recommended minimum is 10, see:
  24. // https://github.com/xoseperez/espurna/issues/1541
  25. // https://github.com/xoseperez/espurna/issues/1631
  26. // https://github.com/esp8266/Arduino/issues/5825
  27. #endif
  28. //------------------------------------------------------------------------------
  29. // DEBUG
  30. //------------------------------------------------------------------------------
  31. #ifndef DEBUG_LOG_MODE
  32. #define DEBUG_LOG_MODE DebugLogMode::Enabled // Set global logger mode. One of:
  33. // ::Enabled, ::Disabled or ::SkipBoot
  34. #endif
  35. // Serial debug log
  36. #ifndef DEBUG_SERIAL_SUPPORT
  37. #define DEBUG_SERIAL_SUPPORT 1 // Enable serial debug log
  38. #endif
  39. #ifndef DEBUG_PORT
  40. #define DEBUG_PORT Serial // Default debugging port
  41. #endif
  42. #ifndef SERIAL_BAUDRATE
  43. #define SERIAL_BAUDRATE 115200 // Default baudrate
  44. #endif
  45. #ifndef DEBUG_ADD_TIMESTAMP
  46. #define DEBUG_ADD_TIMESTAMP 1 // Add timestamp to debug messages
  47. // (in millis overflowing every 1000 seconds)
  48. #endif
  49. // Second serial port (used for RX)
  50. #ifndef SERIAL_RX_ENABLED
  51. #define SERIAL_RX_ENABLED 0 // Secondary serial port for RX
  52. #endif
  53. #ifndef SERIAL_RX_PORT
  54. #define SERIAL_RX_PORT Serial // This setting is usually defined
  55. // in the hardware.h file for those
  56. // boards that require it
  57. #endif
  58. #ifndef SERIAL_RX_BAUDRATE
  59. #define SERIAL_RX_BAUDRATE 115200 // Default baudrate
  60. #endif
  61. //------------------------------------------------------------------------------
  62. // UDP debug log
  63. // To receive the message son the destination computer use nc:
  64. // nc -ul 8113
  65. #ifndef DEBUG_UDP_SUPPORT
  66. #define DEBUG_UDP_SUPPORT 0 // Enable UDP debug log
  67. #endif
  68. #ifndef DEBUG_UDP_IP
  69. #define DEBUG_UDP_IP IPAddress(192, 168, 1, 100)
  70. #endif
  71. #ifndef DEBUG_UDP_PORT
  72. #define DEBUG_UDP_PORT 514
  73. #endif
  74. // If DEBUG_UDP_PORT is set to 514 syslog format is assumed
  75. // (https://tools.ietf.org/html/rfc3164)
  76. // DEBUG_UDP_FAC_PRI is the facility+priority
  77. #define DEBUG_UDP_FAC_PRI (SYSLOG_LOCAL0 | SYSLOG_DEBUG)
  78. //------------------------------------------------------------------------------
  79. #ifndef DEBUG_TELNET_SUPPORT
  80. #define DEBUG_TELNET_SUPPORT 1 // Enable telnet debug log (will only work if TELNET_SUPPORT is also 1)
  81. #endif
  82. //------------------------------------------------------------------------------
  83. #ifndef DEBUG_WEB_SUPPORT
  84. #define DEBUG_WEB_SUPPORT 1 // Enable web debug log (will only work if WEB_SUPPORT is also 1)
  85. #endif
  86. //------------------------------------------------------------------------------
  87. #ifndef DEBUG_LOG_BUFFER_SUPPORT
  88. #define DEBUG_LOG_BUFFER_SUPPORT 1 // Support boot log buffer (1.2Kb)
  89. // Will only work if DEBUG_LOG_BUFFER_ENABLED or runtime setting is also 1
  90. #endif
  91. #ifndef DEBUG_LOG_BUFFER_ENABLED
  92. #define DEBUG_LOG_BUFFER_ENABLED 0 // Disable boot log buffer by default
  93. #endif
  94. #ifndef DEBUG_LOG_BUFFER_SIZE
  95. #define DEBUG_LOG_BUFFER_SIZE 4096 // Store 4 Kb of log strings
  96. // WARNING! Memory is only reclaimed after `debug.buffer` prints the buffer contents
  97. #endif
  98. //------------------------------------------------------------------------------
  99. // TELNET
  100. //------------------------------------------------------------------------------
  101. #ifndef TELNET_SUPPORT
  102. #define TELNET_SUPPORT 1 // Enable telnet support by default (3.34Kb)
  103. #endif
  104. #ifndef TELNET_STA
  105. #define TELNET_STA 0 // By default, disallow connections via STA interface
  106. #endif
  107. #ifndef TELNET_AUTHENTICATION
  108. #define TELNET_AUTHENTICATION 1 // Request password to start telnet session by default
  109. #endif
  110. #ifndef TELNET_PORT
  111. #define TELNET_PORT 23 // Port to listen to telnet clients
  112. #endif
  113. #ifndef TELNET_MAX_CLIENTS
  114. #define TELNET_MAX_CLIENTS 1 // Max number of concurrent telnet clients
  115. #endif
  116. #ifndef TELNET_SERVER
  117. #define TELNET_SERVER TELNET_SERVER_ASYNC // Can be either TELNET_SERVER_ASYNC (using ESPAsyncTCP) or TELNET_SERVER_WIFISERVER (using WiFiServer)
  118. #endif
  119. #ifndef TELNET_SERVER_ASYNC_BUFFERED
  120. #define TELNET_SERVER_ASYNC_BUFFERED 0 // Enable buffered output for telnet server (+1Kb)
  121. // Helps to avoid lost data with lwip2 TCP_MSS=536 option
  122. #endif
  123. // Enable this flag to add support for reverse telnet (+800 bytes)
  124. // This is useful to telnet to a device behind a NAT or firewall
  125. // To use this feature, start a listen server on a publicly reachable host with e.g. "ncat -vlp <port>" and use the MQTT reverse telnet command to connect
  126. #ifndef TELNET_REVERSE_SUPPORT
  127. #define TELNET_REVERSE_SUPPORT 0
  128. #endif
  129. //------------------------------------------------------------------------------
  130. // TERMINAL
  131. //------------------------------------------------------------------------------
  132. #ifndef TERMINAL_SUPPORT
  133. #define TERMINAL_SUPPORT 1 // Enable terminal commands (0.97Kb)
  134. #endif
  135. #define TERMINAL_BUFFER_SIZE 128 // Max size for commands commands
  136. //------------------------------------------------------------------------------
  137. // SYSTEM CHECK
  138. //------------------------------------------------------------------------------
  139. #ifndef SYSTEM_CHECK_ENABLED
  140. #define SYSTEM_CHECK_ENABLED 1 // Enable crash check by default
  141. #endif
  142. #ifndef SYSTEM_CHECK_TIME
  143. #define SYSTEM_CHECK_TIME 60000 // The system is considered stable after these many millis
  144. #endif
  145. #ifndef SYSTEM_CHECK_MAX
  146. #define SYSTEM_CHECK_MAX 5 // After this many crashes on boot
  147. // the system is flagged as unstable
  148. #endif
  149. //------------------------------------------------------------------------------
  150. // EEPROM
  151. //------------------------------------------------------------------------------
  152. #define EEPROM_SIZE SPI_FLASH_SEC_SIZE // EEPROM size in bytes (1 sector = 4096 bytes)
  153. //#define EEPROM_RORATE_SECTORS 2 // Number of sectors to use for EEPROM rotation
  154. // If not defined the firmware will use a number based
  155. // on the number of available sectors
  156. #define EEPROM_RELAY_STATUS 0 // Address for the relay status (1 byte)
  157. #define EEPROM_ENERGY_COUNT 1 // Address for the energy counter (4 bytes)
  158. #define EEPROM_CUSTOM_RESET 5 // Address for the reset reason (1 byte)
  159. #define EEPROM_CRASH_COUNTER 6 // Address for the crash counter (1 byte)
  160. #define EEPROM_MESSAGE_ID 7 // Address for the MQTT message id (4 bytes)
  161. #define EEPROM_ROTATE_DATA 11 // Reserved for the EEPROM_ROTATE library (3 bytes)
  162. #define EEPROM_DATA_END 14 // End of custom EEPROM data block
  163. #ifndef SAVE_CRASH_ENABLED
  164. #define SAVE_CRASH_ENABLED 1 // Save stack trace to EEPROM by default
  165. // Depends on DEBUG_SUPPORT == 1
  166. #endif
  167. #ifndef SAVE_CRASH_STACK_TRACE_MAX
  168. #define SAVE_CRASH_STACK_TRACE_MAX 0x80 // limit at 128 bytes (increment/decrement by 16)
  169. #endif
  170. //------------------------------------------------------------------------------
  171. // THERMOSTAT
  172. //------------------------------------------------------------------------------
  173. #ifndef THERMOSTAT_SUPPORT
  174. #define THERMOSTAT_SUPPORT 0
  175. #endif
  176. #ifndef THERMOSTAT_DISPLAY_SUPPORT
  177. #define THERMOSTAT_DISPLAY_SUPPORT 0
  178. #endif
  179. #ifndef THERMOSTAT_DISPLAY_OFF_INTERVAL // Interval in seconds after which display will be switched off
  180. #define THERMOSTAT_DISPLAY_OFF_INTERVAL 0 // This will prevent it from burnout
  181. #endif // 0 - newer switch display off
  182. #define THERMOSTAT_SERVER_LOST_INTERVAL 120000 //server means lost after 2 min from last response
  183. #define THERMOSTAT_REMOTE_TEMP_MAX_WAIT 120 // 2 min
  184. #ifndef THERMOSTAT_REMOTE_SENSOR_NAME
  185. #define THERMOSTAT_REMOTE_SENSOR_NAME "" // Get remote temp(hum) from mqtt topic of this device
  186. #endif
  187. //------------------------------------------------------------------------------
  188. // HEARTBEAT
  189. //------------------------------------------------------------------------------
  190. #define HEARTBEAT_NONE 0 // Never send heartbeat
  191. #define HEARTBEAT_ONCE 1 // Send it only once upon MQTT connection
  192. #define HEARTBEAT_REPEAT 2 // Send it upon MQTT connection and every HEARTBEAT_INTERVAL
  193. #define HEARTBEAT_REPEAT_STATUS 3 // Send it upon MQTT connection and every HEARTBEAT_INTERVAL only STATUS report
  194. // Backwards compatibility check
  195. #if defined(HEARTBEAT_ENABLED) && (HEARTBEAT_ENABLED == 0)
  196. #define HEARTBEAT_MODE HEARTBEAT_NONE
  197. #endif
  198. #ifndef HEARTBEAT_MODE
  199. #define HEARTBEAT_MODE HEARTBEAT_REPEAT
  200. #endif
  201. #ifndef HEARTBEAT_INTERVAL
  202. #define HEARTBEAT_INTERVAL 300UL // Interval between heartbeat messages (in sec)
  203. #endif
  204. #define UPTIME_OVERFLOW 4294967295UL // Uptime overflow value
  205. // Values that will be reported in heartbeat
  206. #ifndef HEARTBEAT_REPORT_STATUS
  207. #define HEARTBEAT_REPORT_STATUS 1
  208. #endif
  209. #ifndef HEARTBEAT_REPORT_SSID
  210. #define HEARTBEAT_REPORT_SSID 1
  211. #endif
  212. #ifndef HEARTBEAT_REPORT_IP
  213. #define HEARTBEAT_REPORT_IP 1
  214. #endif
  215. #ifndef HEARTBEAT_REPORT_MAC
  216. #define HEARTBEAT_REPORT_MAC 1
  217. #endif
  218. #ifndef HEARTBEAT_REPORT_RSSI
  219. #define HEARTBEAT_REPORT_RSSI 1
  220. #endif
  221. #ifndef HEARTBEAT_REPORT_UPTIME
  222. #define HEARTBEAT_REPORT_UPTIME 1
  223. #endif
  224. #ifndef HEARTBEAT_REPORT_DATETIME
  225. #define HEARTBEAT_REPORT_DATETIME 1
  226. #endif
  227. #ifndef HEARTBEAT_REPORT_FREEHEAP
  228. #define HEARTBEAT_REPORT_FREEHEAP 1
  229. #endif
  230. #ifndef HEARTBEAT_REPORT_VCC
  231. #define HEARTBEAT_REPORT_VCC 1
  232. #endif
  233. #ifndef HEARTBEAT_REPORT_RELAY
  234. #define HEARTBEAT_REPORT_RELAY 1
  235. #endif
  236. #ifndef HEARTBEAT_REPORT_LIGHT
  237. #define HEARTBEAT_REPORT_LIGHT 1
  238. #endif
  239. #ifndef HEARTBEAT_REPORT_HOSTNAME
  240. #define HEARTBEAT_REPORT_HOSTNAME 1
  241. #endif
  242. #ifndef HEARTBEAT_REPORT_DESCRIPTION
  243. #define HEARTBEAT_REPORT_DESCRIPTION 1
  244. #endif
  245. #ifndef HEARTBEAT_REPORT_APP
  246. #define HEARTBEAT_REPORT_APP 1
  247. #endif
  248. #ifndef HEARTBEAT_REPORT_VERSION
  249. #define HEARTBEAT_REPORT_VERSION 1
  250. #endif
  251. #ifndef HEARTBEAT_REPORT_BOARD
  252. #define HEARTBEAT_REPORT_BOARD 1
  253. #endif
  254. #ifndef HEARTBEAT_REPORT_LOADAVG
  255. #define HEARTBEAT_REPORT_LOADAVG 1
  256. #endif
  257. #ifndef HEARTBEAT_REPORT_INTERVAL
  258. #define HEARTBEAT_REPORT_INTERVAL 0
  259. #endif
  260. #ifndef HEARTBEAT_REPORT_RANGE
  261. #define HEARTBEAT_REPORT_RANGE THERMOSTAT_SUPPORT
  262. #endif
  263. #ifndef HEARTBEAT_REPORT_REMOTE_TEMP
  264. #define HEARTBEAT_REPORT_REMOTE_TEMP THERMOSTAT_SUPPORT
  265. #endif
  266. #ifndef HEARTBEAT_REPORT_BSSID
  267. #define HEARTBEAT_REPORT_BSSID 0
  268. #endif
  269. //------------------------------------------------------------------------------
  270. // Load average
  271. //------------------------------------------------------------------------------
  272. #ifndef LOADAVG_INTERVAL
  273. #define LOADAVG_INTERVAL 30000 // Interval between calculating load average (in ms)
  274. #endif
  275. //------------------------------------------------------------------------------
  276. // BUTTON
  277. //------------------------------------------------------------------------------
  278. #ifndef BUTTON_SUPPORT
  279. #define BUTTON_SUPPORT 1
  280. #endif
  281. #ifndef BUTTON_DEBOUNCE_DELAY
  282. #define BUTTON_DEBOUNCE_DELAY 50 // Debounce delay (ms)
  283. #endif
  284. #ifndef BUTTON_REPEAT_DELAY
  285. #define BUTTON_REPEAT_DELAY 500 // Time in ms to wait for a second (or third...) click
  286. #endif
  287. #ifndef BUTTON_LNGCLICK_DELAY
  288. #define BUTTON_LNGCLICK_DELAY 1000 // Time in ms holding the button down to get a long click
  289. #endif
  290. #ifndef BUTTON_LNGLNGCLICK_DELAY
  291. #define BUTTON_LNGLNGCLICK_DELAY 10000 // Time in ms holding the button down to get a long-long click
  292. #endif
  293. #ifndef BUTTON_MQTT_SEND_ALL_EVENTS
  294. #define BUTTON_MQTT_SEND_ALL_EVENTS 0 // 0 - to send only events the are bound to actions
  295. // 1 - to send all button events to MQTT
  296. #endif
  297. #ifndef BUTTON_MQTT_RETAIN
  298. #define BUTTON_MQTT_RETAIN 0
  299. #endif
  300. #ifndef BUTTON_EVENTS_SOURCE
  301. #define BUTTON_EVENTS_SOURCE BUTTON_EVENTS_SOURCE_GENERIC // Type of button event source. One of:
  302. // BUTTON_EVENTS_SOURCE_GENERIC - GPIOs (virtual or real)
  303. // BUTTON_EVENTS_SOURCE_SONOFF_DUAL - hardware specific, drive buttons through serial connection
  304. // BUTTON_EVENTS_SOURCE_FOXEL_LIGHTFOX_DUAL - similar to Itead Sonoff Dual, hardware specific
  305. #endif
  306. //------------------------------------------------------------------------------
  307. // ENCODER
  308. //------------------------------------------------------------------------------
  309. #ifndef ENCODER_SUPPORT
  310. #define ENCODER_SUPPORT 0
  311. #endif
  312. #ifndef ENCODER_MINIMUM_DELTA
  313. #define ENCODER_MINIMUM_DELTA 1
  314. #endif
  315. //------------------------------------------------------------------------------
  316. // LED
  317. //------------------------------------------------------------------------------
  318. #ifndef LED_SUPPORT
  319. #define LED_SUPPORT 1
  320. #endif
  321. //------------------------------------------------------------------------------
  322. // RELAY
  323. //------------------------------------------------------------------------------
  324. #ifndef RELAY_SUPPORT
  325. #define RELAY_SUPPORT 1
  326. #endif
  327. // Default boot mode: 0 means OFF, 1 ON and 2 whatever was before
  328. #ifndef RELAY_BOOT_MODE
  329. #define RELAY_BOOT_MODE RELAY_BOOT_OFF
  330. #endif
  331. // 0 means ANY, 1 zero or one and 2 one and only one
  332. #ifndef RELAY_SYNC
  333. #define RELAY_SYNC RELAY_SYNC_ANY
  334. #endif
  335. // Default pulse mode: 0 means no pulses, 1 means normally off, 2 normally on
  336. #ifndef RELAY_PULSE_MODE
  337. #define RELAY_PULSE_MODE RELAY_PULSE_NONE
  338. #endif
  339. // Default pulse time in seconds
  340. #ifndef RELAY_PULSE_TIME
  341. #define RELAY_PULSE_TIME 1.0
  342. #endif
  343. // Relay requests flood protection window - in seconds
  344. #ifndef RELAY_FLOOD_WINDOW
  345. #define RELAY_FLOOD_WINDOW 3.0
  346. #endif
  347. // Allowed actual relay changes inside requests flood protection window
  348. #ifndef RELAY_FLOOD_CHANGES
  349. #define RELAY_FLOOD_CHANGES 5
  350. #endif
  351. // Pulse with in milliseconds for a latched relay
  352. #ifndef RELAY_LATCHING_PULSE
  353. #define RELAY_LATCHING_PULSE 10
  354. #endif
  355. // Do not save relay state after these many milliseconds
  356. #ifndef RELAY_SAVE_DELAY
  357. #define RELAY_SAVE_DELAY 1000
  358. #endif
  359. #ifndef RELAY_REPORT_STATUS
  360. #define RELAY_REPORT_STATUS 1
  361. #endif
  362. // Configure the MQTT payload for ON, OFF and TOGGLE
  363. #ifndef RELAY_MQTT_OFF
  364. #define RELAY_MQTT_OFF "0"
  365. #endif
  366. #ifndef RELAY_MQTT_ON
  367. #define RELAY_MQTT_ON "1"
  368. #endif
  369. #ifndef RELAY_MQTT_TOGGLE
  370. #define RELAY_MQTT_TOGGLE "2"
  371. #endif
  372. // -----------------------------------------------------------------------------
  373. // WIFI
  374. // -----------------------------------------------------------------------------
  375. #ifndef WIFI_CONNECT_TIMEOUT
  376. #define WIFI_CONNECT_TIMEOUT 60000 // Connecting timeout for WIFI in ms
  377. #endif
  378. #ifndef WIFI_RECONNECT_INTERVAL
  379. #define WIFI_RECONNECT_INTERVAL 180000 // If could not connect to WIFI, retry after this time in ms
  380. #endif
  381. #ifndef WIFI_MAX_NETWORKS
  382. #define WIFI_MAX_NETWORKS 5 // Max number of WIFI connection configurations
  383. #endif
  384. #ifndef WIFI_AP_CAPTIVE
  385. #define WIFI_AP_CAPTIVE 1 // Captive portal enabled when in AP mode
  386. #endif
  387. #ifndef WIFI_FALLBACK_APMODE
  388. #define WIFI_FALLBACK_APMODE 1 // Fallback to AP mode if no STA connection
  389. #endif
  390. #ifndef WIFI_SLEEP_MODE
  391. #define WIFI_SLEEP_MODE WIFI_NONE_SLEEP // WIFI_NONE_SLEEP, WIFI_LIGHT_SLEEP or WIFI_MODEM_SLEEP
  392. #endif
  393. #ifndef WIFI_SCAN_NETWORKS
  394. #define WIFI_SCAN_NETWORKS 1 // Perform a network scan before connecting
  395. #endif
  396. // Optional hardcoded configuration (up to 5 networks, depending on WIFI_MAX_NETWORKS and espurna/wifi_config.h)
  397. #ifndef WIFI1_SSID
  398. #define WIFI1_SSID ""
  399. #endif
  400. #ifndef WIFI1_PASS
  401. #define WIFI1_PASS ""
  402. #endif
  403. #ifndef WIFI1_IP
  404. #define WIFI1_IP ""
  405. #endif
  406. #ifndef WIFI1_GW
  407. #define WIFI1_GW ""
  408. #endif
  409. #ifndef WIFI1_MASK
  410. #define WIFI1_MASK ""
  411. #endif
  412. #ifndef WIFI1_DNS
  413. #define WIFI1_DNS ""
  414. #endif
  415. #ifndef WIFI2_SSID
  416. #define WIFI2_SSID ""
  417. #endif
  418. #ifndef WIFI2_PASS
  419. #define WIFI2_PASS ""
  420. #endif
  421. #ifndef WIFI2_IP
  422. #define WIFI2_IP ""
  423. #endif
  424. #ifndef WIFI2_GW
  425. #define WIFI2_GW ""
  426. #endif
  427. #ifndef WIFI2_MASK
  428. #define WIFI2_MASK ""
  429. #endif
  430. #ifndef WIFI2_DNS
  431. #define WIFI2_DNS ""
  432. #endif
  433. #ifndef WIFI3_SSID
  434. #define WIFI3_SSID ""
  435. #endif
  436. #ifndef WIFI3_PASS
  437. #define WIFI3_PASS ""
  438. #endif
  439. #ifndef WIFI3_IP
  440. #define WIFI3_IP ""
  441. #endif
  442. #ifndef WIFI3_GW
  443. #define WIFI3_GW ""
  444. #endif
  445. #ifndef WIFI3_MASK
  446. #define WIFI3_MASK ""
  447. #endif
  448. #ifndef WIFI3_DNS
  449. #define WIFI3_DNS ""
  450. #endif
  451. #ifndef WIFI4_SSID
  452. #define WIFI4_SSID ""
  453. #endif
  454. #ifndef WIFI4_PASS
  455. #define WIFI4_PASS ""
  456. #endif
  457. #ifndef WIFI4_IP
  458. #define WIFI4_IP ""
  459. #endif
  460. #ifndef WIFI4_GW
  461. #define WIFI4_GW ""
  462. #endif
  463. #ifndef WIFI4_MASK
  464. #define WIFI4_MASK ""
  465. #endif
  466. #ifndef WIFI4_DNS
  467. #define WIFI4_DNS ""
  468. #endif
  469. #ifndef WIFI5_SSID
  470. #define WIFI5_SSID ""
  471. #endif
  472. #ifndef WIFI5_PASS
  473. #define WIFI5_PASS ""
  474. #endif
  475. #ifndef WIFI5_IP
  476. #define WIFI5_IP ""
  477. #endif
  478. #ifndef WIFI5_GW
  479. #define WIFI5_GW ""
  480. #endif
  481. #ifndef WIFI5_MASK
  482. #define WIFI5_MASK ""
  483. #endif
  484. #ifndef WIFI5_DNS
  485. #define WIFI5_DNS ""
  486. #endif
  487. #ifndef WIFI_RSSI_1M
  488. #define WIFI_RSSI_1M -30 // Calibrate it with your router reading the RSSI at 1m
  489. #endif
  490. #ifndef WIFI_PROPAGATION_CONST
  491. #define WIFI_PROPAGATION_CONST 4 // This is typically something between 2.7 to 4.3 (free space is 2)
  492. #endif
  493. // ref: https://docs.espressif.com/projects/esp-idf/en/latest/api-reference/kconfig.html#config-lwip-esp-gratuitous-arp
  494. // ref: https://github.com/xoseperez/espurna/pull/1877#issuecomment-525612546
  495. //
  496. // Broadcast gratuitous ARP periodically to update ARP tables on the AP and all devices on the same network.
  497. // Helps to solve compatibility issues when ESP fails to timely reply to ARP requests, causing the device's ARP table entry to expire.
  498. #ifndef WIFI_GRATUITOUS_ARP_SUPPORT
  499. #define WIFI_GRATUITOUS_ARP_SUPPORT 1
  500. #endif
  501. // Interval is randomized on each boot in range from ..._MIN to ..._MAX (ms)
  502. #ifndef WIFI_GRATUITOUS_ARP_INTERVAL_MIN
  503. #define WIFI_GRATUITOUS_ARP_INTERVAL_MIN 15000
  504. #endif
  505. #ifndef WIFI_GRATUITOUS_ARP_INTERVAL_MAX
  506. #define WIFI_GRATUITOUS_ARP_INTERVAL_MAX 30000
  507. #endif
  508. // ref: https://github.com/esp8266/Arduino/issues/6471
  509. // ref: https://github.com/esp8266/Arduino/issues/6366
  510. //
  511. // Issue #6366 turned out to be high tx power causing weird behavior. Lowering tx power achieved stability.
  512. #ifndef WIFI_OUTPUT_POWER_DBM
  513. #define WIFI_OUTPUT_POWER_DBM 20.0f
  514. #endif
  515. // -----------------------------------------------------------------------------
  516. // WEB
  517. // -----------------------------------------------------------------------------
  518. #ifndef WEB_SUPPORT
  519. #define WEB_SUPPORT 1 // Enable web support (http, api, 121.65Kb)
  520. #endif
  521. #ifndef WEB_EMBEDDED
  522. #define WEB_EMBEDDED 1 // Build the firmware with the web interface embedded in
  523. #endif
  524. // Requires ESPAsyncTCP to be built with ASYNC_TCP_SSL_ENABLED=1 and Arduino Core version >= 2.4.0
  525. // XXX: This is not working at the moment!! Pending https://github.com/me-no-dev/ESPAsyncTCP/issues/95
  526. #ifndef WEB_SSL_ENABLED
  527. #define WEB_SSL_ENABLED 0 // Use HTTPS web interface
  528. #endif
  529. #ifndef WEB_USERNAME
  530. #define WEB_USERNAME "admin" // HTTP username
  531. #endif
  532. #ifndef WEB_FORCE_PASS_CHANGE
  533. #define WEB_FORCE_PASS_CHANGE 1 // Force the user to change the password if default one
  534. #endif
  535. #ifndef WEB_PORT
  536. #define WEB_PORT 80 // HTTP port
  537. #endif
  538. // Defining a WEB_REMOTE_DOMAIN will enable Cross-Origin Resource Sharing (CORS)
  539. // so you will be able to login to this device from another domain. This will allow
  540. // you to manage all ESPurna devices in your local network from a unique installation
  541. // of the web UI. This installation could be in a local server (a Raspberry Pi, for instance)
  542. // or in the Internet. Since the WebUI is just one compressed file with HTML, CSS and JS
  543. // there are no special requirements. Any static web server will do (NGinx, Apache, Lighttpd,...).
  544. // The only requirement is that the resource must be available under this domain.
  545. #ifndef WEB_REMOTE_DOMAIN
  546. #define WEB_REMOTE_DOMAIN "http://espurna.io"
  547. #endif
  548. // -----------------------------------------------------------------------------
  549. // WEBSOCKETS
  550. // -----------------------------------------------------------------------------
  551. // This will only be enabled if WEB_SUPPORT is 1 (this is the default value)
  552. #ifndef WS_AUTHENTICATION
  553. #define WS_AUTHENTICATION 1 // WS authentication ON by default (see #507)
  554. #endif
  555. #ifndef WS_BUFFER_SIZE
  556. #define WS_BUFFER_SIZE 5 // Max number of secured websocket connections
  557. #endif
  558. #ifndef WS_TIMEOUT
  559. #define WS_TIMEOUT 1800000 // Timeout for secured websocket
  560. #endif
  561. #ifndef WS_UPDATE_INTERVAL
  562. #define WS_UPDATE_INTERVAL 30000 // Update clients every 30 seconds
  563. #endif
  564. // -----------------------------------------------------------------------------
  565. // API
  566. // -----------------------------------------------------------------------------
  567. #ifndef API_SUPPORT
  568. #define API_SUPPORT 1 // API (REST & RPC) support built in
  569. #endif
  570. // This will only be enabled if WEB_SUPPORT is 1 (this is the default value)
  571. #ifndef API_ENABLED
  572. #define API_ENABLED 0 // Do not enable API by default
  573. #endif
  574. #ifndef API_KEY
  575. #define API_KEY "" // Do not enable API by default. WebUI will automatically generate the key
  576. #endif
  577. #ifndef API_RESTFUL
  578. #define API_RESTFUL 1 // A restful API requires changes to be issued as PUT requests
  579. // Setting this to 0 will allow using GET to change relays, for instance
  580. #endif
  581. #ifndef API_BUFFER_SIZE
  582. #define API_BUFFER_SIZE 64 // Size of the buffer for HTTP GET API responses
  583. #endif
  584. #ifndef API_REAL_TIME_VALUES
  585. #define API_REAL_TIME_VALUES 0 // Show filtered/median values by default (0 => median, 1 => real time)
  586. #endif
  587. // -----------------------------------------------------------------------------
  588. // MDNS / LLMNR / NETBIOS / SSDP
  589. // -----------------------------------------------------------------------------
  590. #ifndef MDNS_SERVER_SUPPORT
  591. #define MDNS_SERVER_SUPPORT 1 // Publish services using mDNS by default (1.48Kb)
  592. #endif
  593. #ifndef MDNS_CLIENT_SUPPORT
  594. #define MDNS_CLIENT_SUPPORT 0 // Resolve mDNS names (3.44Kb)
  595. #endif
  596. #ifndef LLMNR_SUPPORT
  597. #define LLMNR_SUPPORT 0 // Publish device using LLMNR protocol by default (1.95Kb) - requires Core version >= 2.4.0
  598. #endif
  599. #ifndef NETBIOS_SUPPORT
  600. #define NETBIOS_SUPPORT 0 // Publish device using NetBIOS protocol by default (1.26Kb) - requires Core version >= 2.4.0
  601. #endif
  602. #ifndef SSDP_SUPPORT
  603. #define SSDP_SUPPORT 0 // Publish device using SSDP protocol by default (4.59Kb)
  604. // Not compatible with ALEXA_SUPPORT at the moment
  605. #endif
  606. #ifndef SSDP_DEVICE_TYPE
  607. #define SSDP_DEVICE_TYPE "upnp:rootdevice"
  608. //#define SSDP_DEVICE_TYPE "urn:schemas-upnp-org:device:BinaryLight:1"
  609. #endif
  610. // -----------------------------------------------------------------------------
  611. // SPIFFS
  612. // -----------------------------------------------------------------------------
  613. #ifndef SPIFFS_SUPPORT
  614. #define SPIFFS_SUPPORT 0 // Do not add support for SPIFFS by default
  615. #endif
  616. // -----------------------------------------------------------------------------
  617. // SSL Client ** EXPERIMENTAL **
  618. // -----------------------------------------------------------------------------
  619. #ifndef SECURE_CLIENT
  620. #define SECURE_CLIENT SECURE_CLIENT_NONE // What variant of WiFiClient to use
  621. // SECURE_CLIENT_NONE - No secure client support (default)
  622. // SECURE_CLIENT_AXTLS - axTLS client secure support (All Core versions, ONLY TLS 1.1)
  623. // SECURE_CLIENT_BEARSSL - BearSSL client secure support (starting with 2.5.0, TLS 1.2)
  624. //
  625. // axTLS marked for derecation since Arduino Core 2.4.2 and **will** be removed in the future
  626. #endif
  627. // Security check that is performed when the connection is established:
  628. // SECURE_CLIENT_CHECK_CA - Use Trust Anchor / Root Certificate
  629. // Supported only by the SECURE_CLIENT_BEARSSL
  630. // (See respective ..._SECURE_CLIENT_INCLUDE_CA options per-module)
  631. // SECURE_CLIENT_CHECK_FINGERPRINT - Check certificate fingerprint
  632. // SECURE_CLIENT_CHECK_NONE - Allow insecure connections
  633. #ifndef SECURE_CLIENT_CHECK
  634. #if SECURE_CLIENT == SECURE_CLIENT_BEARSSL
  635. #define SECURE_CLIENT_CHECK SECURE_CLIENT_CHECK_CA
  636. #else
  637. #define SECURE_CLIENT_CHECK SECURE_CLIENT_CHECK_FINGERPRINT
  638. #endif
  639. #endif // SECURE_CLIENT_CHECK
  640. // Support Maximum Fragment Length Negotiation TLS extension
  641. // "...negotiate a smaller maximum fragment length due to memory limitations or bandwidth limitations."
  642. // - https://arduino-esp8266.readthedocs.io/en/latest/esp8266wifi/bearssl-client-secure-class.html#mfln-or-maximum-fragment-length-negotiation-saving-ram
  643. // - https://tools.ietf.org/html/rfc6066#section-4
  644. #ifndef SECURE_CLIENT_MFLN
  645. #define SECURE_CLIENT_MFLN 0 // The only possible values are: 512, 1024, 2048 and 4096
  646. // Set to 0 to disable (default)
  647. #endif
  648. // -----------------------------------------------------------------------------
  649. // OTA
  650. // -----------------------------------------------------------------------------
  651. #ifndef OTA_PORT
  652. #define OTA_PORT 8266 // Port for ArduinoOTA
  653. #endif
  654. #ifndef OTA_MQTT_SUPPORT
  655. #define OTA_MQTT_SUPPORT 0 // Listen for HTTP(s) URLs at '<root topic>/ota'. Depends on OTA_CLIENT
  656. #endif
  657. #ifndef OTA_ARDUINOOTA_SUPPORT
  658. #define OTA_ARDUINOOTA_SUPPORT 1 // Support ArduinoOTA by default (4.2Kb)
  659. // Implicitly depends on ESP8266mDNS library, thus increasing firmware size
  660. #endif
  661. #ifndef OTA_CLIENT
  662. #define OTA_CLIENT OTA_CLIENT_ASYNCTCP // Terminal / MQTT OTA support
  663. // OTA_CLIENT_ASYNCTCP (ESPAsyncTCP library)
  664. // OTA_CLIENT_HTTPUPDATE (Arduino Core library)j
  665. // OTA_CLIENT_NONE to disable
  666. #endif
  667. #ifndef OTA_WEB_SUPPORT
  668. #define OTA_WEB_SUPPORT 1 // Support `/upgrade` endpoint and WebUI OTA handler
  669. #endif
  670. #define OTA_GITHUB_FP "CA:06:F5:6B:25:8B:7A:0D:4F:2B:05:47:09:39:47:86:51:15:19:84"
  671. #ifndef OTA_FINGERPRINT
  672. #define OTA_FINGERPRINT OTA_GITHUB_FP
  673. #endif
  674. #ifndef OTA_SECURE_CLIENT_CHECK
  675. #define OTA_SECURE_CLIENT_CHECK SECURE_CLIENT_CHECK
  676. #endif
  677. #ifndef OTA_SECURE_CLIENT_MFLN
  678. #define OTA_SECURE_CLIENT_MFLN SECURE_CLIENT_MFLN
  679. #endif
  680. #ifndef OTA_SECURE_CLIENT_INCLUDE_CA
  681. #define OTA_SECURE_CLIENT_INCLUDE_CA 0 // Use user-provided CA. Only PROGMEM PEM option is supported.
  682. // TODO: eventually should be replaced with pre-parsed structs, read directly from flash
  683. // (ref: https://github.com/earlephilhower/bearssl-esp8266/pull/14)
  684. //
  685. // When enabled, current implementation includes "static/ota_client_trusted_root_ca.h" with
  686. // const char _ota_client_trusted_root_ca[] PROGMEM = "...PEM data...";
  687. // By default, using DigiCert root in "static/digicert_evroot_pem.h" (for https://github.com)
  688. #endif
  689. // -----------------------------------------------------------------------------
  690. // NOFUSS
  691. // -----------------------------------------------------------------------------
  692. #ifndef NOFUSS_SUPPORT
  693. #define NOFUSS_SUPPORT 0 // Do not enable support for NoFuss by default (12.65Kb)
  694. #endif
  695. #ifndef NOFUSS_ENABLED
  696. #define NOFUSS_ENABLED 0 // Do not perform NoFUSS updates by default
  697. #endif
  698. #ifndef NOFUSS_SERVER
  699. #define NOFUSS_SERVER "" // Default NoFuss Server
  700. #endif
  701. #ifndef NOFUSS_INTERVAL
  702. #define NOFUSS_INTERVAL 3600000 // Check for updates every hour
  703. #endif
  704. // -----------------------------------------------------------------------------
  705. // UART <-> MQTT
  706. // -----------------------------------------------------------------------------
  707. #ifndef UART_MQTT_SUPPORT
  708. #define UART_MQTT_SUPPORT 0 // No support by default
  709. #endif
  710. #ifndef UART_MQTT_USE_SOFT
  711. #define UART_MQTT_USE_SOFT 0 // Use SoftwareSerial
  712. #endif
  713. #ifndef UART_MQTT_HW_PORT
  714. #define UART_MQTT_HW_PORT Serial // Hardware serial port (if UART_MQTT_USE_SOFT == 0)
  715. #endif
  716. #ifndef UART_MQTT_RX_PIN
  717. #define UART_MQTT_RX_PIN 4 // RX PIN (if UART_MQTT_USE_SOFT == 1)
  718. #endif
  719. #ifndef UART_MQTT_TX_PIN
  720. #define UART_MQTT_TX_PIN 5 // TX PIN (if UART_MQTT_USE_SOFT == 1)
  721. #endif
  722. #ifndef UART_MQTT_BAUDRATE
  723. #define UART_MQTT_BAUDRATE 115200 // Serial speed
  724. #endif
  725. #ifndef UART_MQTT_TERMINATION
  726. #define UART_MQTT_TERMINATION '\n' // Termination character
  727. #endif
  728. #define UART_MQTT_BUFFER_SIZE 100 // UART buffer size
  729. // -----------------------------------------------------------------------------
  730. // MQTT
  731. // -----------------------------------------------------------------------------
  732. #ifndef MQTT_SUPPORT
  733. #define MQTT_SUPPORT 1 // MQTT support (22.38Kb async, 12.48Kb sync)
  734. #endif
  735. #ifndef MQTT_LIBRARY
  736. #define MQTT_LIBRARY MQTT_LIBRARY_ASYNCMQTTCLIENT // MQTT_LIBRARY_ASYNCMQTTCLIENT (default, https://github.com/marvinroger/async-mqtt-client)
  737. // MQTT_LIBRARY_PUBSUBCLIENT (https://github.com/knolleary/pubsubclient)
  738. // MQTT_LIBRARY_ARDUINOMQTT (https://github.com/256dpi/arduino-mqtt)
  739. #endif
  740. // -----------------------------------------------------------------------------
  741. // MQTT OVER SSL
  742. // -----------------------------------------------------------------------------
  743. //
  744. // Requires SECURE_CLIENT set to SECURE_CLIENT_AXTLS or SECURE_CLIENT_BEARSSL
  745. // It is recommended to use MQTT_LIBRARY_ARDUINOMQTT or MQTT_LIBRARY_PUBSUBCLIENT
  746. // It is recommended to use SECURE_CLIENT_BEARSSL
  747. // It is recommended to use ESP8266 Arduino Core >= 2.5.2 with SECURE_CLIENT_BEARSSL
  748. //
  749. // Current version of MQTT_LIBRARY_ASYNCMQTTCLIENT only supports SECURE_CLIENT_AXTLS
  750. //
  751. // It is recommended to use WEB_SUPPORT=0 with either SECURE_CLIENT option, as there are miscellaneous problems when using them simultaneously
  752. // (although, things might've improved, and I'd encourage to check whether this is true or not)
  753. //
  754. // When using MQTT_LIBRARY_PUBSUBCLIENT or MQTT_LIBRARY_ARDUINOMQTT, you will have to disable every module that uses ESPAsyncTCP:
  755. // ALEXA_SUPPORT=0, INFLUXDB_SUPPORT=0, TELNET_SUPPORT=0, THINGSPEAK_SUPPORT=0, DEBUG_TELNET_SUPPORT=0 and WEB_SUPPORT=0
  756. // Or, use "sync" versions instead (note that not every module has this option):
  757. // THINGSPEAK_USE_ASYNC=0, TELNET_SERVER=TELNET_SERVER_WIFISERVER
  758. //
  759. // See SECURE_CLIENT_CHECK for all possible connection verification options.
  760. //
  761. // The simpliest way to verify SSL connection is to use fingerprinting.
  762. // For example, to get Google's MQTT server certificate fingerprint, run the following command:
  763. // $ echo -n | openssl s_client -connect mqtt.googleapis.com:8883 2>&1 | openssl x509 -noout -fingerprint -sha1 | cut -d\= -f2
  764. // Note that fingerprint will change when certificate changes e.g. LetsEncrypt renewals or when the CSR updates
  765. #ifndef MQTT_SSL_ENABLED
  766. #define MQTT_SSL_ENABLED 0 // By default MQTT over SSL will not be enabled
  767. #endif
  768. #ifndef MQTT_SSL_FINGERPRINT
  769. #define MQTT_SSL_FINGERPRINT "" // SSL fingerprint of the server
  770. #endif
  771. #ifndef MQTT_SECURE_CLIENT_CHECK
  772. #define MQTT_SECURE_CLIENT_CHECK SECURE_CLIENT_CHECK // Use global verification setting by default
  773. #endif
  774. #ifndef MQTT_SECURE_CLIENT_MFLN
  775. #define MQTT_SECURE_CLIENT_MFLN SECURE_CLIENT_MFLN // Use global MFLN setting by default
  776. #endif
  777. #ifndef MQTT_SECURE_CLIENT_INCLUDE_CA
  778. #define MQTT_SECURE_CLIENT_INCLUDE_CA 0 // Use user-provided CA. Only PROGMEM PEM option is supported.
  779. // When enabled, current implementation includes "static/mqtt_client_trusted_root_ca.h" with
  780. // const char _mqtt_client_trusted_root_ca[] PROGMEM = "...PEM data...";
  781. // By default, using LetsEncrypt X3 root in "static/letsencrypt_isrgroot_pem.h"
  782. #endif
  783. #ifndef MQTT_ENABLED
  784. #define MQTT_ENABLED 0 // Do not enable MQTT connection by default
  785. #endif
  786. #ifndef MQTT_AUTOCONNECT
  787. #define MQTT_AUTOCONNECT 1 // If enabled and MDNS_SERVER_SUPPORT=1 will perform an autodiscover and
  788. // autoconnect to the first MQTT broker found if none defined
  789. #endif
  790. #ifndef MQTT_SERVER
  791. #define MQTT_SERVER "" // Default MQTT broker address
  792. #endif
  793. #ifndef MQTT_USER
  794. #define MQTT_USER "" // Default MQTT broker usename
  795. #endif
  796. #ifndef MQTT_PASS
  797. #define MQTT_PASS "" // Default MQTT broker password
  798. #endif
  799. #ifndef MQTT_PORT
  800. #define MQTT_PORT 1883 // MQTT broker port
  801. #endif
  802. #ifndef MQTT_TOPIC
  803. #define MQTT_TOPIC "{hostname}" // Default MQTT base topic
  804. #endif
  805. #ifndef MQTT_RETAIN
  806. #define MQTT_RETAIN true // MQTT retain flag
  807. #endif
  808. #ifndef MQTT_QOS
  809. #define MQTT_QOS 0 // MQTT QoS value for all messages
  810. #endif
  811. #ifndef MQTT_KEEPALIVE
  812. #define MQTT_KEEPALIVE 120 // MQTT keepalive value
  813. #endif
  814. #ifndef MQTT_RECONNECT_DELAY_MIN
  815. #define MQTT_RECONNECT_DELAY_MIN 5000 // Try to reconnect in 5 seconds upon disconnection
  816. #endif
  817. #ifndef MQTT_RECONNECT_DELAY_STEP
  818. #define MQTT_RECONNECT_DELAY_STEP 5000 // Increase the reconnect delay in 5 seconds after each failed attempt
  819. #endif
  820. #ifndef MQTT_RECONNECT_DELAY_MAX
  821. #define MQTT_RECONNECT_DELAY_MAX 120000 // Set reconnect time to 2 minutes at most
  822. #endif
  823. #ifndef MQTT_SKIP_RETAINED
  824. #define MQTT_SKIP_RETAINED 1 // Skip retained messages on connection
  825. #endif
  826. #ifndef MQTT_SKIP_TIME
  827. #define MQTT_SKIP_TIME 1000 // Skip messages for 1 second anter connection
  828. #endif
  829. #ifndef MQTT_USE_JSON
  830. #define MQTT_USE_JSON 0 // Don't group messages in a JSON body by default
  831. #endif
  832. #ifndef MQTT_USE_JSON_DELAY
  833. #define MQTT_USE_JSON_DELAY 100 // Wait this many ms before grouping messages
  834. #endif
  835. #ifndef MQTT_QUEUE_MAX_SIZE
  836. #define MQTT_QUEUE_MAX_SIZE 20 // Size of the MQTT queue when MQTT_USE_JSON is enabled
  837. #endif
  838. #ifndef MQTT_BUFFER_MAX_SIZE
  839. #define MQTT_BUFFER_MAX_SIZE 1024 // Size of the MQTT payload buffer for MQTT_MESSAGE_EVENT. Large messages will only be available via MQTT_MESSAGE_RAW_EVENT.
  840. // Note: When using MQTT_LIBRARY_PUBSUBCLIENT, MQTT_MAX_PACKET_SIZE should not be more than this value.
  841. #endif
  842. // These are the properties that will be sent when useJson is true
  843. #ifndef MQTT_ENQUEUE_IP
  844. #define MQTT_ENQUEUE_IP 1
  845. #endif
  846. #ifndef MQTT_ENQUEUE_MAC
  847. #define MQTT_ENQUEUE_MAC 1
  848. #endif
  849. #ifndef MQTT_ENQUEUE_HOSTNAME
  850. #define MQTT_ENQUEUE_HOSTNAME 1
  851. #endif
  852. #ifndef MQTT_ENQUEUE_DATETIME
  853. #define MQTT_ENQUEUE_DATETIME 1
  854. #endif
  855. #ifndef MQTT_ENQUEUE_MESSAGE_ID
  856. #define MQTT_ENQUEUE_MESSAGE_ID 1
  857. #endif
  858. // These particles will be concatenated to the MQTT_TOPIC base to form the actual topic
  859. #define MQTT_TOPIC_JSON "data"
  860. #define MQTT_TOPIC_ACTION "action"
  861. #define MQTT_TOPIC_RELAY "relay"
  862. #define MQTT_TOPIC_LED "led"
  863. #define MQTT_TOPIC_BUTTON "button"
  864. #define MQTT_TOPIC_IP "ip"
  865. #define MQTT_TOPIC_SSID "ssid"
  866. #define MQTT_TOPIC_BSSID "bssid"
  867. #define MQTT_TOPIC_VERSION "version"
  868. #define MQTT_TOPIC_UPTIME "uptime"
  869. #define MQTT_TOPIC_DATETIME "datetime"
  870. #define MQTT_TOPIC_TIMESTAMP "timestamp"
  871. #define MQTT_TOPIC_FREEHEAP "freeheap"
  872. #define MQTT_TOPIC_VCC "vcc"
  873. #ifndef MQTT_TOPIC_STATUS
  874. #define MQTT_TOPIC_STATUS "status"
  875. #endif
  876. #define MQTT_TOPIC_MAC "mac"
  877. #define MQTT_TOPIC_RSSI "rssi"
  878. #define MQTT_TOPIC_MESSAGE_ID "id"
  879. #define MQTT_TOPIC_APP "app"
  880. #define MQTT_TOPIC_INTERVAL "interval"
  881. #define MQTT_TOPIC_HOSTNAME "host"
  882. #define MQTT_TOPIC_DESCRIPTION "desc"
  883. #define MQTT_TOPIC_TIME "time"
  884. #define MQTT_TOPIC_RFOUT "rfout"
  885. #define MQTT_TOPIC_RFIN "rfin"
  886. #define MQTT_TOPIC_RFLEARN "rflearn"
  887. #define MQTT_TOPIC_RFRAW "rfraw"
  888. #define MQTT_TOPIC_UARTIN "uartin"
  889. #define MQTT_TOPIC_UARTOUT "uartout"
  890. #define MQTT_TOPIC_LOADAVG "loadavg"
  891. #define MQTT_TOPIC_BOARD "board"
  892. #define MQTT_TOPIC_PULSE "pulse"
  893. #define MQTT_TOPIC_SPEED "speed"
  894. #define MQTT_TOPIC_IRIN "irin"
  895. #define MQTT_TOPIC_IROUT "irout"
  896. #define MQTT_TOPIC_OTA "ota"
  897. #define MQTT_TOPIC_TELNET_REVERSE "telnet_reverse"
  898. // Light module
  899. #define MQTT_TOPIC_CHANNEL "channel"
  900. #define MQTT_TOPIC_COLOR_RGB "rgb"
  901. #define MQTT_TOPIC_COLOR_HSV "hsv"
  902. #define MQTT_TOPIC_ANIM_MODE "anim_mode"
  903. #define MQTT_TOPIC_ANIM_SPEED "anim_speed"
  904. #define MQTT_TOPIC_BRIGHTNESS "brightness"
  905. #define MQTT_TOPIC_MIRED "mired"
  906. #define MQTT_TOPIC_KELVIN "kelvin"
  907. #define MQTT_TOPIC_TRANSITION "transition"
  908. // Thermostat module
  909. #define MQTT_TOPIC_HOLD_TEMP "hold_temp"
  910. #define MQTT_TOPIC_HOLD_TEMP_MIN "min"
  911. #define MQTT_TOPIC_HOLD_TEMP_MAX "max"
  912. #define MQTT_TOPIC_REMOTE_TEMP "remote_temp"
  913. #define MQTT_TOPIC_ASK_TEMP_RANGE "ask_temp_range"
  914. #define MQTT_TOPIC_NOTIFY_TEMP_RANGE_MIN "notify_temp_range_min"
  915. #define MQTT_TOPIC_NOTIFY_TEMP_RANGE_MAX "notify_temp_range_max"
  916. #ifndef MQTT_STATUS_ONLINE
  917. #define MQTT_STATUS_ONLINE "1" // Value for the device ON message
  918. #endif
  919. #ifndef MQTT_STATUS_OFFLINE
  920. #define MQTT_STATUS_OFFLINE "0" // Value for the device OFF message (will)
  921. #endif
  922. #define MQTT_ACTION_RESET "reboot" // RESET MQTT topic particle
  923. // Custom get and set postfixes
  924. // Use something like "/status" or "/set", with leading slash
  925. // Since 1.9.0 the default value is "" for getter and "/set" for setter
  926. #ifndef MQTT_GETTER
  927. #define MQTT_GETTER ""
  928. #endif
  929. #ifndef MQTT_SETTER
  930. #define MQTT_SETTER "/set"
  931. #endif
  932. // -----------------------------------------------------------------------------
  933. // BROKER
  934. // -----------------------------------------------------------------------------
  935. #ifndef BROKER_SUPPORT
  936. #define BROKER_SUPPORT 1 // The broker is a poor-man's pubsub manager
  937. #endif
  938. // -----------------------------------------------------------------------------
  939. // SETTINGS
  940. // -----------------------------------------------------------------------------
  941. #ifndef SETTINGS_AUTOSAVE
  942. #define SETTINGS_AUTOSAVE 1 // Autosave settings or force manual commit
  943. #endif
  944. #define SETTINGS_MAX_LIST_COUNT 16 // Maximum index for settings lists
  945. // -----------------------------------------------------------------------------
  946. // LIGHT
  947. // -----------------------------------------------------------------------------
  948. // LIGHT_PROVIDER_DIMMER can have from 1 to 5 different channels.
  949. // They have to be defined for each device in the hardware.h file.
  950. // If 3 or more channels first 3 will be considered RGB.
  951. // Usual configurations are:
  952. // 1 channels => W
  953. // 2 channels => WW
  954. // 3 channels => RGB
  955. // 4 channels => RGBW
  956. // 5 channels => RGBWW
  957. #ifndef LIGHT_SAVE_ENABLED
  958. #define LIGHT_SAVE_ENABLED 1 // Light channel values saved by default after each change
  959. #endif
  960. #ifndef LIGHT_COMMS_DELAY
  961. #define LIGHT_COMMS_DELAY 100 // Delay communication after light update (in ms)
  962. #endif
  963. #ifndef LIGHT_SAVE_DELAY
  964. #define LIGHT_SAVE_DELAY 5 // Persist color after 5 seconds to avoid wearing out
  965. #endif
  966. #ifndef LIGHT_MIN_PWM
  967. #define LIGHT_MIN_PWM 0
  968. #endif
  969. #ifndef LIGHT_MAX_PWM
  970. #if LIGHT_PROVIDER == LIGHT_PROVIDER_MY92XX
  971. #define LIGHT_MAX_PWM 255
  972. #elif LIGHT_PROVIDER == LIGHT_PROVIDER_DIMMER
  973. #define LIGHT_MAX_PWM 10000 // 10000 * 200ns => 2 kHz
  974. #else
  975. #define LIGHT_MAX_PWM 0
  976. #endif
  977. #endif // LIGHT_MAX_PWM
  978. #ifndef LIGHT_LIMIT_PWM
  979. #define LIGHT_LIMIT_PWM LIGHT_MAX_PWM // Limit PWM to this value (prevent 100% power)
  980. #endif
  981. #ifndef LIGHT_MIN_VALUE
  982. #define LIGHT_MIN_VALUE 0 // Minimum light value
  983. #endif
  984. #ifndef LIGHT_MAX_VALUE
  985. #define LIGHT_MAX_VALUE 255 // Maximum light value
  986. #endif
  987. #ifndef LIGHT_MIN_BRIGHTNESS
  988. #define LIGHT_MIN_BRIGHTNESS 0 // Minimum brightness value
  989. #endif
  990. #ifndef LIGHT_MAX_BRIGHTNESS
  991. #define LIGHT_MAX_BRIGHTNESS 255 // Maximum brightness value
  992. #endif
  993. // Default mireds & kelvin to the Philips Hue limits
  994. // https://developers.meethue.com/documentation/core-concepts
  995. //
  996. // Home Assistant also uses these, see Light::min_mireds, Light::max_mireds
  997. // https://github.com/home-assistant/home-assistant/blob/dev/homeassistant/components/light/__init__.py
  998. // Used when LIGHT_USE_WHITE AND LIGHT_USE_CCT is 1 - (1000000/Kelvin = MiReds)
  999. // Warning! Don't change this yet, NOT FULLY IMPLEMENTED!
  1000. #ifndef LIGHT_COLDWHITE_MIRED
  1001. #define LIGHT_COLDWHITE_MIRED 153 // Coldwhite Strip, Value must be __BELOW__ W2!! (Default: 6535 Kelvin/153 MiRed)
  1002. #endif
  1003. #ifndef LIGHT_WARMWHITE_MIRED
  1004. #define LIGHT_WARMWHITE_MIRED 500 // Warmwhite Strip, Value must be __ABOVE__ W1!! (Default: 2000 Kelvin/500 MiRed)
  1005. #endif
  1006. #ifndef LIGHT_STEP
  1007. #define LIGHT_STEP 32 // Step size
  1008. #endif
  1009. #ifndef LIGHT_USE_COLOR
  1010. #define LIGHT_USE_COLOR 1 // Use 3 first channels as RGB
  1011. #endif
  1012. #ifndef LIGHT_USE_WHITE
  1013. #define LIGHT_USE_WHITE 0 // Use the 4th channel as (Warm-)White LEDs
  1014. #endif
  1015. #ifndef LIGHT_USE_CCT
  1016. #define LIGHT_USE_CCT 0 // Use the 5th channel as Coldwhite LEDs, LIGHT_USE_WHITE must be 1.
  1017. #endif
  1018. #ifndef LIGHT_USE_GAMMA
  1019. #define LIGHT_USE_GAMMA 0 // Use gamma correction for color channels
  1020. #endif
  1021. #ifndef LIGHT_USE_CSS
  1022. #define LIGHT_USE_CSS 1 // Use CSS style to report colors (1=> "#FF0000", 0=> "255,0,0")
  1023. #endif
  1024. #ifndef LIGHT_USE_RGB
  1025. #define LIGHT_USE_RGB 0 // Use RGB color selector (1=> RGB, 0=> HSV)
  1026. #endif
  1027. #ifndef LIGHT_WHITE_FACTOR
  1028. #define LIGHT_WHITE_FACTOR 1 // When using LIGHT_USE_WHITE with uneven brightness LEDs,
  1029. // this factor is used to scale the white channel to match brightness
  1030. #endif
  1031. #ifndef LIGHT_USE_TRANSITIONS
  1032. #define LIGHT_USE_TRANSITIONS 1 // Transitions between colors
  1033. #endif
  1034. #ifndef LIGHT_TRANSITION_STEP
  1035. #define LIGHT_TRANSITION_STEP 10 // Time in millis between each transtion step
  1036. #endif
  1037. #ifndef LIGHT_TRANSITION_TIME
  1038. #define LIGHT_TRANSITION_TIME 500 // Time in millis from color to color
  1039. #endif
  1040. // -----------------------------------------------------------------------------
  1041. // DOMOTICZ
  1042. // -----------------------------------------------------------------------------
  1043. #ifndef DOMOTICZ_SUPPORT
  1044. #define DOMOTICZ_SUPPORT MQTT_SUPPORT // Build with domoticz (if MQTT) support (1.72Kb)
  1045. #endif
  1046. #ifndef DOMOTICZ_ENABLED
  1047. #define DOMOTICZ_ENABLED 0 // Disable domoticz by default
  1048. #endif
  1049. #ifndef DOMOTICZ_IN_TOPIC
  1050. #define DOMOTICZ_IN_TOPIC "domoticz/in" // Default subscription topic
  1051. #endif
  1052. #ifndef DOMOTICZ_OUT_TOPIC
  1053. #define DOMOTICZ_OUT_TOPIC "domoticz/out" // Default publication topic
  1054. #endif
  1055. // -----------------------------------------------------------------------------
  1056. // HOME ASSISTANT
  1057. // -----------------------------------------------------------------------------
  1058. #ifndef HOMEASSISTANT_SUPPORT
  1059. #define HOMEASSISTANT_SUPPORT MQTT_SUPPORT // Build with home assistant support (if MQTT, 1.64Kb)
  1060. #endif
  1061. #ifndef HOMEASSISTANT_ENABLED
  1062. #define HOMEASSISTANT_ENABLED 0 // Integration not enabled by default
  1063. #endif
  1064. #ifndef HOMEASSISTANT_PREFIX
  1065. #define HOMEASSISTANT_PREFIX "homeassistant" // Default MQTT prefix
  1066. #endif
  1067. // -----------------------------------------------------------------------------
  1068. // INFLUXDB
  1069. // -----------------------------------------------------------------------------
  1070. #ifndef INFLUXDB_SUPPORT
  1071. #define INFLUXDB_SUPPORT 0 // Disable InfluxDB support by default (4.38Kb)
  1072. #endif
  1073. #ifndef INFLUXDB_ENABLED
  1074. #define INFLUXDB_ENABLED 0 // InfluxDB disabled by default
  1075. #endif
  1076. #ifndef INFLUXDB_HOST
  1077. #define INFLUXDB_HOST "" // Default server
  1078. #endif
  1079. #ifndef INFLUXDB_PORT
  1080. #define INFLUXDB_PORT 8086 // Default InfluxDB port
  1081. #endif
  1082. #ifndef INFLUXDB_DATABASE
  1083. #define INFLUXDB_DATABASE "" // Default database
  1084. #endif
  1085. #ifndef INFLUXDB_USERNAME
  1086. #define INFLUXDB_USERNAME "" // Default username
  1087. #endif
  1088. #ifndef INFLUXDB_PASSWORD
  1089. #define INFLUXDB_PASSWORD "" // Default password
  1090. #endif
  1091. // -----------------------------------------------------------------------------
  1092. // THINGSPEAK
  1093. // -----------------------------------------------------------------------------
  1094. #ifndef THINGSPEAK_SUPPORT
  1095. #define THINGSPEAK_SUPPORT 1 // Enable Thingspeak support by default (2.56Kb)
  1096. #endif
  1097. #ifndef THINGSPEAK_ENABLED
  1098. #define THINGSPEAK_ENABLED 0 // Thingspeak disabled by default
  1099. #endif
  1100. #ifndef THINGSPEAK_APIKEY
  1101. #define THINGSPEAK_APIKEY "" // Default API KEY
  1102. #endif
  1103. #ifndef THINGSPEAK_CLEAR_CACHE
  1104. #define THINGSPEAK_CLEAR_CACHE 1 // Clear cache after sending values
  1105. // Not clearing it will result in latest values for each field being sent every time
  1106. #endif
  1107. #ifndef THINGSPEAK_USE_ASYNC
  1108. #define THINGSPEAK_USE_ASYNC 1 // Use AsyncClient instead of WiFiClientSecure
  1109. #endif
  1110. // THINGSPEAK OVER SSL
  1111. // Using THINGSPEAK over SSL works well but generates problems with the web interface,
  1112. // so you should compile it with WEB_SUPPORT to 0.
  1113. // When THINGSPEAK_USE_ASYNC is 1, requires EspAsyncTCP to be built with ASYNC_TCP_SSL_ENABLED=1 and ESP8266 Arduino Core >= 2.4.0.
  1114. // When THINGSPEAK_USE_ASYNC is 0, requires Arduino Core >= 2.6.0 and SECURE_CLIENT_BEARSSL
  1115. //
  1116. // WARNING: Thingspeak servers do not support MFLN right now, connection requires at least 30KB of free RAM.
  1117. // Also see MQTT comments above.
  1118. #ifndef THINGSPEAK_USE_SSL
  1119. #define THINGSPEAK_USE_SSL 0 // Use secure connection
  1120. #endif
  1121. #ifndef THINGSPEAK_SECURE_CLIENT_CHECK
  1122. #define THINGSPEAK_SECURE_CLIENT_CHECK SECURE_CLIENT_CHECK
  1123. #endif
  1124. #ifndef THINGSPEAK_SECURE_CLIENT_MFLN
  1125. #define THINGSPEAK_SECURE_CLIENT_MFLN SECURE_CLIENT_MFLN
  1126. #endif
  1127. #ifndef THINGSPEAK_FINGERPRINT
  1128. #define THINGSPEAK_FINGERPRINT "78 60 18 44 81 35 BF DF 77 84 D4 0A 22 0D 9B 4E 6C DC 57 2C"
  1129. #endif
  1130. #ifndef THINGSPEAK_ADDRESS
  1131. #if THINGSPEAK_USE_SSL
  1132. #define THINGSPEAK_ADDRESS "https://api.thingspeak.com/update"
  1133. #else
  1134. #define THINGSPEAK_ADDRESS "http://api.thingspeak.com/update"
  1135. #endif
  1136. #endif // ifndef THINGSPEAK_ADDRESS
  1137. #ifndef THINGSPEAK_TRIES
  1138. #define THINGSPEAK_TRIES 3 // Number of tries when sending data (minimum 1)
  1139. #endif
  1140. #define THINGSPEAK_MIN_INTERVAL 15000 // Minimum interval between POSTs (in millis)
  1141. #define THINGSPEAK_FIELDS 8 // Number of fields
  1142. // -----------------------------------------------------------------------------
  1143. // SCHEDULER
  1144. // -----------------------------------------------------------------------------
  1145. #ifndef SCHEDULER_SUPPORT
  1146. #define SCHEDULER_SUPPORT 1 // Enable scheduler (2.45Kb)
  1147. #endif
  1148. #ifndef SCHEDULER_MAX_SCHEDULES
  1149. #define SCHEDULER_MAX_SCHEDULES 10 // Max schedules alowed
  1150. #endif
  1151. #ifndef SCHEDULER_RESTORE_LAST_SCHEDULE
  1152. #define SCHEDULER_RESTORE_LAST_SCHEDULE 0 // Restore the last schedule state on the device boot
  1153. #endif
  1154. #ifndef SCHEDULER_WEEKDAYS
  1155. #define SCHEDULER_WEEKDAYS "1,2,3,4,5,6,7" // (Default - Run the schedules every day)
  1156. #endif
  1157. // -----------------------------------------------------------------------------
  1158. // RPN RULES
  1159. // -----------------------------------------------------------------------------
  1160. #ifndef RPN_RULES_SUPPORT
  1161. #define RPN_RULES_SUPPORT 0 // Enable RPN Rules (8.6Kb)
  1162. #endif
  1163. #ifndef RPN_DELAY
  1164. #define RPN_DELAY 100 // Execute rules after 100ms without messages
  1165. #endif
  1166. #ifndef RPN_STICKY
  1167. #define RPN_STICKY 1 // Keeps variable after rule execution
  1168. #endif
  1169. // -----------------------------------------------------------------------------
  1170. // NTP
  1171. // -----------------------------------------------------------------------------
  1172. #ifndef NTP_SUPPORT
  1173. #define NTP_SUPPORT 1 // Build with NTP support by default (depends on Core version)
  1174. #endif
  1175. #ifndef NTP_SERVER
  1176. #define NTP_SERVER "pool.ntp.org" // Default NTP server
  1177. #endif
  1178. #ifndef NTP_TIMEZONE
  1179. #define NTP_TIMEZONE TZ_Etc_UTC // POSIX TZ variable. Default to UTC from TZ.h (which is PSTR("UTC0"))
  1180. // For the format documentation, see:
  1181. // - https://www.gnu.org/software/libc/manual/html_node/TZ-Variable.html
  1182. // ESP8266 Core provides human-readable aliases for POSIX format, see:
  1183. // - Latest: https://github.com/esp8266/Arduino/blob/master/cores/esp8266/TZ.h
  1184. // - PlatformIO: ~/.platformio/packages/framework-arduinoespressif8266/cores/esp8266/TZ.h
  1185. // (or, possibly, c:\.platformio\... on Windows)
  1186. // - Arduino IDE: depends on platform, see `/dist/arduino_ide/README.md`
  1187. #endif
  1188. #ifndef NTP_UPDATE_INTERVAL
  1189. #define NTP_UPDATE_INTERVAL 1800 // NTP check every 30 minutes
  1190. #endif
  1191. #ifndef NTP_START_DELAY
  1192. #define NTP_START_DELAY 3 // Delay NTP start for 3 seconds
  1193. #endif
  1194. #ifndef NTP_WAIT_FOR_SYNC
  1195. #define NTP_WAIT_FOR_SYNC 1 // Do not report any datetime until NTP sync'ed
  1196. #endif
  1197. // WARNING: legacy NTP settings. can be ignored with Core 2.6.2+
  1198. #ifndef NTP_TIMEOUT
  1199. #define NTP_TIMEOUT 1000 // Set NTP request timeout to 2 seconds (issue #452)
  1200. #endif
  1201. #ifndef NTP_TIME_OFFSET
  1202. #define NTP_TIME_OFFSET 60 // Default timezone offset (GMT+1)
  1203. #endif
  1204. #ifndef NTP_DAY_LIGHT
  1205. #define NTP_DAY_LIGHT 1 // Enable daylight time saving by default
  1206. #endif
  1207. #ifndef NTP_SYNC_INTERVAL
  1208. #define NTP_SYNC_INTERVAL 60 // NTP initial check every minute
  1209. #endif
  1210. #ifndef NTP_DST_REGION
  1211. #define NTP_DST_REGION 0 // 0 for Europe, 1 for USA (defined in NtpClientLib)
  1212. #endif
  1213. // -----------------------------------------------------------------------------
  1214. // ALEXA
  1215. // -----------------------------------------------------------------------------
  1216. // This setting defines whether Alexa support should be built into the firmware
  1217. #ifndef ALEXA_SUPPORT
  1218. #define ALEXA_SUPPORT 1 // Enable Alexa support by default (10.84Kb)
  1219. #endif
  1220. // This is default value for the alexaEnabled setting that defines whether
  1221. // this device should be discoberable and respond to Alexa commands.
  1222. // Both ALEXA_SUPPORT and alexaEnabled should be 1 for Alexa support to work.
  1223. #ifndef ALEXA_ENABLED
  1224. #define ALEXA_ENABLED 1
  1225. #endif
  1226. #ifndef ALEXA_HOSTNAME
  1227. #define ALEXA_HOSTNAME ""
  1228. #endif
  1229. // -----------------------------------------------------------------------------
  1230. // MQTT RF BRIDGE
  1231. // -----------------------------------------------------------------------------
  1232. #ifndef RF_SUPPORT
  1233. #define RF_SUPPORT 0
  1234. #endif
  1235. #ifndef RF_DEBOUNCE
  1236. #define RF_DEBOUNCE 500
  1237. #endif
  1238. #ifndef RF_LEARN_TIMEOUT
  1239. #define RF_LEARN_TIMEOUT 60000
  1240. #endif
  1241. #ifndef RF_SEND_TIMES
  1242. #define RF_SEND_TIMES 4 // How many times to send the message
  1243. #endif
  1244. #ifndef RF_SEND_DELAY
  1245. #define RF_SEND_DELAY 500 // Interval between sendings in ms
  1246. #endif
  1247. #ifndef RF_RECEIVE_DELAY
  1248. #define RF_RECEIVE_DELAY 500 // Interval between recieving in ms (avoid debouncing)
  1249. #endif
  1250. // Enable RCSwitch support
  1251. // Originally implemented for SONOFF BASIC
  1252. // https://tinkerman.cat/adding-rf-to-a-non-rf-itead-sonoff/
  1253. // Also possible to use with SONOFF RF BRIDGE, thanks to @wildwiz
  1254. // https://github.com/xoseperez/espurna/wiki/Hardware-Itead-Sonoff-RF-Bridge---Direct-Hack
  1255. #ifndef RFB_DIRECT
  1256. #define RFB_DIRECT 0
  1257. #endif
  1258. #ifndef RFB_RX_PIN
  1259. #define RFB_RX_PIN GPIO_NONE
  1260. #endif
  1261. #ifndef RFB_TX_PIN
  1262. #define RFB_TX_PIN GPIO_NONE
  1263. #endif
  1264. // -----------------------------------------------------------------------------
  1265. // IR Bridge
  1266. // -----------------------------------------------------------------------------
  1267. #ifndef IR_SUPPORT
  1268. #define IR_SUPPORT 0 // Do not build with IR support by default (10.25Kb)
  1269. #endif
  1270. //#define IR_RX_PIN 5 // GPIO the receiver is connected to
  1271. //#define IR_TX_PIN 4 // GPIO the transmitter is connected to
  1272. #ifndef IR_USE_RAW
  1273. #define IR_USE_RAW 0 // Use raw codes
  1274. #endif
  1275. #ifndef IR_BUFFER_SIZE
  1276. #define IR_BUFFER_SIZE 1024
  1277. #endif
  1278. #ifndef IR_TIMEOUT
  1279. #define IR_TIMEOUT 15U
  1280. #endif
  1281. #ifndef IR_REPEAT
  1282. #define IR_REPEAT 1
  1283. #endif
  1284. #ifndef IR_DELAY
  1285. #define IR_DELAY 100
  1286. #endif
  1287. #ifndef IR_DEBOUNCE
  1288. #define IR_DEBOUNCE 500 // IR debounce time in milliseconds
  1289. #endif
  1290. #ifndef IR_BUTTON_SET
  1291. #define IR_BUTTON_SET 0 // IR button set to use (see ../ir_button.h)
  1292. #endif
  1293. //--------------------------------------------------------------------------------
  1294. // Custom RFM69 to MQTT bridge
  1295. // Check http://tinkerman.cat/rfm69-wifi-gateway/
  1296. // Enable support by passing RFM69_SUPPORT=1 build flag
  1297. //--------------------------------------------------------------------------------
  1298. #ifndef RFM69_SUPPORT
  1299. #define RFM69_SUPPORT 0
  1300. #endif
  1301. #ifndef RFM69_MAX_TOPICS
  1302. #define RFM69_MAX_TOPICS 50
  1303. #endif
  1304. #ifndef RFM69_MAX_NODES
  1305. #define RFM69_MAX_NODES 255
  1306. #endif
  1307. #ifndef RFM69_DEFAULT_TOPIC
  1308. #define RFM69_DEFAULT_TOPIC "/rfm69gw/{node}/{key}"
  1309. #endif
  1310. #ifndef RFM69_NODE_ID
  1311. #define RFM69_NODE_ID 1
  1312. #endif
  1313. #ifndef RFM69_GATEWAY_ID
  1314. #define RFM69_GATEWAY_ID 1
  1315. #endif
  1316. #ifndef RFM69_NETWORK_ID
  1317. #define RFM69_NETWORK_ID 164
  1318. #endif
  1319. #ifndef RFM69_PROMISCUOUS
  1320. #define RFM69_PROMISCUOUS 0
  1321. #endif
  1322. #ifndef RFM69_PROMISCUOUS_SENDS
  1323. #define RFM69_PROMISCUOUS_SENDS 0
  1324. #endif
  1325. #ifndef RFM69_FREQUENCY
  1326. #define RFM69_FREQUENCY RF69_868MHZ
  1327. #endif
  1328. #ifndef RFM69_ENCRYPTKEY
  1329. #define RFM69_ENCRYPTKEY "fibonacci0123456"
  1330. #endif
  1331. #ifndef RFM69_CS_PIN
  1332. #define RFM69_CS_PIN SS
  1333. #endif
  1334. #ifndef RFM69_IRQ_PIN
  1335. #define RFM69_IRQ_PIN 5
  1336. #endif
  1337. #ifndef RFM69_RESET_PIN
  1338. #define RFM69_RESET_PIN 7
  1339. #endif
  1340. #ifndef RFM69_IS_RFM69HW
  1341. #define RFM69_IS_RFM69HW 0
  1342. #endif
  1343. //--------------------------------------------------------------------------------
  1344. // TUYA switch & dimmer support
  1345. //--------------------------------------------------------------------------------
  1346. #ifndef TUYA_SUPPORT
  1347. #define TUYA_SUPPORT 0
  1348. #endif
  1349. #ifndef TUYA_SERIAL
  1350. #define TUYA_SERIAL Serial
  1351. #endif
  1352. // =============================================================================
  1353. // Configuration helpers
  1354. // =============================================================================
  1355. //------------------------------------------------------------------------------
  1356. // Provide generic way to detect debugging support
  1357. //------------------------------------------------------------------------------
  1358. #ifndef DEBUG_SUPPORT
  1359. #define DEBUG_SUPPORT ( \
  1360. DEBUG_SERIAL_SUPPORT || \
  1361. DEBUG_UDP_SUPPORT || \
  1362. DEBUG_TELNET_SUPPORT || \
  1363. DEBUG_WEB_SUPPORT \
  1364. )
  1365. #endif