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.

1370 lines
45 KiB

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