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.

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