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.

1308 lines
44 KiB

7 years ago
7 years ago
7 years ago
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
8 years ago
8 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
8 years ago
8 years ago
6 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. #ifndef ADMIN_PASS
  10. #define ADMIN_PASS "fibonacci" // Default password (WEB, OTA, WIFI)
  11. #endif
  12. #ifndef USE_PASSWORD
  13. #define USE_PASSWORD 1 // Insecurity caution! Disabling this will disable password querying completely.
  14. #endif
  15. #ifndef LOOP_DELAY_TIME
  16. #define LOOP_DELAY_TIME 10 // Delay for this millis in the main loop [0-250]
  17. #endif
  18. #define ARRAYINIT(type, name, ...) \
  19. type name[] = {__VA_ARGS__};
  20. //------------------------------------------------------------------------------
  21. // TELNET
  22. //------------------------------------------------------------------------------
  23. #ifndef TELNET_SUPPORT
  24. #define TELNET_SUPPORT 1 // Enable telnet support by default (3.34Kb)
  25. #endif
  26. #ifndef TELNET_STA
  27. #define TELNET_STA 0 // By default, disallow connections via STA interface
  28. #endif
  29. #define TELNET_PORT 23 // Port to listen to telnet clients
  30. #define TELNET_MAX_CLIENTS 1 // Max number of concurrent telnet clients
  31. //------------------------------------------------------------------------------
  32. // DEBUG
  33. //------------------------------------------------------------------------------
  34. // Serial debug log
  35. #ifndef DEBUG_SERIAL_SUPPORT
  36. #define DEBUG_SERIAL_SUPPORT 1 // Enable serial debug log
  37. #endif
  38. #ifndef DEBUG_PORT
  39. #define DEBUG_PORT Serial // Default debugging port
  40. #endif
  41. #ifndef SERIAL_BAUDRATE
  42. #define SERIAL_BAUDRATE 115200 // Default baudrate
  43. #endif
  44. #ifndef DEBUG_ADD_TIMESTAMP
  45. #define DEBUG_ADD_TIMESTAMP 1 // Add timestamp to debug messages
  46. // (in millis overflowing every 1000 seconds)
  47. #endif
  48. // Second serial port (used for RX)
  49. #ifndef SERIAL_RX_ENABLED
  50. #define SERIAL_RX_ENABLED 0 // Secondary serial port for RX
  51. #endif
  52. #ifndef SERIAL_RX_PORT
  53. #define SERIAL_RX_PORT Serial // This setting is usually defined
  54. // in the hardware.h file for those
  55. // boards that require it
  56. #endif
  57. #ifndef SERIAL_RX_BAUDRATE
  58. #define SERIAL_RX_BAUDRATE 115200 // Default baudrate
  59. #endif
  60. //------------------------------------------------------------------------------
  61. // UDP debug log
  62. // To receive the message son the destination computer use nc:
  63. // nc -ul 8113
  64. #ifndef DEBUG_UDP_SUPPORT
  65. #define DEBUG_UDP_SUPPORT 0 // Enable UDP debug log
  66. #endif
  67. #ifndef DEBUG_UDP_IP
  68. #define DEBUG_UDP_IP IPAddress(192, 168, 1, 100)
  69. #endif
  70. #ifndef DEBUG_UDP_PORT
  71. #define DEBUG_UDP_PORT 8113
  72. #endif
  73. //------------------------------------------------------------------------------
  74. #ifndef DEBUG_TELNET_SUPPORT
  75. #define DEBUG_TELNET_SUPPORT TELNET_SUPPORT // Enable telnet debug log if telnet is enabled too
  76. #endif
  77. #if DEBUG_TELNET_SUPPORT
  78. #undef TELNET_SUPPORT
  79. #define TELNET_SUPPORT 1
  80. #endif
  81. //------------------------------------------------------------------------------
  82. #ifndef DEBUG_WEB_SUPPORT
  83. #define DEBUG_WEB_SUPPORT WEB_SUPPORT // Enable web debug log if web is enabled too
  84. #endif
  85. #if DEBUG_WEB_SUPPORT
  86. #undef WEB_SUPPORT
  87. #define WEB_SUPPORT 1 // Chicken and egg :)
  88. #endif
  89. #ifndef DEBUG_WEB_ENABLED
  90. #define DEBUG_WEB_ENABLED 1 // Enable debug output by default
  91. #endif
  92. //------------------------------------------------------------------------------
  93. // General debug options and macros
  94. #define DEBUG_SUPPORT DEBUG_SERIAL_SUPPORT || DEBUG_UDP_SUPPORT || DEBUG_TELNET_SUPPORT
  95. #if DEBUG_SUPPORT
  96. #define DEBUG_MSG(...) debugSend(__VA_ARGS__)
  97. #define DEBUG_MSG_P(...) debugSend_P(__VA_ARGS__)
  98. #endif
  99. #ifndef DEBUG_MSG
  100. #define DEBUG_MSG(...)
  101. #define DEBUG_MSG_P(...)
  102. #endif
  103. //------------------------------------------------------------------------------
  104. // TERMINAL
  105. //------------------------------------------------------------------------------
  106. #ifndef TERMINAL_SUPPORT
  107. #define TERMINAL_SUPPORT 1 // Enable terminal commands (0.97Kb)
  108. #endif
  109. #define TERMINAL_BUFFER_SIZE 128 // Max size for commands commands
  110. //------------------------------------------------------------------------------
  111. // SYSTEM CHECK
  112. //------------------------------------------------------------------------------
  113. #ifndef SYSTEM_CHECK_ENABLED
  114. #define SYSTEM_CHECK_ENABLED 1 // Enable crash check by default
  115. #endif
  116. #define SYSTEM_CHECK_TIME 60000 // The system is considered stable after these many millis
  117. #ifndef SYSTEM_CHECK_MAX
  118. #define SYSTEM_CHECK_MAX 5 // After this many crashes on boot
  119. // the system is flagged as unstable
  120. #endif
  121. //------------------------------------------------------------------------------
  122. // EEPROM
  123. //------------------------------------------------------------------------------
  124. #define EEPROM_SIZE 4096 // EEPROM size in bytes
  125. #define EEPROM_RELAY_STATUS 0 // Address for the relay status (1 byte)
  126. #define EEPROM_ENERGY_COUNT 1 // Address for the energy counter (4 bytes)
  127. #define EEPROM_CUSTOM_RESET 5 // Address for the reset reason (1 byte)
  128. #define EEPROM_CRASH_COUNTER 6 // Address for the crash counter (1 byte)
  129. #define EEPROM_MESSAGE_ID 7 // Address for the MQTT message id (4 bytes)
  130. #define EEPROM_DATA_END 11 // End of custom EEPROM data block
  131. //------------------------------------------------------------------------------
  132. // HEARTBEAT
  133. //------------------------------------------------------------------------------
  134. #ifndef HEARTBEAT_ENABLED
  135. #define HEARTBEAT_ENABLED 1
  136. #endif
  137. #define HEARTBEAT_INTERVAL 300000 // Interval between heartbeat messages (in ms)
  138. #define UPTIME_OVERFLOW 4294967295 // Uptime overflow value
  139. // Topics that will be reported in heartbeat
  140. #define HEARTBEAT_REPORT_STATUS 1
  141. #define HEARTBEAT_REPORT_IP 1
  142. #define HEARTBEAT_REPORT_MAC 1
  143. #define HEARTBEAT_REPORT_RSSI 1
  144. #define HEARTBEAT_REPORT_UPTIME 1
  145. #define HEARTBEAT_REPORT_DATETIME 1
  146. #define HEARTBEAT_REPORT_FREEHEAP 1
  147. #define HEARTBEAT_REPORT_VCC 1
  148. #define HEARTBEAT_REPORT_RELAY 1
  149. #define HEARTBEAT_REPORT_LIGHT 1
  150. #define HEARTBEAT_REPORT_HOSTNAME 1
  151. #define HEARTBEAT_REPORT_APP 1
  152. #define HEARTBEAT_REPORT_VERSION 1
  153. #define HEARTBEAT_REPORT_BOARD 1
  154. #define HEARTBEAT_REPORT_INTERVAL 0
  155. //------------------------------------------------------------------------------
  156. // Load average
  157. //------------------------------------------------------------------------------
  158. #ifndef LOADAVG_INTERVAL
  159. #define LOADAVG_INTERVAL 30000 // Interval between calculating load average (in ms)
  160. #endif
  161. #ifndef LOADAVG_REPORT
  162. #define LOADAVG_REPORT 1 // Should we report Load average over MQTT?
  163. #endif
  164. //------------------------------------------------------------------------------
  165. // RESET
  166. //------------------------------------------------------------------------------
  167. #define CUSTOM_RESET_HARDWARE 1 // Reset from hardware button
  168. #define CUSTOM_RESET_WEB 2 // Reset from web interface
  169. #define CUSTOM_RESET_TERMINAL 3 // Reset from terminal
  170. #define CUSTOM_RESET_MQTT 4 // Reset via MQTT
  171. #define CUSTOM_RESET_RPC 5 // Reset via RPC (HTTP)
  172. #define CUSTOM_RESET_OTA 6 // Reset after successful OTA update
  173. #define CUSTOM_RESET_HTTP 7 // Reset via HTTP GET
  174. #define CUSTOM_RESET_NOFUSS 8 // Reset after successful NOFUSS update
  175. #define CUSTOM_RESET_UPGRADE 9 // Reset after update from web interface
  176. #define CUSTOM_RESET_FACTORY 10 // Factory reset from terminal
  177. #define CUSTOM_RESET_MAX 10
  178. PROGMEM const char custom_reset_hardware[] = "Hardware button";
  179. PROGMEM const char custom_reset_web[] = "Reboot from web interface";
  180. PROGMEM const char custom_reset_terminal[] = "Reboot from terminal";
  181. PROGMEM const char custom_reset_mqtt[] = "Reboot from MQTT";
  182. PROGMEM const char custom_reset_rpc[] = "Reboot from RPC";
  183. PROGMEM const char custom_reset_ota[] = "Reboot after successful OTA update";
  184. PROGMEM const char custom_reset_http[] = "Reboot from HTTP";
  185. PROGMEM const char custom_reset_nofuss[] = "Reboot after successful NoFUSS update";
  186. PROGMEM const char custom_reset_upgrade[] = "Reboot after successful web update";
  187. PROGMEM const char custom_reset_factory[] = "Factory reset";
  188. PROGMEM const char* const custom_reset_string[] = {
  189. custom_reset_hardware, custom_reset_web, custom_reset_terminal,
  190. custom_reset_mqtt, custom_reset_rpc, custom_reset_ota,
  191. custom_reset_http, custom_reset_nofuss, custom_reset_upgrade,
  192. custom_reset_factory
  193. };
  194. //------------------------------------------------------------------------------
  195. // BUTTON
  196. //------------------------------------------------------------------------------
  197. #ifndef BUTTON_DEBOUNCE_DELAY
  198. #define BUTTON_DEBOUNCE_DELAY 50 // Debounce delay (ms)
  199. #endif
  200. #ifndef BUTTON_DBLCLICK_DELAY
  201. #define BUTTON_DBLCLICK_DELAY 500 // Time in ms to wait for a second (or third...) click
  202. #endif
  203. #ifndef BUTTON_LNGCLICK_DELAY
  204. #define BUTTON_LNGCLICK_DELAY 1000 // Time in ms holding the button down to get a long click
  205. #endif
  206. #ifndef BUTTON_LNGLNGCLICK_DELAY
  207. #define BUTTON_LNGLNGCLICK_DELAY 10000 // Time in ms holding the button down to get a long-long click
  208. #endif
  209. #define BUTTON_EVENT_NONE 0
  210. #define BUTTON_EVENT_PRESSED 1
  211. #define BUTTON_EVENT_RELEASED 2
  212. #define BUTTON_EVENT_CLICK 2
  213. #define BUTTON_EVENT_DBLCLICK 3
  214. #define BUTTON_EVENT_LNGCLICK 4
  215. #define BUTTON_EVENT_LNGLNGCLICK 5
  216. #define BUTTON_MODE_NONE 0
  217. #define BUTTON_MODE_TOGGLE 1
  218. #define BUTTON_MODE_ON 2
  219. #define BUTTON_MODE_OFF 3
  220. #define BUTTON_MODE_AP 4
  221. #define BUTTON_MODE_RESET 5
  222. #define BUTTON_MODE_PULSE 6
  223. #define BUTTON_MODE_FACTORY 7
  224. //------------------------------------------------------------------------------
  225. // RELAY
  226. //------------------------------------------------------------------------------
  227. #define RELAY_BOOT_OFF 0
  228. #define RELAY_BOOT_ON 1
  229. #define RELAY_BOOT_SAME 2
  230. #define RELAY_BOOT_TOGGLE 3
  231. #define RELAY_TYPE_NORMAL 0
  232. #define RELAY_TYPE_INVERSE 1
  233. #define RELAY_TYPE_LATCHED 2
  234. #define RELAY_TYPE_LATCHED_INVERSE 3
  235. #define RELAY_SYNC_ANY 0
  236. #define RELAY_SYNC_NONE_OR_ONE 1
  237. #define RELAY_SYNC_ONE 2
  238. #define RELAY_SYNC_SAME 3
  239. #define RELAY_PULSE_NONE 0
  240. #define RELAY_PULSE_OFF 1
  241. #define RELAY_PULSE_ON 2
  242. #define RELAY_PROVIDER_RELAY 0
  243. #define RELAY_PROVIDER_DUAL 1
  244. #define RELAY_PROVIDER_LIGHT 2
  245. #define RELAY_PROVIDER_RFBRIDGE 3
  246. #define RELAY_PROVIDER_STM 4
  247. // Default boot mode: 0 means OFF, 1 ON and 2 whatever was before
  248. #ifndef RELAY_BOOT_MODE
  249. #define RELAY_BOOT_MODE RELAY_BOOT_OFF
  250. #endif
  251. // 0 means ANY, 1 zero or one and 2 one and only one
  252. #ifndef RELAY_SYNC
  253. #define RELAY_SYNC RELAY_SYNC_ANY
  254. #endif
  255. // Default pulse mode: 0 means no pulses, 1 means normally off, 2 normally on
  256. #ifndef RELAY_PULSE_MODE
  257. #define RELAY_PULSE_MODE RELAY_PULSE_NONE
  258. #endif
  259. // Default pulse time in seconds
  260. #ifndef RELAY_PULSE_TIME
  261. #define RELAY_PULSE_TIME 1.0
  262. #endif
  263. // Relay requests flood protection window - in seconds
  264. #ifndef RELAY_FLOOD_WINDOW
  265. #define RELAY_FLOOD_WINDOW 3
  266. #endif
  267. // Allowed actual relay changes inside requests flood protection window
  268. #ifndef RELAY_FLOOD_CHANGES
  269. #define RELAY_FLOOD_CHANGES 5
  270. #endif
  271. // Pulse with in milliseconds for a latched relay
  272. #ifndef RELAY_LATCHING_PULSE
  273. #define RELAY_LATCHING_PULSE 10
  274. #endif
  275. // Do not save relay state after these many milliseconds
  276. #ifndef RELAY_SAVE_DELAY
  277. #define RELAY_SAVE_DELAY 1000
  278. #endif
  279. //------------------------------------------------------------------------------
  280. // LED
  281. //------------------------------------------------------------------------------
  282. #define LED_MODE_MQTT 0 // LED will be managed from MQTT (OFF by default)
  283. #define LED_MODE_WIFI 1 // LED will blink according to the WIFI status
  284. #define LED_MODE_FOLLOW 2 // LED will follow state of linked relay (check RELAY#_LED)
  285. #define LED_MODE_FOLLOW_INVERSE 3 // LED will follow the opposite state of linked relay (check RELAY#_LED)
  286. #define LED_MODE_FINDME 4 // LED will be ON if all relays are OFF
  287. #define LED_MODE_FINDME_WIFI 5 // A mixture between WIFI and FINDME
  288. #define LED_MODE_ON 6 // LED always ON
  289. #define LED_MODE_OFF 7 // LED always OFF
  290. #define LED_MODE_RELAY 8 // If any relay is ON, LED will be ON, otherwise OFF
  291. #define LED_MODE_RELAY_WIFI 9 // A mixture between WIFI and RELAY, the reverse of MIXED
  292. // -----------------------------------------------------------------------------
  293. // WIFI
  294. // -----------------------------------------------------------------------------
  295. #ifndef WIFI_CONNECT_TIMEOUT
  296. #define WIFI_CONNECT_TIMEOUT 60000 // Connecting timeout for WIFI in ms
  297. #endif
  298. #ifndef WIFI_RECONNECT_INTERVAL
  299. #define WIFI_RECONNECT_INTERVAL 180000 // If could not connect to WIFI, retry after this time in ms
  300. #endif
  301. #define WIFI_MAX_NETWORKS 5 // Max number of WIFI connection configurations
  302. #ifndef WIFI_AP_MODE
  303. #define WIFI_AP_MODE AP_MODE_ALONE
  304. #endif
  305. #ifndef WIFI_SLEEP_MODE
  306. #define WIFI_SLEEP_MODE WIFI_NONE_SLEEP // WIFI_NONE_SLEEP, WIFI_LIGHT_SLEEP or WIFI_MODEM_SLEEP
  307. #endif
  308. #ifndef WIFI_SCAN_NETWORKS
  309. #define WIFI_SCAN_NETWORKS 1 // Perform a network scan before connecting
  310. #endif
  311. // Optional hardcoded configuration (up to 2 networks)
  312. #ifndef WIFI1_SSID
  313. #define WIFI1_SSID ""
  314. #ifndef WIFI1_PASS
  315. #define WIFI1_PASS ""
  316. #endif
  317. #ifndef WIFI1_IP
  318. #define WIFI1_IP ""
  319. #endif
  320. #ifndef WIFI1_GW
  321. #define WIFI1_GW ""
  322. #endif
  323. #ifndef WIFI1_MASK
  324. #define WIFI1_MASK ""
  325. #endif
  326. #ifndef WIFI1_DNS
  327. #define WIFI1_DNS ""
  328. #endif
  329. #endif // WIFI1
  330. #ifndef WIFI2_SSID
  331. #define WIFI2_SSID ""
  332. #ifndef WIFI2_PASS
  333. #define WIFI2_PASS ""
  334. #endif
  335. #ifndef WIFI2_IP
  336. #define WIFI2_IP ""
  337. #endif
  338. #ifndef WIFI2_GW
  339. #define WIFI2_GW ""
  340. #endif
  341. #ifndef WIFI2_MASK
  342. #define WIFI2_MASK ""
  343. #endif
  344. #ifndef WIFI2_DNS
  345. #define WIFI2_DNS ""
  346. #endif
  347. #endif // WIFI2
  348. #ifndef WIFI_RSSI_1M
  349. #define WIFI_RSSI_1M -30 // Calibrate it with your router reading the RSSI at 1m
  350. #endif
  351. #ifndef WIFI_PROPAGATION_CONST
  352. #define WIFI_PROPAGATION_CONST 4 // This is typically something between 2.7 to 4.3 (free space is 2)
  353. #endif
  354. // -----------------------------------------------------------------------------
  355. // WEB
  356. // -----------------------------------------------------------------------------
  357. #ifndef WEB_SUPPORT
  358. #define WEB_SUPPORT 1 // Enable web support (http, api, 121.65Kb)
  359. #endif
  360. #ifndef WEB_EMBEDDED
  361. #define WEB_EMBEDDED 1 // Build the firmware with the web interface embedded in
  362. #endif
  363. // This is not working at the moment!!
  364. // Requires ASYNC_TCP_SSL_ENABLED to 1 and ESP8266 Arduino Core 2.4.0
  365. #ifndef WEB_SSL_ENABLED
  366. #define WEB_SSL_ENABLED 0 // Use HTTPS web interface
  367. #endif
  368. #ifndef WEB_USERNAME
  369. #define WEB_USERNAME "admin" // HTTP username
  370. #endif
  371. #ifndef WEB_FORCE_PASS_CHANGE
  372. #define WEB_FORCE_PASS_CHANGE 1 // Force the user to change the password if default one
  373. #endif
  374. #ifndef WEB_PORT
  375. #define WEB_PORT 80 // HTTP port
  376. #endif
  377. // -----------------------------------------------------------------------------
  378. // WEBSOCKETS
  379. // -----------------------------------------------------------------------------
  380. // This will only be enabled if WEB_SUPPORT is 1 (this is the default value)
  381. #ifndef WS_AUTHENTICATION
  382. #define WS_AUTHENTICATION 1 // WS authentication ON by default (see #507)
  383. #endif
  384. #ifndef WS_BUFFER_SIZE
  385. #define WS_BUFFER_SIZE 5 // Max number of secured websocket connections
  386. #endif
  387. #ifndef WS_TIMEOUT
  388. #define WS_TIMEOUT 1800000 // Timeout for secured websocket
  389. #endif
  390. #ifndef WS_UPDATE_INTERVAL
  391. #define WS_UPDATE_INTERVAL 30000 // Update clients every 30 seconds
  392. #endif
  393. // -----------------------------------------------------------------------------
  394. // API
  395. // -----------------------------------------------------------------------------
  396. // This will only be enabled if WEB_SUPPORT is 1 (this is the default value)
  397. #ifndef API_ENABLED
  398. #define API_ENABLED 0 // Do not enable API by default
  399. #endif
  400. #ifndef API_BUFFER_SIZE
  401. #define API_BUFFER_SIZE 15 // Size of the buffer for HTTP GET API responses
  402. #endif
  403. #ifndef API_REAL_TIME_VALUES
  404. #define API_REAL_TIME_VALUES 0 // Show filtered/median values by default (0 => median, 1 => real time)
  405. #endif
  406. // -----------------------------------------------------------------------------
  407. // UI
  408. // -----------------------------------------------------------------------------
  409. #define UI_TAG_INPUT 0
  410. #define UI_TAG_CHECKBOX 1
  411. #define UI_TAG_SELECT 2
  412. // -----------------------------------------------------------------------------
  413. // MDNS / LLMNR / NETBIOS / SSDP
  414. // -----------------------------------------------------------------------------
  415. #ifndef MDNS_SERVER_SUPPORT
  416. #define MDNS_SERVER_SUPPORT 1 // Publish services using mDNS by default (1.48Kb)
  417. #endif
  418. #ifndef MDNS_CLIENT_SUPPORT
  419. #define MDNS_CLIENT_SUPPORT 0 // Resolve mDNS names (3.44Kb)
  420. #endif
  421. #ifndef LLMNR_SUPPORT
  422. #define LLMNR_SUPPORT 0 // Publish device using LLMNR protocol by default (1.95Kb) - requires 2.4.0
  423. #endif
  424. #ifndef NETBIOS_SUPPORT
  425. #define NETBIOS_SUPPORT 0 // Publish device using NetBIOS protocol by default (1.26Kb) - requires 2.4.0
  426. #endif
  427. #ifndef SSDP_SUPPORT
  428. #define SSDP_SUPPORT 0 // Publish device using SSDP protocol by default (4.59Kb)
  429. // Not compatible with ALEXA_SUPPORT at the moment
  430. #endif
  431. #ifndef SSDP_DEVICE_TYPE
  432. #define SSDP_DEVICE_TYPE "upnp:rootdevice"
  433. //#define SSDP_DEVICE_TYPE "urn:schemas-upnp-org:device:BinaryLight:1"
  434. #endif
  435. #if WEB_SUPPORT == 0
  436. #undef SSDP_SUPPORT
  437. #define SSDP_SUPPORT 0 // SSDP support requires web support
  438. #endif
  439. // -----------------------------------------------------------------------------
  440. // SPIFFS
  441. // -----------------------------------------------------------------------------
  442. #ifndef SPIFFS_SUPPORT
  443. #define SPIFFS_SUPPORT 0 // Do not add support for SPIFFS by default
  444. #endif
  445. // -----------------------------------------------------------------------------
  446. // OTA
  447. // -----------------------------------------------------------------------------
  448. #ifndef OTA_PORT
  449. #define OTA_PORT 8266 // OTA port
  450. #endif
  451. #define OTA_GITHUB_FP "D7:9F:07:61:10:B3:92:93:E3:49:AC:89:84:5B:03:80:C1:9E:2F:8B"
  452. // -----------------------------------------------------------------------------
  453. // NOFUSS
  454. // -----------------------------------------------------------------------------
  455. #ifndef NOFUSS_SUPPORT
  456. #define NOFUSS_SUPPORT 0 // Do not enable support for NoFuss by default (12.65Kb)
  457. #endif
  458. #ifndef NOFUSS_ENABLED
  459. #define NOFUSS_ENABLED 0 // Do not perform NoFUSS updates by default
  460. #endif
  461. #ifndef NOFUSS_SERVER
  462. #define NOFUSS_SERVER "" // Default NoFuss Server
  463. #endif
  464. #ifndef NOFUSS_INTERVAL
  465. #define NOFUSS_INTERVAL 3600000 // Check for updates every hour
  466. #endif
  467. // -----------------------------------------------------------------------------
  468. // UART <-> MQTT
  469. // -----------------------------------------------------------------------------
  470. #ifndef UART_MQTT_SUPPORT
  471. #define UART_MQTT_SUPPORT 0 // No support by default
  472. #endif
  473. #ifndef UART_MQTT_USE_SOFT
  474. #define UART_MQTT_USE_SOFT 0 // Use SoftwareSerial
  475. #endif
  476. #ifndef UART_MQTT_HW_PORT
  477. #define UART_MQTT_HW_PORT Serial // Hardware serial port (if UART_MQTT_USE_SOFT == 0)
  478. #endif
  479. #ifndef UART_MQTT_RX_PIN
  480. #define UART_MQTT_RX_PIN 4 // RX PIN (if UART_MQTT_USE_SOFT == 1)
  481. #endif
  482. #ifndef UART_MQTT_TX_PIN
  483. #define UART_MQTT_TX_PIN 5 // TX PIN (if UART_MQTT_USE_SOFT == 1)
  484. #endif
  485. #ifndef UART_MQTT_BAUDRATE
  486. #define UART_MQTT_BAUDRATE 115200 // Serial speed
  487. #endif
  488. #define UART_MQTT_BUFFER_SIZE 100 // UART buffer size
  489. #if UART_MQTT_SUPPORT
  490. #define MQTT_SUPPORT 1
  491. #undef TERMINAL_SUPPORT
  492. #define TERMINAL_SUPPORT 0
  493. #undef DEBUG_SERIAL_SUPPORT
  494. #define DEBUG_SERIAL_SUPPORT 0
  495. #endif
  496. // -----------------------------------------------------------------------------
  497. // MQTT
  498. // -----------------------------------------------------------------------------
  499. #ifndef MQTT_SUPPORT
  500. #define MQTT_SUPPORT 1 // MQTT support (22.38Kb async, 12.48Kb sync)
  501. #endif
  502. #ifndef MQTT_USE_ASYNC
  503. #define MQTT_USE_ASYNC 1 // Use AysncMQTTClient (1) or PubSubClient (0)
  504. #endif
  505. // MQTT OVER SSL
  506. // Using MQTT over SSL works pretty well but generates problems with the web interface.
  507. // It could be a good idea to use it in conjuntion with WEB_SUPPORT=0.
  508. // Requires ASYNC_TCP_SSL_ENABLED to 1 and ESP8266 Arduino Core 2.4.0.
  509. //
  510. // You can use SSL with MQTT_USE_ASYNC=1 (AsyncMqttClient library)
  511. // but you might experience hiccups on the web interface, so my recommendation is:
  512. // WEB_SUPPORT=0
  513. //
  514. // If you use SSL with MQTT_USE_ASYNC=0 (PubSubClient library)
  515. // you will have to disable all the modules that use ESPAsyncTCP, that is:
  516. // ALEXA_SUPPORT=0, INFLUXDB_SUPPORT=0, TELNET_SUPPORT=0, THINGSPEAK_SUPPORT=0 and WEB_SUPPORT=0
  517. //
  518. // You will need the fingerprint for your MQTT server, example for CloudMQTT:
  519. // $ echo -n | openssl s_client -connect m11.cloudmqtt.com:24055 > cloudmqtt.pem
  520. // $ openssl x509 -noout -in cloudmqtt.pem -fingerprint -sha1
  521. #ifndef MQTT_SSL_ENABLED
  522. #define MQTT_SSL_ENABLED 0 // By default MQTT over SSL will not be enabled
  523. #endif
  524. #ifndef MQTT_SSL_FINGERPRINT
  525. #define MQTT_SSL_FINGERPRINT "" // SSL fingerprint of the server
  526. #endif
  527. #ifndef MQTT_ENABLED
  528. #define MQTT_ENABLED 0 // Do not enable MQTT connection by default
  529. #endif
  530. #ifndef MQTT_AUTOCONNECT
  531. #define MQTT_AUTOCONNECT 1 // If enabled and MDNS_SERVER_SUPPORT=1 will perform an autodiscover and
  532. #endif
  533. // autoconnect to the first MQTT broker found if none defined
  534. #ifndef MQTT_SERVER
  535. #define MQTT_SERVER "" // Default MQTT broker address
  536. #endif
  537. #ifndef MQTT_USER
  538. #define MQTT_USER "" // Default MQTT broker usename
  539. #endif
  540. #ifndef MQTT_PASS
  541. #define MQTT_PASS "" // Default MQTT broker password
  542. #endif
  543. #ifndef MQTT_PORT
  544. #define MQTT_PORT 1883 // MQTT broker port
  545. #endif
  546. #ifndef MQTT_TOPIC
  547. #define MQTT_TOPIC "{hostname}" // Default MQTT base topic
  548. #endif
  549. #ifndef MQTT_RETAIN
  550. #define MQTT_RETAIN true // MQTT retain flag
  551. #endif
  552. #ifndef MQTT_QOS
  553. #define MQTT_QOS 0 // MQTT QoS value for all messages
  554. #endif
  555. #ifndef MQTT_KEEPALIVE
  556. #define MQTT_KEEPALIVE 30 // MQTT keepalive value
  557. #endif
  558. #ifndef MQTT_RECONNECT_DELAY_MIN
  559. #define MQTT_RECONNECT_DELAY_MIN 5000 // Try to reconnect in 5 seconds upon disconnection
  560. #endif
  561. #ifndef MQTT_RECONNECT_DELAY_STEP
  562. #define MQTT_RECONNECT_DELAY_STEP 5000 // Increase the reconnect delay in 5 seconds after each failed attempt
  563. #endif
  564. #ifndef MQTT_RECONNECT_DELAY_MAX
  565. #define MQTT_RECONNECT_DELAY_MAX 120000 // Set reconnect time to 2 minutes at most
  566. #endif
  567. #ifndef MQTT_SKIP_RETAINED
  568. #define MQTT_SKIP_RETAINED 1 // Skip retained messages on connection
  569. #endif
  570. #ifndef MQTT_SKIP_TIME
  571. #define MQTT_SKIP_TIME 1000 // Skip messages for 1 second anter connection
  572. #endif
  573. #ifndef MQTT_USE_JSON
  574. #define MQTT_USE_JSON 0 // Group messages in a JSON body
  575. #endif
  576. #ifndef MQTT_USE_JSON_DELAY
  577. #define MQTT_USE_JSON_DELAY 100 // Wait this many ms before grouping messages
  578. #endif
  579. #ifndef MQTT_QUEUE_MAX_SIZE
  580. #define MQTT_QUEUE_MAX_SIZE 20 // Size of the MQTT queue when MQTT_USE_JSON is enabled
  581. #endif
  582. // These are the properties that will be sent when useJson is true
  583. #ifndef MQTT_ENQUEUE_IP
  584. #define MQTT_ENQUEUE_IP 1
  585. #endif
  586. #ifndef MQTT_ENQUEUE_MAC
  587. #define MQTT_ENQUEUE_MAC 1
  588. #endif
  589. #ifndef MQTT_ENQUEUE_HOSTNAME
  590. #define MQTT_ENQUEUE_HOSTNAME 1
  591. #endif
  592. #ifndef MQTT_ENQUEUE_DATETIME
  593. #define MQTT_ENQUEUE_DATETIME 1
  594. #endif
  595. #ifndef MQTT_ENQUEUE_MESSAGE_ID
  596. #define MQTT_ENQUEUE_MESSAGE_ID 1
  597. #endif
  598. // These particles will be concatenated to the MQTT_TOPIC base to form the actual topic
  599. #define MQTT_TOPIC_JSON "data"
  600. #define MQTT_TOPIC_ACTION "action"
  601. #define MQTT_TOPIC_RELAY "relay"
  602. #define MQTT_TOPIC_LED "led"
  603. #define MQTT_TOPIC_BUTTON "button"
  604. #define MQTT_TOPIC_IP "ip"
  605. #define MQTT_TOPIC_VERSION "version"
  606. #define MQTT_TOPIC_UPTIME "uptime"
  607. #define MQTT_TOPIC_DATETIME "datetime"
  608. #define MQTT_TOPIC_FREEHEAP "freeheap"
  609. #define MQTT_TOPIC_VCC "vcc"
  610. #define MQTT_TOPIC_STATUS "status"
  611. #define MQTT_TOPIC_MAC "mac"
  612. #define MQTT_TOPIC_RSSI "rssi"
  613. #define MQTT_TOPIC_MESSAGE_ID "id"
  614. #define MQTT_TOPIC_APP "app"
  615. #define MQTT_TOPIC_INTERVAL "interval"
  616. #define MQTT_TOPIC_HOSTNAME "host"
  617. #define MQTT_TOPIC_TIME "time"
  618. #define MQTT_TOPIC_RFOUT "rfout"
  619. #define MQTT_TOPIC_RFIN "rfin"
  620. #define MQTT_TOPIC_RFLEARN "rflearn"
  621. #define MQTT_TOPIC_RFRAW "rfraw"
  622. #define MQTT_TOPIC_UARTIN "uartin"
  623. #define MQTT_TOPIC_UARTOUT "uartout"
  624. #define MQTT_TOPIC_LOADAVG "loadavg"
  625. #define MQTT_TOPIC_BOARD "board"
  626. // Light module
  627. #define MQTT_TOPIC_CHANNEL "channel"
  628. #define MQTT_TOPIC_COLOR_RGB "rgb"
  629. #define MQTT_TOPIC_COLOR_HSV "hsv"
  630. #define MQTT_TOPIC_ANIM_MODE "anim_mode"
  631. #define MQTT_TOPIC_ANIM_SPEED "anim_speed"
  632. #define MQTT_TOPIC_BRIGHTNESS "brightness"
  633. #define MQTT_TOPIC_MIRED "mired"
  634. #define MQTT_TOPIC_KELVIN "kelvin"
  635. #define MQTT_STATUS_ONLINE "1" // Value for the device ON message
  636. #define MQTT_STATUS_OFFLINE "0" // Value for the device OFF message (will)
  637. #define MQTT_ACTION_RESET "reboot" // RESET MQTT topic particle
  638. // Internal MQTT events (do not change)
  639. #define MQTT_CONNECT_EVENT 0
  640. #define MQTT_DISCONNECT_EVENT 1
  641. #define MQTT_MESSAGE_EVENT 2
  642. #define MQTT_MESSAGE_ID_SHIFT 1000 // Store MQTT message id into EEPROM every these many
  643. // Custom get and set postfixes
  644. // Use something like "/status" or "/set", with leading slash
  645. // Since 1.9.0 the default value is "" for getter and "/set" for setter
  646. #ifndef MQTT_GETTER
  647. #define MQTT_GETTER ""
  648. #endif
  649. #ifndef MQTT_SETTER
  650. #define MQTT_SETTER "/set"
  651. #endif
  652. // -----------------------------------------------------------------------------
  653. // BROKER
  654. // -----------------------------------------------------------------------------
  655. #ifndef BROKER_SUPPORT
  656. #define BROKER_SUPPORT 1 // The broker is a poor-man's pubsub manager
  657. #endif
  658. // -----------------------------------------------------------------------------
  659. // SETTINGS
  660. // -----------------------------------------------------------------------------
  661. #ifndef SETTINGS_AUTOSAVE
  662. #define SETTINGS_AUTOSAVE 1 // Autosave settings o force manual commit
  663. #endif
  664. #define SETTINGS_MAX_LIST_COUNT 10 // Maximum index for settings lists
  665. // -----------------------------------------------------------------------------
  666. // LIGHT
  667. // -----------------------------------------------------------------------------
  668. // Available light providers (do not change)
  669. #define LIGHT_PROVIDER_NONE 0
  670. #define LIGHT_PROVIDER_MY92XX 1 // works with MY9291 and MY9231
  671. #define LIGHT_PROVIDER_DIMMER 2
  672. // LIGHT_PROVIDER_DIMMER can have from 1 to 5 different channels.
  673. // They have to be defined for each device in the hardware.h file.
  674. // If 3 or more channels first 3 will be considered RGB.
  675. // Usual configurations are:
  676. // 1 channels => W
  677. // 2 channels => WW
  678. // 3 channels => RGB
  679. // 4 channels => RGBW
  680. // 5 channels => RGBWW
  681. #ifndef LIGHT_SAVE_ENABLED
  682. #define LIGHT_SAVE_ENABLED 1 // Light channel values saved by default after each change
  683. #endif
  684. #ifndef LIGHT_SAVE_DELAY
  685. #define LIGHT_SAVE_DELAY 5 // Persist color after 5 seconds to avoid wearing out
  686. #endif
  687. #ifndef LIGHT_MAX_PWM
  688. #if LIGHT_PROVIDER == LIGHT_PROVIDER_MY92XX
  689. #define LIGHT_MAX_PWM 255
  690. #endif
  691. #if LIGHT_PROVIDER == LIGHT_PROVIDER_DIMMER
  692. #define LIGHT_MAX_PWM 10000 // 5000 * 200ns => 1 kHz
  693. #endif
  694. #endif // LIGHT_MAX_PWM
  695. #ifndef LIGHT_LIMIT_PWM
  696. #define LIGHT_LIMIT_PWM LIGHT_MAX_PWM // Limit PWM to this value (prevent 100% power)
  697. #endif
  698. #ifndef LIGHT_MAX_VALUE
  699. #define LIGHT_MAX_VALUE 255 // Maximum light value
  700. #endif
  701. #ifndef LIGHT_MAX_BRIGHTNESS
  702. #define LIGHT_MAX_BRIGHTNESS 255 // Maximun brightness value
  703. #endif
  704. //#define LIGHT_MIN_MIREDS 153 // NOT USED (yet)! // Default to the Philips Hue value that HA has always assumed
  705. //#define LIGHT_MAX_MIREDS 500 // NOT USED (yet)! // https://developers.meethue.com/documentation/core-concepts
  706. #ifndef LIGHT_DEFAULT_MIREDS
  707. #define LIGHT_DEFAULT_MIREDS 153 // Default value used by MQTT. This value is __NEVRER__ applied!
  708. #endif
  709. #ifndef LIGHT_STEP
  710. #define LIGHT_STEP 32 // Step size
  711. #endif
  712. #ifndef LIGHT_USE_COLOR
  713. #define LIGHT_USE_COLOR 1 // Use 3 first channels as RGB
  714. #endif
  715. #ifndef LIGHT_USE_WHITE
  716. #define LIGHT_USE_WHITE 0 // Use white channel whenever RGB have the same value
  717. #endif
  718. #ifndef LIGHT_USE_GAMMA
  719. #define LIGHT_USE_GAMMA 0 // Use gamma correction for color channels
  720. #endif
  721. #ifndef LIGHT_USE_CSS
  722. #define LIGHT_USE_CSS 1 // Use CSS style to report colors (1=> "#FF0000", 0=> "255,0,0")
  723. #endif
  724. #ifndef LIGHT_USE_RGB
  725. #define LIGHT_USE_RGB 0 // Use RGB color selector (1=> RGB, 0=> HSV)
  726. #endif
  727. #ifndef LIGHT_USE_TRANSITIONS
  728. #define LIGHT_USE_TRANSITIONS 1 // Transitions between colors
  729. #endif
  730. #ifndef LIGHT_TRANSITION_STEP
  731. #define LIGHT_TRANSITION_STEP 10 // Time in millis between each transtion step
  732. #endif
  733. #ifndef LIGHT_TRANSITION_TIME
  734. #define LIGHT_TRANSITION_TIME 500 // Time in millis from color to color
  735. #endif
  736. // -----------------------------------------------------------------------------
  737. // DOMOTICZ
  738. // -----------------------------------------------------------------------------
  739. #ifndef DOMOTICZ_SUPPORT
  740. #define DOMOTICZ_SUPPORT MQTT_SUPPORT // Build with domoticz (if MQTT) support (1.72Kb)
  741. #endif
  742. #if DOMOTICZ_SUPPORT
  743. #undef MQTT_SUPPORT
  744. #define MQTT_SUPPORT 1 // If Domoticz enabled enable MQTT
  745. #endif
  746. #define DOMOTICZ_ENABLED 0 // Disable domoticz by default
  747. #define DOMOTICZ_IN_TOPIC "domoticz/in" // Default subscription topic
  748. #define DOMOTICZ_OUT_TOPIC "domoticz/out" // Default publication topic
  749. // -----------------------------------------------------------------------------
  750. // HOME ASSISTANT
  751. // -----------------------------------------------------------------------------
  752. #ifndef HOMEASSISTANT_SUPPORT
  753. #define HOMEASSISTANT_SUPPORT MQTT_SUPPORT // Build with home assistant support (if MQTT, 1.64Kb)
  754. #endif
  755. #if HOMEASSISTANT_SUPPORT
  756. #undef MQTT_SUPPORT
  757. #define MQTT_SUPPORT 1 // If Home Assistant enabled enable MQTT
  758. #endif
  759. #define HOMEASSISTANT_ENABLED 0 // Integration not enabled by default
  760. #define HOMEASSISTANT_PREFIX "homeassistant" // Default MQTT prefix
  761. // -----------------------------------------------------------------------------
  762. // INFLUXDB
  763. // -----------------------------------------------------------------------------
  764. #ifndef INFLUXDB_SUPPORT
  765. #define INFLUXDB_SUPPORT 0 // Disable InfluxDB support by default (4.38Kb)
  766. #endif
  767. #ifndef INFLUXDB_ENABLED
  768. #define INFLUXDB_ENABLED 0 // InfluxDB disabled by default
  769. #endif
  770. #ifndef INFLUXDB_HOST
  771. #define INFLUXDB_HOST "" // Default server
  772. #endif
  773. #ifndef INFLUXDB_PORT
  774. #define INFLUXDB_PORT 8086 // Default InfluxDB port
  775. #endif
  776. #ifndef INFLUXDB_DATABASE
  777. #define INFLUXDB_DATABASE "" // Default database
  778. #endif
  779. #ifndef INFLUXDB_USERNAME
  780. #define INFLUXDB_USERNAME "" // Default username
  781. #endif
  782. #ifndef INFLUXDB_PASSWORD
  783. #define INFLUXDB_PASSWORD "" // Default password
  784. #endif
  785. // -----------------------------------------------------------------------------
  786. // THINGSPEAK
  787. // -----------------------------------------------------------------------------
  788. #ifndef THINGSPEAK_SUPPORT
  789. #define THINGSPEAK_SUPPORT 1 // Enable Thingspeak support by default (2.56Kb)
  790. #endif
  791. #define THINGSPEAK_ENABLED 0 // Thingspeak disabled by default
  792. #define THINGSPEAK_APIKEY "" // Default API KEY
  793. #define THINGSPEAK_USE_ASYNC 1 // Use AsyncClient instead of WiFiClientSecure
  794. // THINGSPEAK OVER SSL
  795. // Using THINGSPEAK over SSL works well but generates problems with the web interface,
  796. // so you should compile it with WEB_SUPPORT to 0.
  797. // When THINGSPEAK_USE_ASYNC is 1, requires ASYNC_TCP_SSL_ENABLED to 1 and ESP8266 Arduino Core 2.4.0.
  798. #define THINGSPEAK_USE_SSL 0 // Use secure connection
  799. #define THINGSPEAK_FINGERPRINT "78 60 18 44 81 35 BF DF 77 84 D4 0A 22 0D 9B 4E 6C DC 57 2C"
  800. #define THINGSPEAK_HOST "api.thingspeak.com"
  801. #if THINGSPEAK_USE_SSL
  802. #define THINGSPEAK_PORT 443
  803. #else
  804. #define THINGSPEAK_PORT 80
  805. #endif
  806. #define THINGSPEAK_URL "/update"
  807. #define THINGSPEAK_MIN_INTERVAL 15000 // Minimum interval between POSTs (in millis)
  808. #ifndef ASYNC_TCP_SSL_ENABLED
  809. #if THINGSPEAK_USE_SSL && THINGSPEAK_USE_ASYNC
  810. #undef THINGSPEAK_SUPPORT // Thingspeak in ASYNC mode requires ASYNC_TCP_SSL_ENABLED
  811. #endif
  812. #endif
  813. // -----------------------------------------------------------------------------
  814. // SCHEDULER
  815. // -----------------------------------------------------------------------------
  816. #define SCHEDULER_TYPE_SWITCH 1
  817. #define SCHEDULER_TYPE_DIM 2
  818. #ifndef SCHEDULER_SUPPORT
  819. #define SCHEDULER_SUPPORT 1 // Enable scheduler (1.77Kb)
  820. #endif
  821. #if SCHEDULER_SUPPORT
  822. #undef NTP_SUPPORT
  823. #define NTP_SUPPORT 1 // Scheduler needs NTP
  824. #endif
  825. #define SCHEDULER_MAX_SCHEDULES 10 // Max schedules alowed
  826. // -----------------------------------------------------------------------------
  827. // NTP
  828. // -----------------------------------------------------------------------------
  829. #ifndef NTP_SUPPORT
  830. #define NTP_SUPPORT 1 // Build with NTP support by default (6.78Kb)
  831. #endif
  832. #ifndef NTP_SERVER
  833. #define NTP_SERVER "pool.ntp.org" // Default NTP server
  834. #endif
  835. #ifndef NTP_TIMEOUT
  836. #define NTP_TIMEOUT 2000 // Set NTP request timeout to 2 seconds (issue #452)
  837. #define NTP_TIME_OFFSET 60 // Default timezone offset (GMT+1)
  838. #define NTP_DAY_LIGHT true // Enable daylight time saving by default
  839. #endif
  840. #ifndef NTP_SYNC_INTERVAL
  841. #define NTP_SYNC_INTERVAL 60 // NTP initial check every minute
  842. #endif
  843. #ifndef NTP_UPDATE_INTERVAL
  844. #define NTP_UPDATE_INTERVAL 1800 // NTP check every 30 minutes
  845. #endif
  846. #ifndef NTP_START_DELAY
  847. #define NTP_START_DELAY 1000 // Delay NTP start 1 second
  848. #endif
  849. #ifndef NTP_DST_REGION
  850. #define NTP_DST_REGION 0 // 0 for Europe, 1 for USA (defined in NtpClientLib)
  851. #endif
  852. // -----------------------------------------------------------------------------
  853. // ALEXA
  854. // -----------------------------------------------------------------------------
  855. // This setting defines whether Alexa support should be built into the firmware
  856. #ifndef ALEXA_SUPPORT
  857. #define ALEXA_SUPPORT 1 // Enable Alexa support by default (10.84Kb)
  858. #endif
  859. // This is default value for the alexaEnabled setting that defines whether
  860. // this device should be discoberable and respond to Alexa commands.
  861. // Both ALEXA_SUPPORT and alexaEnabled should be 1 for Alexa support to work.
  862. #define ALEXA_ENABLED 1
  863. // -----------------------------------------------------------------------------
  864. // RFBRIDGE
  865. // This module is not compatible with RF_SUPPORT=1
  866. // -----------------------------------------------------------------------------
  867. #ifndef RF_SEND_TIMES
  868. #define RF_SEND_TIMES 4 // How many times to send the message
  869. #endif
  870. #ifndef RF_SEND_DELAY
  871. #define RF_SEND_DELAY 500 // Interval between sendings in ms
  872. #endif
  873. #ifndef RF_RECEIVE_DELAY
  874. #define RF_RECEIVE_DELAY 500 // Interval between recieving in ms (avoid debouncing)
  875. #endif
  876. #ifndef RF_RAW_SUPPORT
  877. #define RF_RAW_SUPPORT 0 // RF raw codes require a specific firmware for the EFM8BB1
  878. // https://github.com/rhx/RF-Bridge-EFM8BB1
  879. #endif
  880. // -----------------------------------------------------------------------------
  881. // IR
  882. // -----------------------------------------------------------------------------
  883. #ifndef IR_SUPPORT
  884. #define IR_SUPPORT 0 // Do not build with IR support by default (10.25Kb)
  885. #endif
  886. #ifndef IR_PIN
  887. #define IR_PIN 4 // IR LED
  888. #endif
  889. // 24 Buttons Set of the IR Remote
  890. #ifndef IR_BUTTON_SET
  891. #define IR_BUTTON_SET 1 // IR button set to use (see below)
  892. #endif
  893. // IR Button modes
  894. #define IR_BUTTON_MODE_NONE 0
  895. #define IR_BUTTON_MODE_RGB 1
  896. #define IR_BUTTON_MODE_HSV 2
  897. #define IR_BUTTON_MODE_BRIGHTER 3
  898. #define IR_BUTTON_MODE_STATE 4
  899. #define IR_BUTTON_MODE_EFFECT 5
  900. #define LIGHT_EFFECT_SOLID 0
  901. #define LIGHT_EFFECT_FLASH 1
  902. #define LIGHT_EFFECT_STROBE 2
  903. #define LIGHT_EFFECT_FADE 3
  904. #define LIGHT_EFFECT_SMOOTH 4
  905. //Remote Buttons SET 1 (for the original Remote shipped with the controller)
  906. #if IR_SUPPORT
  907. #if IR_BUTTON_SET == 1
  908. /*
  909. +------+------+------+------+
  910. | UP | Down | OFF | ON |
  911. +------+------+------+------+
  912. | R | G | B | W |
  913. +------+------+------+------+
  914. | 1 | 2 | 3 |FLASH |
  915. +------+------+------+------+
  916. | 4 | 5 | 6 |STROBE|
  917. +------+------+------+------+
  918. | 7 | 8 | 9 | FADE |
  919. +------+------+------+------+
  920. | 10 | 11 | 12 |SMOOTH|
  921. +------+------+------+------+
  922. */
  923. #define IR_BUTTON_COUNT 24
  924. const unsigned long IR_BUTTON[IR_BUTTON_COUNT][3] PROGMEM = {
  925. { 0xFF906F, IR_BUTTON_MODE_BRIGHTER, 1 },
  926. { 0xFFB847, IR_BUTTON_MODE_BRIGHTER, 0 },
  927. { 0xFFF807, IR_BUTTON_MODE_STATE, 0 },
  928. { 0xFFB04F, IR_BUTTON_MODE_STATE, 1 },
  929. { 0xFF9867, IR_BUTTON_MODE_RGB, 0xFF0000 },
  930. { 0xFFD827, IR_BUTTON_MODE_RGB, 0x00FF00 },
  931. { 0xFF8877, IR_BUTTON_MODE_RGB, 0x0000FF },
  932. { 0xFFA857, IR_BUTTON_MODE_RGB, 0xFFFFFF },
  933. { 0xFFE817, IR_BUTTON_MODE_RGB, 0xD13A01 },
  934. { 0xFF48B7, IR_BUTTON_MODE_RGB, 0x00E644 },
  935. { 0xFF6897, IR_BUTTON_MODE_RGB, 0x0040A7 },
  936. { 0xFFB24D, IR_BUTTON_MODE_EFFECT, LIGHT_EFFECT_FLASH },
  937. { 0xFF02FD, IR_BUTTON_MODE_RGB, 0xE96F2A },
  938. { 0xFF32CD, IR_BUTTON_MODE_RGB, 0x00BEBF },
  939. { 0xFF20DF, IR_BUTTON_MODE_RGB, 0x56406F },
  940. { 0xFF00FF, IR_BUTTON_MODE_EFFECT, LIGHT_EFFECT_STROBE },
  941. { 0xFF50AF, IR_BUTTON_MODE_RGB, 0xEE9819 },
  942. { 0xFF7887, IR_BUTTON_MODE_RGB, 0x00799A },
  943. { 0xFF708F, IR_BUTTON_MODE_RGB, 0x944E80 },
  944. { 0xFF58A7, IR_BUTTON_MODE_EFFECT, LIGHT_EFFECT_FADE },
  945. { 0xFF38C7, IR_BUTTON_MODE_RGB, 0xFFFF00 },
  946. { 0xFF28D7, IR_BUTTON_MODE_RGB, 0x0060A1 },
  947. { 0xFFF00F, IR_BUTTON_MODE_RGB, 0xEF45AD },
  948. { 0xFF30CF, IR_BUTTON_MODE_EFFECT, LIGHT_EFFECT_SMOOTH }
  949. };
  950. #endif
  951. //Remote Buttons SET 2 (another identical IR Remote shipped with another controller)
  952. #if IR_BUTTON_SET == 2
  953. /*
  954. +------+------+------+------+
  955. | UP | Down | OFF | ON |
  956. +------+------+------+------+
  957. | R | G | B | W |
  958. +------+------+------+------+
  959. | 1 | 2 | 3 |FLASH |
  960. +------+------+------+------+
  961. | 4 | 5 | 6 |STROBE|
  962. +------+------+------+------+
  963. | 7 | 8 | 9 | FADE |
  964. +------+------+------+------+
  965. | 10 | 11 | 12 |SMOOTH|
  966. +------+------+------+------+
  967. */
  968. #define IR_BUTTON_COUNT 24
  969. const unsigned long IR_BUTTON[IR_BUTTON_COUNT][3] PROGMEM = {
  970. { 0xFF00FF, IR_BUTTON_MODE_BRIGHTER, 1 },
  971. { 0xFF807F, IR_BUTTON_MODE_BRIGHTER, 0 },
  972. { 0xFF40BF, IR_BUTTON_MODE_STATE, 0 },
  973. { 0xFFC03F, IR_BUTTON_MODE_STATE, 1 },
  974. { 0xFF20DF, IR_BUTTON_MODE_RGB, 0xFF0000 },
  975. { 0xFFA05F, IR_BUTTON_MODE_RGB, 0x00FF00 },
  976. { 0xFF609F, IR_BUTTON_MODE_RGB, 0x0000FF },
  977. { 0xFFE01F, IR_BUTTON_MODE_RGB, 0xFFFFFF },
  978. { 0xFF10EF, IR_BUTTON_MODE_RGB, 0xD13A01 },
  979. { 0xFF906F, IR_BUTTON_MODE_RGB, 0x00E644 },
  980. { 0xFF50AF, IR_BUTTON_MODE_RGB, 0x0040A7 },
  981. { 0xFFD02F, IR_BUTTON_MODE_EFFECT, LIGHT_EFFECT_FLASH },
  982. { 0xFF30CF, IR_BUTTON_MODE_RGB, 0xE96F2A },
  983. { 0xFFB04F, IR_BUTTON_MODE_RGB, 0x00BEBF },
  984. { 0xFF708F, IR_BUTTON_MODE_RGB, 0x56406F },
  985. { 0xFFF00F, IR_BUTTON_MODE_EFFECT, LIGHT_EFFECT_STROBE },
  986. { 0xFF08F7, IR_BUTTON_MODE_RGB, 0xEE9819 },
  987. { 0xFF8877, IR_BUTTON_MODE_RGB, 0x00799A },
  988. { 0xFF48B7, IR_BUTTON_MODE_RGB, 0x944E80 },
  989. { 0xFFC837, IR_BUTTON_MODE_EFFECT, LIGHT_EFFECT_FADE },
  990. { 0xFF28D7, IR_BUTTON_MODE_RGB, 0xFFFF00 },
  991. { 0xFFA857, IR_BUTTON_MODE_RGB, 0x0060A1 },
  992. { 0xFF6897, IR_BUTTON_MODE_RGB, 0xEF45AD },
  993. { 0xFFE817, IR_BUTTON_MODE_EFFECT, LIGHT_EFFECT_SMOOTH }
  994. };
  995. #endif
  996. #endif // IR_SUPPORT
  997. //--------------------------------------------------------------------------------
  998. // Custom RF module
  999. // Check http://tinkerman.cat/adding-rf-to-a-non-rf-itead-sonoff/
  1000. // Enable support by passing RF_SUPPORT=1 build flag
  1001. // This module is not compatible with RFBRIDGE
  1002. //--------------------------------------------------------------------------------
  1003. #ifndef RF_SUPPORT
  1004. #define RF_SUPPORT 0
  1005. #endif
  1006. #ifndef RF_PIN
  1007. #define RF_PIN 14
  1008. #endif
  1009. #define RF_DEBOUNCE 500
  1010. #define RF_LEARN_TIMEOUT 60000