Browse Source

Merge branch 'dev' into h-split

rfm69
Lazar Obradovic 6 years ago
committed by GitHub
parent
commit
daf79d6ba4
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
21 changed files with 3714 additions and 3310 deletions
  1. +6
    -4
      README.md
  2. +1
    -1
      code/build.sh
  3. +4
    -2
      code/espurna/config/arduino.h
  4. +293
    -2
      code/espurna/config/general.h
  5. +39
    -3
      code/espurna/config/hardware.h
  6. BIN
      code/espurna/data/index.html.gz
  7. +12
    -14
      code/espurna/light.ino
  8. +10
    -2
      code/espurna/migrate.ino
  9. +3265
    -3261
      code/espurna/static/index.html.gz.h
  10. +31
    -16
      code/html/custom.js
  11. +1
    -1
      code/html/index.html
  12. +52
    -4
      code/platformio.ini
  13. BIN
      images/devices/arniex-swifitch.jpg
  14. BIN
      images/devices/generic-dht11-10.jpg
  15. BIN
      images/devices/generic-ds18b20-10.jpg
  16. BIN
      images/devices/generic-relay-40.jpg
  17. BIN
      images/devices/generic-rgbled-10.jpg
  18. BIN
      images/devices/ike-espike.jpg
  19. BIN
      images/devices/itead-sonoff-basic-2.jpg
  20. BIN
      images/devices/swifitch.png
  21. BIN
      images/devices/yjzk-2gang-switch.jpg

+ 6
- 4
README.md View File

@ -215,8 +215,8 @@ Here is the list of supported hardware. For more information please refer to the
|**Maxcio W-US002S**|**HEYGO HY02**|**YiDian XS-SSA05**| |**Maxcio W-US002S**|**HEYGO HY02**|**YiDian XS-SSA05**|
|![WiOn 50055](images/devices/wion-50055.jpg)|![LINGAN SWA1](images/devices/lingan-swa1.jpg)|![Tonbux PowerStrip02](images/devices/tonbux-powerstrip02.jpg)| |![WiOn 50055](images/devices/wion-50055.jpg)|![LINGAN SWA1](images/devices/lingan-swa1.jpg)|![Tonbux PowerStrip02](images/devices/tonbux-powerstrip02.jpg)|
|**WiOn 50055**|**LINGAN SWA1**|**Tonbux PowerStrip02** |**WiOn 50055**|**LINGAN SWA1**|**Tonbux PowerStrip02**
|![Itead Sonoff Touch](images/devices/itead-sonoff-touch.jpg)|![Itead Sonoff T1](images/devices/itead-sonoff-t1.jpg)|![Swifitch](images/devices/swifitch.png)|
|**Itead Sonoff Touch**|**Itead Sonoff T1**|Swifitch|
|![Itead Sonoff Touch](images/devices/itead-sonoff-touch.jpg)|![Itead Sonoff T1](images/devices/itead-sonoff-t1.jpg)|![YJZK 2-gang switch](images/devices/yjzk-2gang-switch.jpg)|
|**Itead Sonoff Touch**|**Itead Sonoff T1**|**YJZK 2-gang switch**|
|![Itead Slampher](images/devices/itead-slampher.jpg)||| |![Itead Slampher](images/devices/itead-slampher.jpg)|||
|**Itead Slampher**||| |**Itead Slampher**|||
|![Itead Sonoff B1](images/devices/itead-sonoff-b1.jpg)|![AI-Thinker Wifi Light / Noduino OpenLight](images/devices/aithinker-ai-light.jpg)|![Authometion LYT8266](images/devices/authometion-lyt8266.jpg)| |![Itead Sonoff B1](images/devices/itead-sonoff-b1.jpg)|![AI-Thinker Wifi Light / Noduino OpenLight](images/devices/aithinker-ai-light.jpg)|![Authometion LYT8266](images/devices/authometion-lyt8266.jpg)|
@ -235,10 +235,12 @@ Here is the list of supported hardware. For more information please refer to the
|**Jan Goedeke Wifi Relay (NO/NC)**|**Jorge García Wifi + Relays Board Kit**|**EXS Wifi Relay v3.1**| |**Jan Goedeke Wifi Relay (NO/NC)**|**Jorge García Wifi + Relays Board Kit**|**EXS Wifi Relay v3.1**|
|![ManCaveMade ESP-Live](images/devices/mancavemade-esp-live.jpg)|![Wemos D1 Mini Relay Shield](images/devices/wemos-d1-mini-relayshield.jpg)|![Witty Cloud](images/devices/witty-cloud.jpg)| |![ManCaveMade ESP-Live](images/devices/mancavemade-esp-live.jpg)|![Wemos D1 Mini Relay Shield](images/devices/wemos-d1-mini-relayshield.jpg)|![Witty Cloud](images/devices/witty-cloud.jpg)|
|**ManCaveMade ESP-Live**|**Wemos D1 Mini Relay Shield**|**Witty Cloud**| |**ManCaveMade ESP-Live**|**Wemos D1 Mini Relay Shield**|**Witty Cloud**|
|![IKE ESPike](images/devices/ike-espike.jpg)||![Arniex Swifitch](images/devices/arniex-swifitch.jpg)|
|**IKE ESPike**|**STM_RELAY**|**Arniex Swifitch**|
|![Heltec Touch Relay](images/devices/heltec-touch-relay.jpg)|![Generic Relay v4.0](images/devices/generic-relay-40.jpg)|![Generic RGBLed v1.0](images/devices/generic-rgbled-10.jpg)| |![Heltec Touch Relay](images/devices/heltec-touch-relay.jpg)|![Generic Relay v4.0](images/devices/generic-relay-40.jpg)|![Generic RGBLed v1.0](images/devices/generic-rgbled-10.jpg)|
|**Heltec Touch Relay**|**Generic Relay v4.0**|**Generic RGBLed v1.0**| |**Heltec Touch Relay**|**Generic Relay v4.0**|**Generic RGBLed v1.0**|
|||
|**YJZK 2-gang switch**|**STM_RELAY**||
|![Generic DHT11 v1.0](images/devices/generic-dht11-10.jpg)|![Generic DS18B20 v1.0](images/devices/generic-ds18b20-10.jpg)||
|**Generic DHT11 v1.0**|**Generic DS18B20 v1.0**||
**Other supported boards:** **Other supported boards:**
*TODO* *TODO*


+ 1
- 1
code/build.sh View File

@ -64,7 +64,7 @@ echo "Building firmware images..."
mkdir -p ../firmware/espurna-$version mkdir -p ../firmware/espurna-$version
for environment in $environments; do for environment in $environments; do
echo "* espurna-$version-$environment.bin" echo "* espurna-$version-$environment.bin"
platformio run --silent --environment $environment || break
platformio run --silent --environment $environment || exit 1
mv .pioenvs/$environment/firmware.bin ../firmware/espurna-$version/espurna-$version-$environment.bin mv .pioenvs/$environment/firmware.bin ../firmware/espurna-$version/espurna-$version-$environment.bin
done done
echo "--------------------------------------------------------------" echo "--------------------------------------------------------------"


