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.

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