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.

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