+ 4
- 2
code/espurna/config/arduino.h View File

@ -72,8 +72,10 @@
//#define GREEN_ESP8266RELAY //#define GREEN_ESP8266RELAY
//#define IKE_ESPIKE //#define IKE_ESPIKE
//#define ARNIEX_SWIFITCH //#define ARNIEX_SWIFITCH
//#define GENERIC_ESP01SRELAY40
//#define GENERIC_ESP01SRGBLED10
//#define GENERIC_ESP01S_RELAY_V40
//#define GENERIC_ESP01S_RGBLED_V10
//#define GENERIC_ESP01S_DHT11_V10
//#define GENERIC_ESP01S_DS18B20_V10
//#define HELTEC_TOUCHRELAY //#define HELTEC_TOUCHRELAY
//-------------------------------------------------------------------------------- //--------------------------------------------------------------------------------


+ 293
- 2
code/espurna/config/general.h View File

@ -8,9 +8,19 @@
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
#define DEVICE_NAME MANUFACTURER "_" DEVICE // Concatenate both to get a unique device name #define DEVICE_NAME MANUFACTURER "_" DEVICE // Concatenate both to get a unique device name
#ifndef ADMIN_PASS
#define ADMIN_PASS "fibonacci" // Default password (WEB, OTA, WIFI) #define ADMIN_PASS "fibonacci" // Default password (WEB, OTA, WIFI)
#endif
#ifndef USE_PASSWORD
#define USE_PASSWORD 1 // Insecurity caution! Disabling this will disable password querying completely. #define USE_PASSWORD 1 // Insecurity caution! Disabling this will disable password querying completely.
#endif
#ifndef LOOP_DELAY_TIME
#define LOOP_DELAY_TIME 10 // Delay for this millis in the main loop [0-250] #define LOOP_DELAY_TIME 10 // Delay for this millis in the main loop [0-250]
#endif
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
// TELNET // TELNET
@ -72,6 +82,20 @@
// To receive the message son the destination computer use nc: // To receive the message son the destination computer use nc:
// nc -ul 8113 // nc -ul 8113
#ifndef DEBUG_UDP_SUPPORT
#define DEBUG_UDP_SUPPORT 0 // Enable UDP debug log
#endif
#ifndef DEBUG_UDP_IP
#define DEBUG_UDP_IP IPAddress(192, 168, 1, 100)
#endif
#ifndef DEBUG_UDP_PORT
#define DEBUG_UDP_PORT 8113
#endif
//------------------------------------------------------------------------------
#ifndef DEBUG_TELNET_SUPPORT #ifndef DEBUG_TELNET_SUPPORT
#define DEBUG_TELNET_SUPPORT TELNET_SUPPORT // Enable telnet debug log if telnet is enabled too #define DEBUG_TELNET_SUPPORT TELNET_SUPPORT // Enable telnet debug log if telnet is enabled too
#endif #endif
@ -82,7 +106,9 @@
#define DEBUG_UDP_IP IPAddress(192, 168, 1, 100) #define DEBUG_UDP_IP IPAddress(192, 168, 1, 100)
#define DEBUG_UDP_PORT 8113 #define DEBUG_UDP_PORT 8113
#ifndef DEBUG_WEB_ENABLED
#define DEBUG_WEB_ENABLED 1 // Enable debug output by default #define DEBUG_WEB_ENABLED 1 // Enable debug output by default
#endif
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
@ -108,6 +134,7 @@
#endif #endif
#define SYSTEM_CHECK_TIME 60000 // The system is considered stable after these many millis #define SYSTEM_CHECK_TIME 60000 // The system is considered stable after these many millis
#ifndef SYSTEM_CHECK_MAX #ifndef SYSTEM_CHECK_MAX
#define SYSTEM_CHECK_MAX 5 // After this many crashes on boot #define SYSTEM_CHECK_MAX 5 // After this many crashes on boot
// the system is flagged as unstable // the system is flagged as unstable
@ -156,8 +183,13 @@
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
// Load average // Load average
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
#ifndef LOADAVG_INTERVAL
#define LOADAVG_INTERVAL 30000 // Interval between calculating load average (in ms) #define LOADAVG_INTERVAL 30000 // Interval between calculating load average (in ms)
#endif
#ifndef LOADAVG_REPORT
#define LOADAVG_REPORT 1 // Should we report Load average over MQTT? #define LOADAVG_REPORT 1 // Should we report Load average over MQTT?
#endif
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
// BUTTON // BUTTON
@ -184,81 +216,128 @@
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
// Default boot mode: 0 means OFF, 1 ON and 2 whatever was before // Default boot mode: 0 means OFF, 1 ON and 2 whatever was before
#ifndef RELAY_BOOT_MODE
#define RELAY_BOOT_MODE RELAY_BOOT_OFF #define RELAY_BOOT_MODE RELAY_BOOT_OFF
#endif
// 0 means ANY, 1 zero or one and 2 one and only one // 0 means ANY, 1 zero or one and 2 one and only one
#ifndef RELAY_SYNC
#define RELAY_SYNC RELAY_SYNC_ANY #define RELAY_SYNC RELAY_SYNC_ANY
#endif
// Default pulse mode: 0 means no pulses, 1 means normally off, 2 normally on // Default pulse mode: 0 means no pulses, 1 means normally off, 2 normally on
#ifndef RELAY_PULSE_MODE
#define RELAY_PULSE_MODE RELAY_PULSE_NONE #define RELAY_PULSE_MODE RELAY_PULSE_NONE
#endif
// Default pulse time in seconds // Default pulse time in seconds
#ifndef RELAY_PULSE_TIME
#define RELAY_PULSE_TIME 1.0 #define RELAY_PULSE_TIME 1.0
#endif
// Relay requests flood protection window - in seconds // Relay requests flood protection window - in seconds
#ifndef RELAY_FLOOD_WINDOW
#define RELAY_FLOOD_WINDOW 3 #define RELAY_FLOOD_WINDOW 3
#endif
// Allowed actual relay changes inside requests flood protection window // Allowed actual relay changes inside requests flood protection window
#ifndef RELAY_FLOOD_CHANGES
#define RELAY_FLOOD_CHANGES 5 #define RELAY_FLOOD_CHANGES 5
#endif
// Pulse with in milliseconds for a latched relay // Pulse with in milliseconds for a latched relay
#ifndef RELAY_LATCHING_PULSE
#define RELAY_LATCHING_PULSE 10 #define RELAY_LATCHING_PULSE 10
#endif
// Do not save relay state after these many milliseconds // Do not save relay state after these many milliseconds
#ifndef RELAY_SAVE_DELAY
#define RELAY_SAVE_DELAY 1000 #define RELAY_SAVE_DELAY 1000
#endif
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------
// WIFI // WIFI
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------
#ifndef WIFI_CONNECT_TIMEOUT
#define WIFI_CONNECT_TIMEOUT 60000 // Connecting timeout for WIFI in ms #define WIFI_CONNECT_TIMEOUT 60000 // Connecting timeout for WIFI in ms
#endif
#ifndef WIFI_RECONNECT_INTERVAL
#define WIFI_RECONNECT_INTERVAL 180000 // If could not connect to WIFI, retry after this time in ms #define WIFI_RECONNECT_INTERVAL 180000 // If could not connect to WIFI, retry after this time in ms
#endif
#define WIFI_MAX_NETWORKS 5 // Max number of WIFI connection configurations #define WIFI_MAX_NETWORKS 5 // Max number of WIFI connection configurations
#ifndef WIFI_AP_MODE
#define WIFI_AP_MODE AP_MODE_ALONE #define WIFI_AP_MODE AP_MODE_ALONE
#endif
#ifndef WIFI_SLEEP_MODE
#define WIFI_SLEEP_MODE WIFI_NONE_SLEEP // WIFI_NONE_SLEEP, WIFI_LIGHT_SLEEP or WIFI_MODEM_SLEEP #define WIFI_SLEEP_MODE WIFI_NONE_SLEEP // WIFI_NONE_SLEEP, WIFI_LIGHT_SLEEP or WIFI_MODEM_SLEEP
#endif
#ifndef WIFI_SCAN_NETWORKS
#define WIFI_SCAN_NETWORKS 1 // Perform a network scan before connecting #define WIFI_SCAN_NETWORKS 1 // Perform a network scan before connecting
#endif
// Optional hardcoded configuration (up to 2 networks) // Optional hardcoded configuration (up to 2 networks)
#ifndef WIFI1_SSID #ifndef WIFI1_SSID
#define WIFI1_SSID "" #define WIFI1_SSID ""
#endif #endif
#ifndef WIFI1_PASS #ifndef WIFI1_PASS
#define WIFI1_PASS "" #define WIFI1_PASS ""
#endif #endif
#ifndef WIFI1_IP #ifndef WIFI1_IP
#define WIFI1_IP "" #define WIFI1_IP ""
#endif #endif
#ifndef WIFI1_GW #ifndef WIFI1_GW
#define WIFI1_GW "" #define WIFI1_GW ""
#endif #endif
#ifndef WIFI1_MASK #ifndef WIFI1_MASK
#define WIFI1_MASK "" #define WIFI1_MASK ""
#endif #endif
#ifndef WIFI1_DNS #ifndef WIFI1_DNS
#define WIFI1_DNS "" #define WIFI1_DNS ""
#endif #endif
#ifndef WIFI2_SSID #ifndef WIFI2_SSID
#define WIFI2_SSID "" #define WIFI2_SSID ""
#endif #endif
#ifndef WIFI2_PASS #ifndef WIFI2_PASS
#define WIFI2_PASS "" #define WIFI2_PASS ""
#endif #endif
#ifndef WIFI2_IP #ifndef WIFI2_IP
#define WIFI2_IP "" #define WIFI2_IP ""
#endif #endif
#ifndef WIFI2_GW #ifndef WIFI2_GW
#define WIFI2_GW "" #define WIFI2_GW ""
#endif #endif
#ifndef WIFI2_MASK #ifndef WIFI2_MASK
#define WIFI2_MASK "" #define WIFI2_MASK ""
#endif #endif
#ifndef WIFI2_DNS #ifndef WIFI2_DNS
#define WIFI2_DNS "" #define WIFI2_DNS ""
#endif #endif
#ifndef WIFI_RSSI_1M
#define WIFI_RSSI_1M -30 // Calibrate it with your router reading the RSSI at 1m #define WIFI_RSSI_1M -30 // Calibrate it with your router reading the RSSI at 1m
#endif
#ifndef WIFI_PROPAGATION_CONST
#define WIFI_PROPAGATION_CONST 4 // This is typically something between 2.7 to 4.3 (free space is 2) #define WIFI_PROPAGATION_CONST 4 // This is typically something between 2.7 to 4.3 (free space is 2)
#endif
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------
// WEB // WEB
@ -274,32 +353,63 @@
// This is not working at the moment!! // This is not working at the moment!!
// Requires ASYNC_TCP_SSL_ENABLED to 1 and ESP8266 Arduino Core 2.4.0 // Requires ASYNC_TCP_SSL_ENABLED to 1 and ESP8266 Arduino Core 2.4.0
#ifndef WEB_SSL_ENABLED
#define WEB_SSL_ENABLED 0 // Use HTTPS web interface #define WEB_SSL_ENABLED 0 // Use HTTPS web interface
#endif
#define WEB_MODE_NORMAL 0
#define WEB_MODE_PASSWORD 1
#ifndef WEB_USERNAME
#define WEB_USERNAME "admin" // HTTP username #define WEB_USERNAME "admin" // HTTP username
#endif
#ifndef WEB_FORCE_PASS_CHANGE
#define WEB_FORCE_PASS_CHANGE 1 // Force the user to change the password if default one #define WEB_FORCE_PASS_CHANGE 1 // Force the user to change the password if default one
#endif
#ifndef WEB_PORT
#define WEB_PORT 80 // HTTP port #define WEB_PORT 80 // HTTP port
#endif
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------
// WEBSOCKETS // WEBSOCKETS
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------
// This will only be enabled if WEB_SUPPORT is 1 (this is the default value) // This will only be enabled if WEB_SUPPORT is 1 (this is the default value)
#ifndef WS_AUTHENTICATION
#define WS_AUTHENTICATION 1 // WS authentication ON by default (see #507) #define WS_AUTHENTICATION 1 // WS authentication ON by default (see #507)
#endif
#ifndef WS_BUFFER_SIZE
#define WS_BUFFER_SIZE 5 // Max number of secured websocket connections #define WS_BUFFER_SIZE 5 // Max number of secured websocket connections
#endif
#ifndef WS_TIMEOUT
#define WS_TIMEOUT 1800000 // Timeout for secured websocket #define WS_TIMEOUT 1800000 // Timeout for secured websocket
#endif
#ifndef WS_UPDATE_INTERVAL
#define WS_UPDATE_INTERVAL 30000 // Update clients every 30 seconds #define WS_UPDATE_INTERVAL 30000 // Update clients every 30 seconds
#endif
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------
// API // API
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------
// This will only be enabled if WEB_SUPPORT is 1 (this is the default value) // This will only be enabled if WEB_SUPPORT is 1 (this is the default value)
#ifndef API_ENABLED
#define API_ENABLED 0 // Do not enable API by default #define API_ENABLED 0 // Do not enable API by default
#endif
#ifndef API_BUFFER_SIZE
#define API_BUFFER_SIZE 15 // Size of the buffer for HTTP GET API responses #define API_BUFFER_SIZE 15 // Size of the buffer for HTTP GET API responses
#endif
#ifndef API_REAL_TIME_VALUES
#define API_REAL_TIME_VALUES 0 // Show filtered/median values by default (0 => median, 1 => real time) #define API_REAL_TIME_VALUES 0 // Show filtered/median values by default (0 => median, 1 => real time)
#endif
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------
// MDNS / LLMNR / NETBIOS / SSDP // MDNS / LLMNR / NETBIOS / SSDP
@ -344,7 +454,10 @@
// OTA // OTA
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------
#ifndef OTA_PORT
#define OTA_PORT 8266 // OTA port #define OTA_PORT 8266 // OTA port
#endif
#define OTA_GITHUB_FP "D7:9F:07:61:10:B3:92:93:E3:49:AC:89:84:5B:03:80:C1:9E:2F:8B" #define OTA_GITHUB_FP "D7:9F:07:61:10:B3:92:93:E3:49:AC:89:84:5B:03:80:C1:9E:2F:8B"
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------
@ -355,9 +468,17 @@
#define NOFUSS_SUPPORT 0 // Do not enable support for NoFuss by default (12.65Kb) #define NOFUSS_SUPPORT 0 // Do not enable support for NoFuss by default (12.65Kb)
#endif #endif
#ifndef NOFUSS_ENABLED
#define NOFUSS_ENABLED 0 // Do not perform NoFUSS updates by default #define NOFUSS_ENABLED 0 // Do not perform NoFUSS updates by default
#endif
#ifndef NOFUSS_SERVER
#define NOFUSS_SERVER "" // Default NoFuss Server #define NOFUSS_SERVER "" // Default NoFuss Server
#endif
#ifndef NOFUSS_INTERVAL
#define NOFUSS_INTERVAL 3600000 // Check for updates every hour #define NOFUSS_INTERVAL 3600000 // Check for updates every hour
#endif
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------
// UART <-> MQTT // UART <-> MQTT
@ -367,11 +488,26 @@
#define UART_MQTT_SUPPORT 0 // No support by default #define UART_MQTT_SUPPORT 0 // No support by default
#endif #endif
#ifndef UART_MQTT_USE_SOFT
#define UART_MQTT_USE_SOFT 0 // Use SoftwareSerial #define UART_MQTT_USE_SOFT 0 // Use SoftwareSerial
#endif
#ifndef UART_MQTT_HW_PORT
#define UART_MQTT_HW_PORT Serial // Hardware serial port (if UART_MQTT_USE_SOFT == 0) #define UART_MQTT_HW_PORT Serial // Hardware serial port (if UART_MQTT_USE_SOFT == 0)
#endif
#ifndef UART_MQTT_RX_PIN
#define UART_MQTT_RX_PIN 4 // RX PIN (if UART_MQTT_USE_SOFT == 1) #define UART_MQTT_RX_PIN 4 // RX PIN (if UART_MQTT_USE_SOFT == 1)
#endif
#ifndef UART_MQTT_TX_PIN
#define UART_MQTT_TX_PIN 5 // TX PIN (if UART_MQTT_USE_SOFT == 1) #define UART_MQTT_TX_PIN 5 // TX PIN (if UART_MQTT_USE_SOFT == 1)
#endif
#ifndef UART_MQTT_BAUDRATE
#define UART_MQTT_BAUDRATE 115200 // Serial speed #define UART_MQTT_BAUDRATE 115200 // Serial speed
#endif
#define UART_MQTT_BUFFER_SIZE 100 // UART buffer size #define UART_MQTT_BUFFER_SIZE 100 // UART buffer size
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------
@ -404,31 +540,91 @@
// $ echo -n | openssl s_client -connect m11.cloudmqtt.com:24055 > cloudmqtt.pem // $ echo -n | openssl s_client -connect m11.cloudmqtt.com:24055 > cloudmqtt.pem
// $ openssl x509 -noout -in cloudmqtt.pem -fingerprint -sha1 // $ openssl x509 -noout -in cloudmqtt.pem -fingerprint -sha1
#ifndef MQTT_SSL_ENABLED
#define MQTT_SSL_ENABLED 0 // By default MQTT over SSL will not be enabled #define MQTT_SSL_ENABLED 0 // By default MQTT over SSL will not be enabled
#endif
#ifndef MQTT_SSL_FINGERPRINT
#define MQTT_SSL_FINGERPRINT "" // SSL fingerprint of the server #define MQTT_SSL_FINGERPRINT "" // SSL fingerprint of the server
#endif
#ifndef MQTT_ENABLED
#define MQTT_ENABLED 0 // Do not enable MQTT connection by default #define MQTT_ENABLED 0 // Do not enable MQTT connection by default
#endif
#ifndef MQTT_AUTOCONNECT
#define MQTT_AUTOCONNECT 1 // If enabled and MDNS_SERVER_SUPPORT=1 will perform an autodiscover and #define MQTT_AUTOCONNECT 1 // If enabled and MDNS_SERVER_SUPPORT=1 will perform an autodiscover and
#endif
// autoconnect to the first MQTT broker found if none defined // autoconnect to the first MQTT broker found if none defined
#ifndef MQTT_SERVER
#define MQTT_SERVER "" // Default MQTT broker address #define MQTT_SERVER "" // Default MQTT broker address
#endif
#ifndef MQTT_USER
#define MQTT_USER "" // Default MQTT broker usename #define MQTT_USER "" // Default MQTT broker usename
#endif
#ifndef MQTT_PASS
#define MQTT_PASS "" // Default MQTT broker password #define MQTT_PASS "" // Default MQTT broker password
#endif
#ifndef MQTT_PORT
#define MQTT_PORT 1883 // MQTT broker port #define MQTT_PORT 1883 // MQTT broker port
#endif
#ifndef MQTT_TOPIC
#define MQTT_TOPIC "{hostname}" // Default MQTT base topic #define MQTT_TOPIC "{hostname}" // Default MQTT base topic
#endif
#ifndef MQTT_RETAIN
#define MQTT_RETAIN true // MQTT retain flag #define MQTT_RETAIN true // MQTT retain flag
#endif
#ifndef MQTT_QOS
#define MQTT_QOS 0 // MQTT QoS value for all messages #define MQTT_QOS 0 // MQTT QoS value for all messages
#endif
#ifndef MQTT_KEEPALIVE
#define MQTT_KEEPALIVE 30 // MQTT keepalive value #define MQTT_KEEPALIVE 30 // MQTT keepalive value
#endif
#ifndef MQTT_RECONNECT_DELAY_MIN
#define MQTT_RECONNECT_DELAY_MIN 5000 // Try to reconnect in 5 seconds upon disconnection #define MQTT_RECONNECT_DELAY_MIN 5000 // Try to reconnect in 5 seconds upon disconnection
#endif
#ifndef MQTT_RECONNECT_DELAY_STEP
#define MQTT_RECONNECT_DELAY_STEP 5000 // Increase the reconnect delay in 5 seconds after each failed attempt #define MQTT_RECONNECT_DELAY_STEP 5000 // Increase the reconnect delay in 5 seconds after each failed attempt
#endif
#ifndef MQTT_RECONNECT_DELAY_MAX
#define MQTT_RECONNECT_DELAY_MAX 120000 // Set reconnect time to 2 minutes at most #define MQTT_RECONNECT_DELAY_MAX 120000 // Set reconnect time to 2 minutes at most
#endif
#ifndef MQTT_SKIP_RETAINED
#define MQTT_SKIP_RETAINED 1 // Skip retained messages on connection #define MQTT_SKIP_RETAINED 1 // Skip retained messages on connection
#endif
#ifndef MQTT_SKIP_TIME
#define MQTT_SKIP_TIME 1000 // Skip messages for 1 second anter connection #define MQTT_SKIP_TIME 1000 // Skip messages for 1 second anter connection
#endif
#ifndef MQTT_USE_JSON
#define MQTT_USE_JSON 0 // Group messages in a JSON body #define MQTT_USE_JSON 0 // Group messages in a JSON body
#endif
#ifndef MQTT_USE_JSON_DELAY
#define MQTT_USE_JSON_DELAY 100 // Wait this many ms before grouping messages #define MQTT_USE_JSON_DELAY 100 // Wait this many ms before grouping messages
#endif
#ifndef MQTT_QUEUE_MAX_SIZE
#define MQTT_QUEUE_MAX_SIZE 20 // Size of the MQTT queue when MQTT_USE_JSON is enabled #define MQTT_QUEUE_MAX_SIZE 20 // Size of the MQTT queue when MQTT_USE_JSON is enabled
#endif
// These are the properties that will be sent when useJson is true // These are the properties that will be sent when useJson is true
#ifndef MQTT_ENQUEUE_IP #ifndef MQTT_ENQUEUE_IP
@ -544,7 +740,10 @@
#define LIGHT_SAVE_ENABLED 1 // Light channel values saved by default after each change #define LIGHT_SAVE_ENABLED 1 // Light channel values saved by default after each change
#endif #endif
#ifndef LIGHT_SAVE_DELAY
#define LIGHT_SAVE_DELAY 5 // Persist color after 5 seconds to avoid wearing out #define LIGHT_SAVE_DELAY 5 // Persist color after 5 seconds to avoid wearing out
#endif
#ifndef LIGHT_MAX_PWM #ifndef LIGHT_MAX_PWM
@ -566,20 +765,58 @@
#define LIGHT_MAX_VALUE 255 // Maximum light value #define LIGHT_MAX_VALUE 255 // Maximum light value
#endif #endif
#ifndef LIGHT_MAX_BRIGHTNESS
#define LIGHT_MAX_BRIGHTNESS 255 // Maximun brightness value #define LIGHT_MAX_BRIGHTNESS 255 // Maximun brightness value
#endif
//#define LIGHT_MIN_MIREDS 153 // NOT USED (yet)! // Default to the Philips Hue value that HA has always assumed //#define LIGHT_MIN_MIREDS 153 // NOT USED (yet)! // Default to the Philips Hue value that HA has always assumed
//#define LIGHT_MAX_MIREDS 500 // NOT USED (yet)! // https://developers.meethue.com/documentation/core-concepts //#define LIGHT_MAX_MIREDS 500 // NOT USED (yet)! // https://developers.meethue.com/documentation/core-concepts
#ifndef LIGHT_DEFAULT_MIREDS
#define LIGHT_DEFAULT_MIREDS 153 // Default value used by MQTT. This value is __NEVRER__ applied! #define LIGHT_DEFAULT_MIREDS 153 // Default value used by MQTT. This value is __NEVRER__ applied!
#endif
#ifndef LIGHT_STEP
#define LIGHT_STEP 32 // Step size #define LIGHT_STEP 32 // Step size
#endif
#ifndef LIGHT_USE_COLOR
#define LIGHT_USE_COLOR 1 // Use 3 first channels as RGB #define LIGHT_USE_COLOR 1 // Use 3 first channels as RGB
#endif
#ifndef LIGHT_USE_WHITE
#define LIGHT_USE_WHITE 0 // Use white channel whenever RGB have the same value #define LIGHT_USE_WHITE 0 // Use white channel whenever RGB have the same value
#endif
#ifndef LIGHT_USE_GAMMA
#define LIGHT_USE_GAMMA 0 // Use gamma correction for color channels #define LIGHT_USE_GAMMA 0 // Use gamma correction for color channels
#endif
#ifndef LIGHT_USE_CSS
#define LIGHT_USE_CSS 1 // Use CSS style to report colors (1=> "#FF0000", 0=> "255,0,0") #define LIGHT_USE_CSS 1 // Use CSS style to report colors (1=> "#FF0000", 0=> "255,0,0")
#endif
#ifndef LIGHT_USE_RGB
#define LIGHT_USE_RGB 0 // Use RGB color selector (1=> RGB, 0=> HSV) #define LIGHT_USE_RGB 0 // Use RGB color selector (1=> RGB, 0=> HSV)
#endif
#ifndef LIGHT_WHITE_FACTOR
#define LIGHT_WHITE_FACTOR 1 // When using LIGHT_USE_WHITE with uneven brightness LEDs,
// this factor is used to scale the white channel to match brightness
#endif
#ifndef LIGHT_USE_TRANSITIONS
#define LIGHT_USE_TRANSITIONS 1 // Transitions between colors #define LIGHT_USE_TRANSITIONS 1 // Transitions between colors
#endif
#ifndef LIGHT_TRANSITION_STEP
#define LIGHT_TRANSITION_STEP 10 // Time in millis between each transtion step #define LIGHT_TRANSITION_STEP 10 // Time in millis between each transtion step
#endif
#ifndef LIGHT_TRANSITION_TIME
#define LIGHT_TRANSITION_TIME 500 // Time in millis from color to color #define LIGHT_TRANSITION_TIME 500 // Time in millis from color to color
#endif
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------
// DOMOTICZ // DOMOTICZ
@ -612,12 +849,30 @@
#define INFLUXDB_SUPPORT 0 // Disable InfluxDB support by default (4.38Kb) #define INFLUXDB_SUPPORT 0 // Disable InfluxDB support by default (4.38Kb)
#endif #endif
#ifndef INFLUXDB_ENABLED
#define INFLUXDB_ENABLED 0 // InfluxDB disabled by default #define INFLUXDB_ENABLED 0 // InfluxDB disabled by default
#endif
#ifndef INFLUXDB_HOST
#define INFLUXDB_HOST "" // Default server #define INFLUXDB_HOST "" // Default server
#endif
#ifndef INFLUXDB_PORT
#define INFLUXDB_PORT 8086 // Default InfluxDB port #define INFLUXDB_PORT 8086 // Default InfluxDB port
#endif
#ifndef INFLUXDB_DATABASE
#define INFLUXDB_DATABASE "" // Default database #define INFLUXDB_DATABASE "" // Default database
#endif
#ifndef INFLUXDB_USERNAME
#define INFLUXDB_USERNAME "" // Default username #define INFLUXDB_USERNAME "" // Default username
#endif
#ifndef INFLUXDB_PASSWORD
#define INFLUXDB_PASSWORD "" // Default password #define INFLUXDB_PASSWORD "" // Default password
#endif
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------
// THINGSPEAK // THINGSPEAK
@ -666,14 +921,38 @@
#define NTP_SUPPORT 1 // Build with NTP support by default (6.78Kb) #define NTP_SUPPORT 1 // Build with NTP support by default (6.78Kb)
#endif #endif
#ifndef NTP_SERVER
#define NTP_SERVER "pool.ntp.org" // Default NTP server #define NTP_SERVER "pool.ntp.org" // Default NTP server
#endif
#ifndef NTP_TIMEOUT
#define NTP_TIMEOUT 2000 // Set NTP request timeout to 2 seconds (issue #452) #define NTP_TIMEOUT 2000 // Set NTP request timeout to 2 seconds (issue #452)
#endif
#ifndef NTP_TIME_OFFSET
#define NTP_TIME_OFFSET 60 // Default timezone offset (GMT+1) #define NTP_TIME_OFFSET 60 // Default timezone offset (GMT+1)
#endif
#ifndef NTP_DAY_LIGHT
#define NTP_DAY_LIGHT true // Enable daylight time saving by default #define NTP_DAY_LIGHT true // Enable daylight time saving by default
#endif
#ifndef NTP_SYNC_INTERVAL
#define NTP_SYNC_INTERVAL 60 // NTP initial check every minute #define NTP_SYNC_INTERVAL 60 // NTP initial check every minute
#endif
#ifndef NTP_UPDATE_INTERVAL
#define NTP_UPDATE_INTERVAL 1800 // NTP check every 30 minutes #define NTP_UPDATE_INTERVAL 1800 // NTP check every 30 minutes
#endif
#ifndef NTP_START_DELAY
#define NTP_START_DELAY 1000 // Delay NTP start 1 second #define NTP_START_DELAY 1000 // Delay NTP start 1 second
#endif
#ifndef NTP_DST_REGION
#define NTP_DST_REGION 0 // 0 for Europe, 1 for USA (defined in NtpClientLib) #define NTP_DST_REGION 0 // 0 for Europe, 1 for USA (defined in NtpClientLib)
#endif
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------
// ALEXA // ALEXA
@ -694,12 +973,24 @@
// This module is not compatible with RF_SUPPORT=1 // This module is not compatible with RF_SUPPORT=1
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------
#ifndef RF_SEND_TIMES
#define RF_SEND_TIMES 4 // How many times to send the message #define RF_SEND_TIMES 4 // How many times to send the message
#endif
#ifndef RF_SEND_DELAY
#define RF_SEND_DELAY 500 // Interval between sendings in ms #define RF_SEND_DELAY 500 // Interval between sendings in ms
#endif
#ifndef RF_RECEIVE_DELAY
#define RF_RECEIVE_DELAY 500 // Interval between recieving in ms (avoid debouncing) #define RF_RECEIVE_DELAY 500 // Interval between recieving in ms (avoid debouncing)
#endif
#ifndef RF_RAW_SUPPORT
#define RF_RAW_SUPPORT 0 // RF raw codes require a specific firmware for the EFM8BB1 #define RF_RAW_SUPPORT 0 // RF raw codes require a specific firmware for the EFM8BB1
// https://github.com/rhx/RF-Bridge-EFM8BB1 // https://github.com/rhx/RF-Bridge-EFM8BB1
#endif
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------
// IR // IR


