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.

1975 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 2 networks)
  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. #ifndef THINGSPEAK_USE_SSL
  1094. #define THINGSPEAK_USE_SSL 0 // Use secure connection
  1095. #endif
  1096. #ifndef THINGSPEAK_SECURE_CLIENT_CHECK
  1097. #define THINGSPEAK_SECURE_CLIENT_CHECK SECURE_CLIENT_CHECK
  1098. #endif
  1099. #ifndef THINGSPEAK_SECURE_CLIENT_MFLN
  1100. #define THINGSPEAK_SECURE_CLIENT_MFLN SECURE_CLIENT_MFLN
  1101. #endif
  1102. #ifndef THINGSPEAK_FINGERPRINT
  1103. #define THINGSPEAK_FINGERPRINT "78 60 18 44 81 35 BF DF 77 84 D4 0A 22 0D 9B 4E 6C DC 57 2C"
  1104. #endif
  1105. #ifndef THINGSPEAK_ADDRESS
  1106. #if THINGSPEAK_USE_SSL
  1107. #define THINGSPEAK_ADDRESS "https://api.thingspeak.com/update"
  1108. #else
  1109. #define THINGSPEAK_ADDRESS "http://api.thingspeak.com/update"
  1110. #endif
  1111. #endif // ifndef THINGSPEAK_ADDRESS
  1112. #ifndef THINGSPEAK_TRIES
  1113. #define THINGSPEAK_TRIES 3 // Number of tries when sending data (minimum 1)
  1114. #endif
  1115. #define THINGSPEAK_MIN_INTERVAL 15000 // Minimum interval between POSTs (in millis)
  1116. #define THINGSPEAK_FIELDS 8 // Number of fields
  1117. // -----------------------------------------------------------------------------
  1118. // SCHEDULER
  1119. // -----------------------------------------------------------------------------
  1120. #ifndef SCHEDULER_SUPPORT
  1121. #define SCHEDULER_SUPPORT 1 // Enable scheduler (2.45Kb)
  1122. #endif
  1123. #ifndef SCHEDULER_MAX_SCHEDULES
  1124. #define SCHEDULER_MAX_SCHEDULES 10 // Max schedules alowed
  1125. #endif
  1126. #ifndef SCHEDULER_RESTORE_LAST_SCHEDULE
  1127. #define SCHEDULER_RESTORE_LAST_SCHEDULE 0 // Restore the last schedule state on the device boot
  1128. #endif
  1129. #ifndef SCHEDULER_WEEKDAYS
  1130. #define SCHEDULER_WEEKDAYS "1,2,3,4,5,6,7" // (Default - Run the schedules every day)
  1131. #endif
  1132. // -----------------------------------------------------------------------------
  1133. // RPN RULES
  1134. // -----------------------------------------------------------------------------
  1135. #ifndef RPN_RULES_SUPPORT
  1136. #define RPN_RULES_SUPPORT 0 // Enable RPN Rules (8.6Kb)
  1137. #endif
  1138. #ifndef RPN_DELAY
  1139. #define RPN_DELAY 100 // Execute rules after 100ms without messages
  1140. #endif
  1141. #ifndef RPN_STICKY
  1142. #define RPN_STICKY 1 // Keeps variable after rule execution
  1143. #endif
  1144. // -----------------------------------------------------------------------------
  1145. // NTP
  1146. // -----------------------------------------------------------------------------
  1147. #ifndef NTP_SUPPORT
  1148. #define NTP_SUPPORT 1 // Build with NTP support by default (depends on Core version)
  1149. #endif
  1150. #ifndef NTP_SERVER
  1151. #define NTP_SERVER "pool.ntp.org" // Default NTP server
  1152. #endif
  1153. #ifndef NTP_TIMEZONE
  1154. #define NTP_TIMEZONE TZ_Etc_UTC // POSIX TZ variable. Default to UTC from TZ.h (which is PSTR("UTC0"))
  1155. // For the format documentation, see:
  1156. // - https://www.gnu.org/software/libc/manual/html_node/TZ-Variable.html
  1157. // ESP8266 Core provides human-readable aliases for POSIX format, see:
  1158. // - Latest: https://github.com/esp8266/Arduino/blob/master/cores/esp8266/TZ.h
  1159. // - PlatformIO: ~/.platformio/packages/framework-arduinoespressif8266/cores/esp8266/TZ.h
  1160. // (or, possibly, c:\.platformio\... on Windows)
  1161. // - Arduino IDE: depends on platform, see `/dist/arduino_ide/README.md`
  1162. #endif
  1163. #ifndef NTP_UPDATE_INTERVAL
  1164. #define NTP_UPDATE_INTERVAL 1800 // NTP check every 30 minutes
  1165. #endif
  1166. #ifndef NTP_START_DELAY
  1167. #define NTP_START_DELAY 3 // Delay NTP start for 3 seconds
  1168. #endif
  1169. #ifndef NTP_WAIT_FOR_SYNC
  1170. #define NTP_WAIT_FOR_SYNC 1 // Do not report any datetime until NTP sync'ed
  1171. #endif
  1172. // WARNING: legacy NTP settings. can be ignored with Core 2.6.2+
  1173. #ifndef NTP_TIMEOUT
  1174. #define NTP_TIMEOUT 1000 // Set NTP request timeout to 2 seconds (issue #452)
  1175. #endif
  1176. #ifndef NTP_TIME_OFFSET
  1177. #define NTP_TIME_OFFSET 60 // Default timezone offset (GMT+1)
  1178. #endif
  1179. #ifndef NTP_DAY_LIGHT
  1180. #define NTP_DAY_LIGHT 1 // Enable daylight time saving by default
  1181. #endif
  1182. #ifndef NTP_SYNC_INTERVAL
  1183. #define NTP_SYNC_INTERVAL 60 // NTP initial check every minute
  1184. #endif
  1185. #ifndef NTP_DST_REGION
  1186. #define NTP_DST_REGION 0 // 0 for Europe, 1 for USA (defined in NtpClientLib)
  1187. #endif
  1188. // -----------------------------------------------------------------------------
  1189. // ALEXA
  1190. // -----------------------------------------------------------------------------
  1191. // This setting defines whether Alexa support should be built into the firmware
  1192. #ifndef ALEXA_SUPPORT
  1193. #define ALEXA_SUPPORT 1 // Enable Alexa support by default (10.84Kb)
  1194. #endif
  1195. // This is default value for the alexaEnabled setting that defines whether
  1196. // this device should be discoberable and respond to Alexa commands.
  1197. // Both ALEXA_SUPPORT and alexaEnabled should be 1 for Alexa support to work.
  1198. #ifndef ALEXA_ENABLED
  1199. #define ALEXA_ENABLED 1
  1200. #endif
  1201. #ifndef ALEXA_HOSTNAME
  1202. #define ALEXA_HOSTNAME ""
  1203. #endif
  1204. // -----------------------------------------------------------------------------
  1205. // MQTT RF BRIDGE
  1206. // -----------------------------------------------------------------------------
  1207. #ifndef RF_SUPPORT
  1208. #define RF_SUPPORT 0
  1209. #endif
  1210. #ifndef RF_DEBOUNCE
  1211. #define RF_DEBOUNCE 500
  1212. #endif
  1213. #ifndef RF_LEARN_TIMEOUT
  1214. #define RF_LEARN_TIMEOUT 60000
  1215. #endif
  1216. #ifndef RF_SEND_TIMES
  1217. #define RF_SEND_TIMES 4 // How many times to send the message
  1218. #endif
  1219. #ifndef RF_SEND_DELAY
  1220. #define RF_SEND_DELAY 500 // Interval between sendings in ms
  1221. #endif
  1222. #ifndef RF_RECEIVE_DELAY
  1223. #define RF_RECEIVE_DELAY 500 // Interval between recieving in ms (avoid debouncing)
  1224. #endif
  1225. // Enable RCSwitch support
  1226. // Originally implemented for SONOFF BASIC
  1227. // https://tinkerman.cat/adding-rf-to-a-non-rf-itead-sonoff/
  1228. // Also possible to use with SONOFF RF BRIDGE, thanks to @wildwiz
  1229. // https://github.com/xoseperez/espurna/wiki/Hardware-Itead-Sonoff-RF-Bridge---Direct-Hack
  1230. #ifndef RFB_DIRECT
  1231. #define RFB_DIRECT 0
  1232. #endif
  1233. #ifndef RFB_RX_PIN
  1234. #define RFB_RX_PIN GPIO_NONE
  1235. #endif
  1236. #ifndef RFB_TX_PIN
  1237. #define RFB_TX_PIN GPIO_NONE
  1238. #endif
  1239. // -----------------------------------------------------------------------------
  1240. // IR Bridge
  1241. // -----------------------------------------------------------------------------
  1242. #ifndef IR_SUPPORT
  1243. #define IR_SUPPORT 0 // Do not build with IR support by default (10.25Kb)
  1244. #endif
  1245. //#define IR_RX_PIN 5 // GPIO the receiver is connected to
  1246. //#define IR_TX_PIN 4 // GPIO the transmitter is connected to
  1247. #ifndef IR_USE_RAW
  1248. #define IR_USE_RAW 0 // Use raw codes
  1249. #endif
  1250. #ifndef IR_BUFFER_SIZE
  1251. #define IR_BUFFER_SIZE 1024
  1252. #endif
  1253. #ifndef IR_TIMEOUT
  1254. #define IR_TIMEOUT 15U
  1255. #endif
  1256. #ifndef IR_REPEAT
  1257. #define IR_REPEAT 1
  1258. #endif
  1259. #ifndef IR_DELAY
  1260. #define IR_DELAY 100
  1261. #endif
  1262. #ifndef IR_DEBOUNCE
  1263. #define IR_DEBOUNCE 500 // IR debounce time in milliseconds
  1264. #endif
  1265. #ifndef IR_BUTTON_SET
  1266. #define IR_BUTTON_SET 0 // IR button set to use (see below)
  1267. #endif
  1268. // -----------------------------------------------------------------------------
  1269. // Remote Buttons SET 1 (for the original Remote shipped with the controller)
  1270. #if IR_BUTTON_SET == 1
  1271. /*
  1272. +------+------+------+------+
  1273. | UP | Down | OFF | ON |
  1274. +------+------+------+------+
  1275. | R | G | B | W |
  1276. +------+------+------+------+
  1277. | 1 | 2 | 3 |FLASH |
  1278. +------+------+------+------+
  1279. | 4 | 5 | 6 |STROBE|
  1280. +------+------+------+------+
  1281. | 7 | 8 | 9 | FADE |
  1282. +------+------+------+------+
  1283. | 10 | 11 | 12 |SMOOTH|
  1284. +------+------+------+------+
  1285. */
  1286. #define IR_BUTTON_COUNT 24
  1287. const uint32_t IR_BUTTON[IR_BUTTON_COUNT][3] PROGMEM = {
  1288. { 0xFF906F, IR_BUTTON_MODE_BRIGHTER, 1 },
  1289. { 0xFFB847, IR_BUTTON_MODE_BRIGHTER, 0 },
  1290. { 0xFFF807, IR_BUTTON_MODE_STATE, 0 },
  1291. { 0xFFB04F, IR_BUTTON_MODE_STATE, 1 },
  1292. { 0xFF9867, IR_BUTTON_MODE_RGB, 0xFF0000 },
  1293. { 0xFFD827, IR_BUTTON_MODE_RGB, 0x00FF00 },
  1294. { 0xFF8877, IR_BUTTON_MODE_RGB, 0x0000FF },
  1295. { 0xFFA857, IR_BUTTON_MODE_RGB, 0xFFFFFF },
  1296. { 0xFFE817, IR_BUTTON_MODE_RGB, 0xD13A01 },
  1297. { 0xFF48B7, IR_BUTTON_MODE_RGB, 0x00E644 },
  1298. { 0xFF6897, IR_BUTTON_MODE_RGB, 0x0040A7 },
  1299. { 0xFFB24D, IR_BUTTON_MODE_EFFECT, LIGHT_EFFECT_FLASH },
  1300. { 0xFF02FD, IR_BUTTON_MODE_RGB, 0xE96F2A },
  1301. { 0xFF32CD, IR_BUTTON_MODE_RGB, 0x00BEBF },
  1302. { 0xFF20DF, IR_BUTTON_MODE_RGB, 0x56406F },
  1303. { 0xFF00FF, IR_BUTTON_MODE_EFFECT, LIGHT_EFFECT_STROBE },
  1304. { 0xFF50AF, IR_BUTTON_MODE_RGB, 0xEE9819 },
  1305. { 0xFF7887, IR_BUTTON_MODE_RGB, 0x00799A },
  1306. { 0xFF708F, IR_BUTTON_MODE_RGB, 0x944E80 },
  1307. { 0xFF58A7, IR_BUTTON_MODE_EFFECT, LIGHT_EFFECT_FADE },
  1308. { 0xFF38C7, IR_BUTTON_MODE_RGB, 0xFFFF00 },
  1309. { 0xFF28D7, IR_BUTTON_MODE_RGB, 0x0060A1 },
  1310. { 0xFFF00F, IR_BUTTON_MODE_RGB, 0xEF45AD },
  1311. { 0xFF30CF, IR_BUTTON_MODE_EFFECT, LIGHT_EFFECT_SMOOTH }
  1312. };
  1313. #endif
  1314. //Remote Buttons SET 2 (another identical IR Remote shipped with another controller)
  1315. #if IR_BUTTON_SET == 2
  1316. /*
  1317. +------+------+------+------+
  1318. | UP | Down | OFF | ON |
  1319. +------+------+------+------+
  1320. | R | G | B | W |
  1321. +------+------+------+------+
  1322. | 1 | 2 | 3 |FLASH |
  1323. +------+------+------+------+
  1324. | 4 | 5 | 6 |STROBE|
  1325. +------+------+------+------+
  1326. | 7 | 8 | 9 | FADE |
  1327. +------+------+------+------+
  1328. | 10 | 11 | 12 |SMOOTH|
  1329. +------+------+------+------+
  1330. */
  1331. #define IR_BUTTON_COUNT 24
  1332. const unsigned long IR_BUTTON[IR_BUTTON_COUNT][3] PROGMEM = {
  1333. { 0xFF00FF, IR_BUTTON_MODE_BRIGHTER, 1 },
  1334. { 0xFF807F, IR_BUTTON_MODE_BRIGHTER, 0 },
  1335. { 0xFF40BF, IR_BUTTON_MODE_STATE, 0 },
  1336. { 0xFFC03F, IR_BUTTON_MODE_STATE, 1 },
  1337. { 0xFF20DF, IR_BUTTON_MODE_RGB, 0xFF0000 },
  1338. { 0xFFA05F, IR_BUTTON_MODE_RGB, 0x00FF00 },
  1339. { 0xFF609F, IR_BUTTON_MODE_RGB, 0x0000FF },
  1340. { 0xFFE01F, IR_BUTTON_MODE_RGB, 0xFFFFFF },
  1341. { 0xFF10EF, IR_BUTTON_MODE_RGB, 0xD13A01 },
  1342. { 0xFF906F, IR_BUTTON_MODE_RGB, 0x00E644 },
  1343. { 0xFF50AF, IR_BUTTON_MODE_RGB, 0x0040A7 },
  1344. { 0xFFD02F, IR_BUTTON_MODE_EFFECT, LIGHT_EFFECT_FLASH },
  1345. { 0xFF30CF, IR_BUTTON_MODE_RGB, 0xE96F2A },
  1346. { 0xFFB04F, IR_BUTTON_MODE_RGB, 0x00BEBF },
  1347. { 0xFF708F, IR_BUTTON_MODE_RGB, 0x56406F },
  1348. { 0xFFF00F, IR_BUTTON_MODE_EFFECT, LIGHT_EFFECT_STROBE },
  1349. { 0xFF08F7, IR_BUTTON_MODE_RGB, 0xEE9819 },
  1350. { 0xFF8877, IR_BUTTON_MODE_RGB, 0x00799A },
  1351. { 0xFF48B7, IR_BUTTON_MODE_RGB, 0x944E80 },
  1352. { 0xFFC837, IR_BUTTON_MODE_EFFECT, LIGHT_EFFECT_FADE },
  1353. { 0xFF28D7, IR_BUTTON_MODE_RGB, 0xFFFF00 },
  1354. { 0xFFA857, IR_BUTTON_MODE_RGB, 0x0060A1 },
  1355. { 0xFF6897, IR_BUTTON_MODE_RGB, 0xEF45AD },
  1356. { 0xFFE817, IR_BUTTON_MODE_EFFECT, LIGHT_EFFECT_SMOOTH }
  1357. };
  1358. #endif
  1359. //Remote Buttons SET 3 (samsung AA59-00608A 8 Toggle Buttons for generic 8CH module)
  1360. #if IR_BUTTON_SET == 3
  1361. /*
  1362. +------+------+------+
  1363. | 1 | 2 | 3 |
  1364. +------+------+------+
  1365. | 4 | 5 | 6 |
  1366. +------+------+------+
  1367. | 7 | 8 | 9 |
  1368. +------+------+------+
  1369. | | 0 | |
  1370. +------+------+------+
  1371. */
  1372. #define IR_BUTTON_COUNT 10
  1373. const unsigned long IR_BUTTON[IR_BUTTON_COUNT][3] PROGMEM = {
  1374. { 0xE0E020DF, IR_BUTTON_MODE_TOGGLE, 0 }, // Toggle Relay #0
  1375. { 0xE0E0A05F, IR_BUTTON_MODE_TOGGLE, 1 }, // Toggle Relay #1
  1376. { 0xE0E0609F, IR_BUTTON_MODE_TOGGLE, 2 }, // Toggle Relay #2
  1377. { 0xE0E010EF, IR_BUTTON_MODE_TOGGLE, 3 }, // Toggle Relay #3
  1378. { 0xE0E0906F, IR_BUTTON_MODE_TOGGLE, 4 }, // Toggle Relay #4
  1379. { 0xE0E050AF, IR_BUTTON_MODE_TOGGLE, 5 }, // Toggle Relay #5
  1380. { 0xE0E030CF, IR_BUTTON_MODE_TOGGLE, 6 }, // Toggle Relay #6
  1381. { 0xE0E0B04F, IR_BUTTON_MODE_TOGGLE, 7 } // Toggle Relay #7
  1382. //{ 0xE0E0708F, IR_BUTTON_MODE_TOGGLE, 8 } //Extra Button
  1383. //{ 0xE0E08877, IR_BUTTON_MODE_TOGGLE, 9 } //Extra Button
  1384. };
  1385. #endif
  1386. //Remote Buttons SET 4
  1387. #if IR_BUTTON_SET == 4
  1388. /*
  1389. +------+------+------+
  1390. | OFF | SRC | MUTE |
  1391. +------+------+------+
  1392. ...
  1393. +------+------+------+
  1394. */
  1395. #define IR_BUTTON_COUNT 1
  1396. const unsigned long IR_BUTTON[IR_BUTTON_COUNT][3] PROGMEM = {
  1397. { 0xFFB24D, IR_BUTTON_MODE_TOGGLE, 0 } // Toggle Relay #0
  1398. };
  1399. #endif
  1400. //Remote Buttons SET 5 (another identical IR Remote shipped with another controller as SET 1 and 2)
  1401. #if IR_BUTTON_SET == 5
  1402. /*
  1403. +------+------+------+------+
  1404. | UP | Down | OFF | ON |
  1405. +------+------+------+------+
  1406. | R | G | B | W |
  1407. +------+------+------+------+
  1408. | 1 | 2 | 3 |FLASH |
  1409. +------+------+------+------+
  1410. | 4 | 5 | 6 |STROBE|
  1411. +------+------+------+------+
  1412. | 7 | 8 | 9 | FADE |
  1413. +------+------+------+------+
  1414. | 10 | 11 | 12 |SMOOTH|
  1415. +------+------+------+------+
  1416. */
  1417. #define IR_BUTTON_COUNT 24
  1418. const unsigned long IR_BUTTON[IR_BUTTON_COUNT][3] PROGMEM = {
  1419. { 0xF700FF, IR_BUTTON_MODE_BRIGHTER, 1 },
  1420. { 0xF7807F, IR_BUTTON_MODE_BRIGHTER, 0 },
  1421. { 0xF740BF, IR_BUTTON_MODE_STATE, 0 },
  1422. { 0xF7C03F, IR_BUTTON_MODE_STATE, 1 },
  1423. { 0xF720DF, IR_BUTTON_MODE_RGB, 0xFF0000 },
  1424. { 0xF7A05F, IR_BUTTON_MODE_RGB, 0x00FF00 },
  1425. { 0xF7609F, IR_BUTTON_MODE_RGB, 0x0000FF },
  1426. { 0xF7E01F, IR_BUTTON_MODE_RGB, 0xFFFFFF },
  1427. { 0xF710EF, IR_BUTTON_MODE_RGB, 0xD13A01 },
  1428. { 0xF7906F, IR_BUTTON_MODE_RGB, 0x00E644 },
  1429. { 0xF750AF, IR_BUTTON_MODE_RGB, 0x0040A7 },
  1430. { 0xF7D02F, IR_BUTTON_MODE_EFFECT, LIGHT_EFFECT_FLASH },
  1431. { 0xF730CF, IR_BUTTON_MODE_RGB, 0xE96F2A },
  1432. { 0xF7B04F, IR_BUTTON_MODE_RGB, 0x00BEBF },
  1433. { 0xF7708F, IR_BUTTON_MODE_RGB, 0x56406F },
  1434. { 0xF7F00F, IR_BUTTON_MODE_EFFECT, LIGHT_EFFECT_STROBE },
  1435. { 0xF708F7, IR_BUTTON_MODE_RGB, 0xEE9819 },
  1436. { 0xF78877, IR_BUTTON_MODE_RGB, 0x00799A },
  1437. { 0xF748B7, IR_BUTTON_MODE_RGB, 0x944E80 },
  1438. { 0xF7C837, IR_BUTTON_MODE_EFFECT, LIGHT_EFFECT_FADE },
  1439. { 0xF728D7, IR_BUTTON_MODE_RGB, 0xFFFF00 },
  1440. { 0xF7A857, IR_BUTTON_MODE_RGB, 0x0060A1 },
  1441. { 0xF76897, IR_BUTTON_MODE_RGB, 0xEF45AD },
  1442. { 0xF7E817, IR_BUTTON_MODE_EFFECT, LIGHT_EFFECT_SMOOTH }
  1443. };
  1444. #endif
  1445. #ifndef IR_BUTTON_COUNT
  1446. #define IR_BUTTON_COUNT 0
  1447. #endif
  1448. //--------------------------------------------------------------------------------
  1449. // Custom RFM69 to MQTT bridge
  1450. // Check http://tinkerman.cat/rfm69-wifi-gateway/
  1451. // Enable support by passing RFM69_SUPPORT=1 build flag
  1452. //--------------------------------------------------------------------------------
  1453. #ifndef RFM69_SUPPORT
  1454. #define RFM69_SUPPORT 0
  1455. #endif
  1456. #ifndef RFM69_MAX_TOPICS
  1457. #define RFM69_MAX_TOPICS 50
  1458. #endif
  1459. #ifndef RFM69_MAX_NODES
  1460. #define RFM69_MAX_NODES 255
  1461. #endif
  1462. #ifndef RFM69_DEFAULT_TOPIC
  1463. #define RFM69_DEFAULT_TOPIC "/rfm69gw/{node}/{key}"
  1464. #endif
  1465. #ifndef RFM69_NODE_ID
  1466. #define RFM69_NODE_ID 1
  1467. #endif
  1468. #ifndef RFM69_GATEWAY_ID
  1469. #define RFM69_GATEWAY_ID 1
  1470. #endif
  1471. #ifndef RFM69_NETWORK_ID
  1472. #define RFM69_NETWORK_ID 164
  1473. #endif
  1474. #ifndef RFM69_PROMISCUOUS
  1475. #define RFM69_PROMISCUOUS 0
  1476. #endif
  1477. #ifndef RFM69_PROMISCUOUS_SENDS
  1478. #define RFM69_PROMISCUOUS_SENDS 0
  1479. #endif
  1480. #ifndef RFM69_FREQUENCY
  1481. #define RFM69_FREQUENCY RF69_868MHZ
  1482. #endif
  1483. #ifndef RFM69_ENCRYPTKEY
  1484. #define RFM69_ENCRYPTKEY "fibonacci0123456"
  1485. #endif
  1486. #ifndef RFM69_CS_PIN
  1487. #define RFM69_CS_PIN SS
  1488. #endif
  1489. #ifndef RFM69_IRQ_PIN
  1490. #define RFM69_IRQ_PIN 5
  1491. #endif
  1492. #ifndef RFM69_RESET_PIN
  1493. #define RFM69_RESET_PIN 7
  1494. #endif
  1495. #ifndef RFM69_IS_RFM69HW
  1496. #define RFM69_IS_RFM69HW 0
  1497. #endif
  1498. //--------------------------------------------------------------------------------
  1499. // TUYA switch & dimmer support
  1500. //--------------------------------------------------------------------------------
  1501. #ifndef TUYA_SUPPORT
  1502. #define TUYA_SUPPORT 0
  1503. #endif
  1504. #ifndef TUYA_SERIAL
  1505. #define TUYA_SERIAL Serial
  1506. #endif
  1507. // =============================================================================
  1508. // Configuration helpers
  1509. // =============================================================================
  1510. //------------------------------------------------------------------------------
  1511. // Provide generic way to detect debugging support
  1512. //------------------------------------------------------------------------------
  1513. #ifndef DEBUG_SUPPORT
  1514. #define DEBUG_SUPPORT ( \
  1515. DEBUG_SERIAL_SUPPORT || \
  1516. DEBUG_UDP_SUPPORT || \
  1517. DEBUG_TELNET_SUPPORT || \
  1518. DEBUG_WEB_SUPPORT \
  1519. )
  1520. #endif