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.

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