+ 39
- 3
code/espurna/config/hardware.h View File

@ -636,6 +636,7 @@
#define MY92XX_DCKI_PIN 14 #define MY92XX_DCKI_PIN 14
#define MY92XX_COMMAND MY92XX_COMMAND_DEFAULT #define MY92XX_COMMAND MY92XX_COMMAND_DEFAULT
#define MY92XX_MAPPING 4, 3, 5, 0, 1 #define MY92XX_MAPPING 4, 3, 5, 0, 1
#define LIGHT_WHITE_FACTOR (0.1) // White LEDs are way more bright in the B1
#elif defined(ITEAD_SONOFF_LED) #elif defined(ITEAD_SONOFF_LED)
@ -1223,7 +1224,7 @@
#define RELAY1_TYPE RELAY_TYPE_NORMAL #define RELAY1_TYPE RELAY_TYPE_NORMAL
#define RELAY2_TYPE RELAY_TYPE_NORMAL #define RELAY2_TYPE RELAY_TYPE_NORMAL
// DB18B20
// DS18B20
#ifndef DALLAS_SUPPORT #ifndef DALLAS_SUPPORT
#define DALLAS_SUPPORT 1 #define DALLAS_SUPPORT 1
#endif #endif
@ -1829,7 +1830,7 @@
// https://www.aliexpress.com/wholesale?catId=0&initiative_id=SB_20180404024035&SearchText=esp-01s+relay // https://www.aliexpress.com/wholesale?catId=0&initiative_id=SB_20180404024035&SearchText=esp-01s+relay
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------
#elif defined(GENERIC_ESP01SRELAY40)
#elif defined(GENERIC_ESP01S_RELAY_V40)
// Info // Info
#define MANUFACTURER "GENERIC" #define MANUFACTURER "GENERIC"
@ -1848,7 +1849,7 @@
// https://www.aliexpress.com/wholesale?catId=0&initiative_id=SB_20180404023816&SearchText=esp-01s+led+controller // https://www.aliexpress.com/wholesale?catId=0&initiative_id=SB_20180404023816&SearchText=esp-01s+led+controller
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------
#elif defined(GENERIC_ESP01SRGBLED10)
#elif defined(GENERIC_ESP01S_RGBLED_V10)
// Info // Info
#define MANUFACTURER "GENERIC" #define MANUFACTURER "GENERIC"
@ -1866,6 +1867,41 @@
// LEDs // LEDs
#define LED1_PIN 2 #define LED1_PIN 2
// -----------------------------------------------------------------------------
// ESP-01S DHT11 v1.0
// https://www.aliexpress.com/wholesale?catId=0&initiative_id=SB_20180410105907&SearchText=esp-01s+dht11
// -----------------------------------------------------------------------------
#elif defined(GENERIC_ESP01S_DHT11_V10)
// Info
#define MANUFACTURER "GENERIC"
#define DEVICE "ESP01S_DHT11_10"
// DHT11
#ifndef DHT_SUPPORT
#define DHT_SUPPORT 1
#endif
#define DHT_PIN 2
// -----------------------------------------------------------------------------
// ESP-01S DS18B20 v1.0
// https://www.aliexpress.com/wholesale?catId=0&initiative_id=SB_20180410105933&SearchText=esp-01s+ds18b20
// -----------------------------------------------------------------------------
#elif defined(GENERIC_ESP01S_DS18B20_V10)
// Info
#define MANUFACTURER "GENERIC"
#define DEVICE "ESP01S_DS18B20_10"
// DB18B20
#ifndef DALLAS_SUPPORT
#define DALLAS_SUPPORT 1
#endif
#define DALLAS_PIN 2
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------
// Heltec Touch Relay // Heltec Touch Relay
// https://www.aliexpress.com/wholesale?catId=0&initiative_id=SB_20180408043114&SearchText=esp8266+touch+relay // https://www.aliexpress.com/wholesale?catId=0&initiative_id=SB_20180408043114&SearchText=esp8266+touch+relay


