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.

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