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.

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