BIN
code/espurna/data/index.html.gz View File


+ 12
- 14
code/espurna/light.ino View File

@ -89,30 +89,28 @@ void _generateBrightness() {
// Convert RGB to RGBW // Convert RGB to RGBW
if (_light_has_color && _light_use_white) { if (_light_has_color && _light_use_white) {
unsigned char white, max_in, max_out;
double factor = 0;
white = std::min(_light_channel[0].inputValue, std::min(_light_channel[1].inputValue, _light_channel[2].inputValue));
max_in = std::max(_light_channel[0].inputValue, std::max(_light_channel[1].inputValue, _light_channel[2].inputValue));
// Substract the common part from RGB channels and add it to white channel. So [250,150,50] -> [200,100,0,50
unsigned char white = std::min(_light_channel[0].inputValue, std::min(_light_channel[1].inputValue, _light_channel[2].inputValue));
for (unsigned int i=0; i < 3; i++) { for (unsigned int i=0; i < 3; i++) {
_light_channel[i].value = _light_channel[i].inputValue - white; _light_channel[i].value = _light_channel[i].inputValue - white;
} }
_light_channel[3].value = white; _light_channel[3].value = white;
max_out = std::max(std::max(_light_channel[0].value, _light_channel[1].value), std::max(_light_channel[2].value, _light_channel[3].value));
if (max_out > 0) {
factor = (double) (max_in / max_out);
}
_light_channel[3].inputValue = 0;
// Scale up to equal input values. So [250,150,50] -> [200,100,0,50] -> [250, 125, 0, 63] // Scale up to equal input values. So [250,150,50] -> [200,100,0,50] -> [250, 125, 0, 63]
unsigned char max_in = std::max(_light_channel[0].inputValue, std::max(_light_channel[1].inputValue, _light_channel[2].inputValue));
unsigned char max_out = std::max(std::max(_light_channel[0].value, _light_channel[1].value), std::max(_light_channel[2].value, _light_channel[3].value));
double factor = (max_out > 0) ? (double) (max_in / max_out) : 0;
for (unsigned int i=0; i < 4; i++) { for (unsigned int i=0; i < 4; i++) {
_light_channel[i].value = round((double) _light_channel[i].value * factor * brightness); _light_channel[i].value = round((double) _light_channel[i].value * factor * brightness);
} }
// Don't apply brightness, it is already in the inputValue:
if (_light_channel.size() == 5) {
_light_channel[4].value = _light_channel[4].inputValue;
// Scale white channel to match brightness
_light_channel[3].value = constrain(_light_channel[3].value * LIGHT_WHITE_FACTOR, 0, 255);
// For the rest of channels, don't apply brightness, it is already in the inputValue:
for (unsigned char i=4; i < _light_channel.size(); i++) {
_light_channel[i].value = _light_channel[i].inputValue;
} }
} else { } else {


+ 10
- 2
code/espurna/migrate.ino View File

@ -859,7 +859,7 @@ void migrate() {
setSetting("relayGPIO", 0, 5); setSetting("relayGPIO", 0, 5);
setSetting("relayType", 0, RELAY_TYPE_INVERSE); setSetting("relayType", 0, RELAY_TYPE_INVERSE);
#elif defined(GENERIC_ESP01SRELAY40)
#elif defined(GENERIC_ESP01S_RELAY_V40)
setSetting("board", 65); setSetting("board", 65);
setSetting("ledGPIO", 0, 2); setSetting("ledGPIO", 0, 2);
@ -867,7 +867,7 @@ void migrate() {
setSetting("relayGPIO", 0, 0); setSetting("relayGPIO", 0, 0);
setSetting("relayType", 0, RELAY_TYPE_NORMAL); setSetting("relayType", 0, RELAY_TYPE_NORMAL);
#elif defined(GENERIC_ESP01SRGBLED10)
#elif defined(GENERIC_ESP01S_RGBLED_V10)
setSetting("board", 66); setSetting("board", 66);
setSetting("ledGPIO", 0, 2); setSetting("ledGPIO", 0, 2);
@ -880,6 +880,14 @@ void migrate() {
setSetting("relayGPIO", 0, 12); setSetting("relayGPIO", 0, 12);
setSetting("relayType", 0, RELAY_TYPE_NORMAL); setSetting("relayType", 0, RELAY_TYPE_NORMAL);
#elif defined(GENERIC_ESP01S_DHT11_V10)
setSetting("board", 68);
#elif defined(GENERIC_ESP01S_DS18B20_V10)
setSetting("board", 69);
#else #else
// Allow users to define new settings without migration config // Allow users to define new settings without migration config


+ 3265
- 3261
code/espurna/static/index.html.gz.h
File diff suppressed because it is too large
View File


+ 31
- 16
code/html/custom.js View File

@ -4,7 +4,8 @@ var maxNetworks;
var maxSchedules; var maxSchedules;
var messages = []; var messages = [];
var free_size = 0; var free_size = 0;
var webhost;
var urls = {};
var numChanged = 0; var numChanged = 0;
var numReboot = 0; var numReboot = 0;
@ -323,7 +324,7 @@ function doUpgrade() {
$.ajax({ $.ajax({
// Your server script to process the upload // Your server script to process the upload
url: webhost + "upgrade",
url: urls.upgrade.href,
type: "POST", type: "POST",
// Form data // Form data
@ -467,7 +468,7 @@ function doUpdate() {
} }
function doBackup() { function doBackup() {
document.getElementById("downloader").src = webhost + "config";
document.getElementById("downloader").src = urls.config.href;
return false; return false;
} }
@ -1292,22 +1293,23 @@ function hasChanged() {
// Init & connect // Init & connect
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------
function connect(host) {
function initUrls(root) {
if (typeof host === "undefined") {
host = window.location.href.replace("#", "");
} else {
if (host.indexOf("http") !== 0) {
host = "http://" + host + "/";
}
}
if (host.indexOf("http") !== 0) { return; }
var paths = ["ws", "upgrade", "config"];
urls["root"] = root;
paths.forEach(function(path) {
urls[path] = new URL(path, root);
});
webhost = host;
var wshost = host.replace("http", "ws") + "ws";
urls.ws.protocol = "ws";
}
function connectToURL(url) {
initUrls(url);
if (websock) { websock.close(); } if (websock) { websock.close(); }
websock = new WebSocket(wshost);
websock = new WebSocket(urls.ws.href);
websock.onmessage = function(evt) { websock.onmessage = function(evt) {
var data = getJson(evt.data.replace(/\n/g, "\\n").replace(/\r/g, "\\r").replace(/\t/g, "\\t")); var data = getJson(evt.data.replace(/\n/g, "\\n").replace(/\r/g, "\\r").replace(/\t/g, "\\t"));
if (data) { if (data) {
@ -1316,6 +1318,17 @@ function connect(host) {
}; };
} }
function connect(host) {
if (!host.startsWith("http:") && !host.startsWith("https:")) {
host = "http://" + host;
}
connectToURL(new URL(host));
}
function connectToCurrentURL() {
connectToURL(new URL(window.location));
}
$(function() { $(function() {
initMessages(); initMessages();
@ -1359,6 +1372,8 @@ $(function() {
$(document).on("change", "input", hasChanged); $(document).on("change", "input", hasChanged);
$(document).on("change", "select", hasChanged); $(document).on("change", "select", hasChanged);
connect();
// don't autoconnect when opening from filesystem
if (window.location.protocol === "file:") { return; }
connectToCurrentURL();
}); });

+ 1
- 1
code/html/index.html View File

@ -66,7 +66,7 @@
<div id="layout" class="webmode"> <div id="layout" class="webmode">
<a href="#menu" id="menuLink" class="menu-link">
<a id="menuLink" class="menu-link">
<span></span> <span></span>
</a> </a>


+ 52
- 4
code/platformio.ini View File

@ -1881,7 +1881,7 @@ board = esp01_1m
board_flash_mode = dout board_flash_mode = dout
lib_deps = ${common.lib_deps} lib_deps = ${common.lib_deps}
lib_ignore = ${common.lib_ignore} lib_ignore = ${common.lib_ignore}
build_flags = ${common.build_flags_1m} -DGENERIC_ESP01SRELAY40
build_flags = ${common.build_flags_1m} -DGENERIC_ESP01S_RELAY_V40
monitor_baud = 115200 monitor_baud = 115200
extra_scripts = ${common.extra_scripts} extra_scripts = ${common.extra_scripts}
@ -1892,7 +1892,7 @@ board = esp01_1m
board_flash_mode = dout board_flash_mode = dout
lib_deps = ${common.lib_deps} lib_deps = ${common.lib_deps}
lib_ignore = ${common.lib_ignore} lib_ignore = ${common.lib_ignore}
build_flags = ${common.build_flags_1m} -DGENERIC_ESP01SRELAY40
build_flags = ${common.build_flags_1m} -DGENERIC_ESP01S_RELAY_V40
upload_speed = 115200 upload_speed = 115200
upload_port = "${env.ESPURNA_IP}" upload_port = "${env.ESPURNA_IP}"
upload_flags = --auth=${env.ESPURNA_AUTH} --port 8266 upload_flags = --auth=${env.ESPURNA_AUTH} --port 8266
@ -1905,7 +1905,7 @@ board = esp01_1m
board_flash_mode = dout board_flash_mode = dout
lib_deps = ${common.lib_deps} lib_deps = ${common.lib_deps}
lib_ignore = ${common.lib_ignore} lib_ignore = ${common.lib_ignore}
build_flags = ${common.build_flags_1m} -DGENERIC_ESP01SRGBLED10
build_flags = ${common.build_flags_1m} -DGENERIC_ESP01S_RGBLED_V10
monitor_baud = 115200 monitor_baud = 115200
extra_scripts = ${common.extra_scripts} extra_scripts = ${common.extra_scripts}
@ -1916,7 +1916,55 @@ board = esp01_1m
board_flash_mode = dout board_flash_mode = dout
lib_deps = ${common.lib_deps} lib_deps = ${common.lib_deps}
lib_ignore = ${common.lib_ignore} lib_ignore = ${common.lib_ignore}
build_flags = ${common.build_flags_1m} -DGENERIC_ESP01SRGBLED10
build_flags = ${common.build_flags_1m} -DGENERIC_ESP01S_RGBLED_V10
upload_speed = 115200
upload_port = "${env.ESPURNA_IP}"
upload_flags = --auth=${env.ESPURNA_AUTH} --port 8266
extra_scripts = ${common.extra_scripts}
[env:generic-esp01s-dht11-10]
platform = ${common.platform}
framework = arduino
board = esp01_1m
board_flash_mode = dout
lib_deps = ${common.lib_deps}
lib_ignore = ${common.lib_ignore}
build_flags = ${common.build_flags_1m} -DGENERIC_ESP01S_DHT11_V10
monitor_baud = 115200
extra_scripts = ${common.extra_scripts}
[env:generic-esp01s-dht11-10-ota]
platform = ${common.platform}
framework = arduino
board = esp01_1m
board_flash_mode = dout
lib_deps = ${common.lib_deps}
lib_ignore = ${common.lib_ignore}
build_flags = ${common.build_flags_1m} -DGENERIC_ESP01S_DHT11_V10
upload_speed = 115200
upload_port = "${env.ESPURNA_IP}"
upload_flags = --auth=${env.ESPURNA_AUTH} --port 8266
extra_scripts = ${common.extra_scripts}
[env:generic-esp01s-ds18b20-10]
platform = ${common.platform}
framework = arduino
board = esp01_1m
board_flash_mode = dout
lib_deps = ${common.lib_deps}
lib_ignore = ${common.lib_ignore}
build_flags = ${common.build_flags_1m} -DGENERIC_ESP01S_DS18B20_V10
monitor_baud = 115200
extra_scripts = ${common.extra_scripts}
[env:generic-esp01s-ds18b20-10-ota]
platform = ${common.platform}
framework = arduino
board = esp01_1m
board_flash_mode = dout
lib_deps = ${common.lib_deps}
lib_ignore = ${common.lib_ignore}
build_flags = ${common.build_flags_1m} -DGENERIC_ESP01S_DS18B20_V10
upload_speed = 115200 upload_speed = 115200
upload_port = "${env.ESPURNA_IP}" upload_port = "${env.ESPURNA_IP}"
upload_flags = --auth=${env.ESPURNA_AUTH} --port 8266 upload_flags = --auth=${env.ESPURNA_AUTH} --port 8266


BIN
images/devices/arniex-swifitch.jpg View File

Before After
Width: 400  |  Height: 400  |  Size: 34 KiB

BIN
images/devices/generic-dht11-10.jpg View File

Before After
Width: 400  |  Height: 400  |  Size: 18 KiB

BIN
images/devices/generic-ds18b20-10.jpg View File

Before After
Width: 400  |  Height: 400  |  Size: 18 KiB

BIN
images/devices/generic-relay-40.jpg View File

Before After
Width: 550  |  Height: 550  |  Size: 44 KiB Width: 400  |  Height: 400  |  Size: 27 KiB

BIN
images/devices/generic-rgbled-10.jpg View File

Before After
Width: 500  |  Height: 500  |  Size: 51 KiB Width: 400  |  Height: 400  |  Size: 35 KiB

BIN
images/devices/ike-espike.jpg View File

Before After
Width: 400  |  Height: 400  |  Size: 22 KiB

BIN
images/devices/itead-sonoff-basic-2.jpg View File

Before After
Width: 800  |  Height: 600  |  Size: 251 KiB

BIN
images/devices/swifitch.png View File

Before After
Width: 3356  |  Height: 2780  |  Size: 321 KiB

BIN
images/devices/yjzk-2gang-switch.jpg View File

Before After
Width: 400  |  Height: 400  |  Size: 8.3 KiB

Loading…
Cancel
Save