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.

1801 lines
60 KiB

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