Browse Source

Merge branch 'dev' into sensors

rfm69
Xose Pérez 6 years ago
parent
commit
d093c581ba
16 changed files with 3111 additions and 2854 deletions
  1. +2
    -1
      code/espurna/config/arduino.h
  2. +0
    -18
      code/espurna/config/general.h
  3. +64
    -2
      code/espurna/config/hardware.h
  4. BIN
      code/espurna/data/index.html.gz
  5. +1
    -1
      code/espurna/espurna.ino
  6. +189
    -79
      code/espurna/homeassistant.ino
  7. +16
    -0
      code/espurna/migrate.ino
  8. +2729
    -2722
      code/espurna/static/index.html.gz.h
  9. +2
    -2
      code/espurna/uartmqtt.ino
  10. +2
    -1
      code/espurna/utils.ino
  11. +8
    -5
      code/gulpfile.js
  12. +2
    -0
      code/html/custom.css
  13. +7
    -0
      code/html/custom.js
  14. +60
    -17
      code/html/index.html
  15. +3
    -4
      code/package.json
  16. +26
    -2
      code/platformio.ini

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

@ -60,12 +60,14 @@
//#define ARILUX_AL_LC11
//#define ARILUX_AL_LC02
//#define WEMOS_D1_TARPUNA_SHIELD
//#define GIZWITS_WITTY_CLOUD
//--------------------------------------------------------------------------------
// Features (values below are non-default values)
//--------------------------------------------------------------------------------
//#define ALEXA_SUPPORT 0
//#define BROKER_SUPPORT 0
//#define DEBUG_SERIAL_SUPPORT 0
//#define DEBUG_TELNET_SUPPORT 0
//#define DEBUG_UDP_SUPPORT 1
@ -77,7 +79,6 @@
//#define LLMNR_SUPPORT 1 // Only with Arduino Core 2.4.0
//#define MDNS_SERVER_SUPPORT 0
//#define MDNS_CLIENT_SUPPORT 1
//#define BROKER_SUPPORT 0
//#define MQTT_SUPPORT 0
//#define NETBIOS_SUPPORT 1 // Only with Arduino Core 2.4.0
//#define NOFUSS_SUPPORT 1


+ 0
- 18
code/espurna/config/general.h View File

@ -15,24 +15,6 @@
#define ARRAYINIT(type, name, ...) \
type name[] = {__VA_ARGS__};
//------------------------------------------------------------------------------
// ESPURNA CORE
//------------------------------------------------------------------------------
#ifdef ESPURNA_CORE
#define ALEXA_SUPPORT 0
#define BROKER_SUPPORT 0
#define DOMOTICZ_SUPPORT 0
#define HOMEASSISTANT_SUPPORT 0
#define I2C_SUPPORT 0
#define MQTT_SUPPORT 0
#define NTP_SUPPORT 0
#define SCHEDULER_SUPPORT 0
#define SENSOR_SUPPORT 0
#define THINGSPEAK_SUPPORT 0
#define WEB_SUPPORT 0
#endif
//------------------------------------------------------------------------------
// TELNET
//------------------------------------------------------------------------------


+ 64
- 2
code/espurna/config/hardware.h View File

@ -20,11 +20,38 @@
//
// Besides, other hardware specific information should be stated here
// -----------------------------------------------------------------------------
// ESPurna Core
// -----------------------------------------------------------------------------
#if defined(ESPURNA_CORE)
// This is a special device targeted to generate a light-weight binary image
// meant to be able to do two-step-updates:
// https://github.com/xoseperez/espurna/wiki/TwoStepUpdates
// Info
#define MANUFACTURER "ESPRESSIF"
#define DEVICE "ESPURNA_CORE"
// Disable non-core modules
#define ALEXA_SUPPORT 0
#define BROKER_SUPPORT 0
#define DOMOTICZ_SUPPORT 0
#define HOMEASSISTANT_SUPPORT 0
#define I2C_SUPPORT 0
#define MQTT_SUPPORT 0
#define NTP_SUPPORT 0
#define SCHEDULER_SUPPORT 0
#define SENSOR_SUPPORT 0
#define THINGSPEAK_SUPPORT 0
#define WEB_SUPPORT 0
// -----------------------------------------------------------------------------
// Development boards
// -----------------------------------------------------------------------------
#if defined(NODEMCU_LOLIN)
#elif defined(NODEMCU_LOLIN)
// Info
#define MANUFACTURER "NODEMCU"
@ -476,12 +503,14 @@
// and disables any possibly harmful combination with S6 set to 0.
// If you are sure you will only use S6 to 1 you can comment the
// BUTTON1_LNGCLICK and BUTTON1_LNGLNGCLICK options below to recover the
// AP mode and factory reset functionalities.
// reset mode and factory reset functionalities, or link other actions like
// AP mode in the commented line below.
#define BUTTON1_PRESS BUTTON_MODE_TOGGLE
#define BUTTON1_CLICK BUTTON_MODE_NONE
#define BUTTON1_DBLCLICK BUTTON_MODE_NONE
#define BUTTON1_LNGCLICK BUTTON_MODE_NONE
//#define BUTTON1_LNGCLICK BUTTON_MODE_AP
#define BUTTON1_LNGLNGCLICK BUTTON_MODE_NONE
#define BUTTON2_PRESS BUTTON_MODE_TOGGLE
#define BUTTON2_CLICK BUTTON_MODE_NONE
@ -1364,6 +1393,39 @@
#define LIGHT_ENABLE_PIN 15
#elif defined(GIZWITS_WITTY_CLOUD)
// Info
#define MANUFACTURER "GIZWITS"
#define DEVICE "WITTY_CLOUD"
#define RELAY_PROVIDER RELAY_PROVIDER_LIGHT
#define LIGHT_PROVIDER LIGHT_PROVIDER_DIMMER
#define DUMMY_RELAY_COUNT 1
// Buttons
#define BUTTON1_PIN 4
#define BUTTON1_MODE BUTTON_PUSHBUTTON | BUTTON_DEFAULT_HIGH
#define BUTTON1_PRESS BUTTON_MODE_TOGGLE
#define BUTTON1_CLICK BUTTON_MODE_NONE
#define BUTTON1_DBLCLICK BUTTON_MODE_NONE
#define BUTTON1_LNGCLICK BUTTON_MODE_NONE
#define BUTTON1_LNGLNGCLICK BUTTON_MODE_RESET
#define ANALOG_SUPPORT 1
// LEDs
#define LED1_PIN 2 // BLUE build-in
#define LED1_PIN_INVERSE 1
// Light
#define LIGHT_CHANNELS 3
#define LIGHT_CH1_PIN 15 // RED
#define LIGHT_CH2_PIN 12 // GREEN
#define LIGHT_CH3_PIN 13 // BLUE
#define LIGHT_CH1_INVERSE 0
#define LIGHT_CH2_INVERSE 0
#define LIGHT_CH3_INVERSE 0
// -----------------------------------------------------------------------------
// KMC 70011
// https://www.amazon.com/KMC-Monitoring-Required-Control-Compatible/dp/B07313TH7B


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


+ 1
- 1
code/espurna/espurna.ino View File

@ -147,7 +147,7 @@ void setup() {
#if SCHEDULER_SUPPORT
schSetup();
#endif
#ifdef UART_MQTT_SUPPORT
#if UART_MQTT_SUPPORT
uartmqttSetup();
#endif


+ 189
- 79
code/espurna/homeassistant.ino View File

@ -14,124 +14,185 @@ bool _haEnabled = false;
bool _haSendFlag = false;
// -----------------------------------------------------------------------------
void _haWebSocketOnSend(JsonObject& root) {
root["haVisible"] = 1;
root["haPrefix"] = getSetting("haPrefix", HOMEASSISTANT_PREFIX);
root["haEnabled"] = getSetting("haEnabled", HOMEASSISTANT_ENABLED).toInt() == 1;
}
// SENSORS
// -----------------------------------------------------------------------------
#if SENSOR_SUPPORT
void _haSendMagnitude(unsigned char i) {
void _haSendMagnitude(unsigned char i, JsonObject& config) {
String output;
unsigned char type = magnitudeType(i);
config["name"] = getSetting("hostname") + String(" ") + magnitudeTopic(type);
config["platform"] = "mqtt";
config["device_class"] = "sensor";
config["state_topic"] = mqttTopic(magnitudeTopicIndex(i).c_str(), false);
config["unit_of_measurement"] = magnitudeUnits(type);
if (_haEnabled) {
}
DynamicJsonBuffer jsonBuffer;
JsonObject& root = jsonBuffer.createObject();
void _haSendMagnitudes() {
unsigned char type = magnitudeType(i);
for (unsigned char i=0; i<magnitudeCount(); i++) {
root["device_class"] = "sensor";
root["name"] = getSetting("hostname") + String(" ") + magnitudeTopic(type);
root["state_topic"] = mqttTopic(magnitudeTopicIndex(i).c_str(), false);
root["unit_of_measurement"] = magnitudeUnits(type);
String topic = getSetting("haPrefix", HOMEASSISTANT_PREFIX) +
"/sensor/" +
getSetting("hostname") + "_" + String(i) +
"/config";
String output;
if (_haEnabled) {
DynamicJsonBuffer jsonBuffer;
JsonObject& config = jsonBuffer.createObject();
_haSendMagnitude(i, config);
config.printTo(output);
}
root.printTo(output);
mqttSendRaw(topic.c_str(), output.c_str());
mqttSend(MQTT_TOPIC_STATUS, MQTT_STATUS_ONLINE, true);
}
String topic = getSetting("haPrefix", HOMEASSISTANT_PREFIX) +
"/sensor/" +
getSetting("hostname") + "_" + String(i) +
"/config";
}
mqttSendRaw(topic.c_str(), output.c_str());
mqttSend(MQTT_TOPIC_STATUS, MQTT_STATUS_ONLINE, true);
#endif // SENSOR_SUPPORT
}
// -----------------------------------------------------------------------------
// SWITCHES & LIGHTS
// -----------------------------------------------------------------------------
void _haSendMagnitudes() {
for (unsigned char i=0; i<magnitudeCount(); i++) {
_haSendMagnitude(i);
void _haSendSwitch(unsigned char i, JsonObject& config) {
String name = getSetting("hostname");
if (relayCount() > 1) {
name += String(" #") + String(i);
}
}
#endif
config["name"] = name;
config["platform"] = "mqtt";
if (relayCount()) {
config["state_topic"] = mqttTopic(MQTT_TOPIC_RELAY, i, false);
config["command_topic"] = mqttTopic(MQTT_TOPIC_RELAY, i, true);
config["payload_on"] = String("1");
config["payload_off"] = String("0");
config["availability_topic"] = mqttTopic(MQTT_TOPIC_STATUS, false);
config["payload_available"] = String("1");
config["payload_not_available"] = String("0");
}
void _haSendSwitch(unsigned char i) {
#if LIGHT_PROVIDER != LIGHT_PROVIDER_NONE
String output;
if (i == 0) {
if (_haEnabled) {
if (lightHasColor()) {
config["brightness_state_topic"] = mqttTopic(MQTT_TOPIC_BRIGHTNESS, false);
config["brightness_command_topic"] = mqttTopic(MQTT_TOPIC_BRIGHTNESS, true);
config["rgb_state_topic"] = mqttTopic(MQTT_TOPIC_COLOR_RGB, false);
config["rgb_command_topic"] = mqttTopic(MQTT_TOPIC_COLOR_RGB, true);
config["color_temp_command_topic"] = mqttTopic(MQTT_TOPIC_MIRED, true);
}
DynamicJsonBuffer jsonBuffer;
JsonObject& root = jsonBuffer.createObject();
if (lightChannels() > 3) {
config["white_value_state_topic"] = mqttTopic(MQTT_TOPIC_CHANNEL, 3, false);
config["white_value_command_topic"] = mqttTopic(MQTT_TOPIC_CHANNEL, 3, true);
}
String name = getSetting("hostname");
if (relayCount() > 1) {
name += String(" switch #") + String(i);
}
root["name"] = name;
root["platform"] = "mqtt";
if (relayCount()) {
root["state_topic"] = mqttTopic(MQTT_TOPIC_RELAY, i, false);
root["command_topic"] = mqttTopic(MQTT_TOPIC_RELAY, i, true);
root["payload_on"] = String("1");
root["payload_off"] = String("0");
root["availability_topic"] = mqttTopic(MQTT_TOPIC_STATUS, false);
root["payload_available"] = String("1");
root["payload_not_available"] = String("0");
}
#endif // LIGHT_PROVIDER != LIGHT_PROVIDER_NONE
#if LIGHT_PROVIDER != LIGHT_PROVIDER_NONE
}
if (i == 0) {
void _haSendSwitches() {
if (lightHasColor()) {
root["brightness_state_topic"] = mqttTopic(MQTT_TOPIC_BRIGHTNESS, false);
root["brightness_command_topic"] = mqttTopic(MQTT_TOPIC_BRIGHTNESS, true);
root["rgb_state_topic"] = mqttTopic(MQTT_TOPIC_COLOR_RGB, false);
root["rgb_command_topic"] = mqttTopic(MQTT_TOPIC_COLOR_RGB, true);
root["color_temp_command_topic"] = mqttTopic(MQTT_TOPIC_MIRED, true);
}
#if (LIGHT_PROVIDER != LIGHT_PROVIDER_NONE) || (defined(ITEAD_SLAMPHER))
String type = String("light");
#else
String type = String("switch");
#endif
if (lightChannels() > 3) {
root["white_value_state_topic"] = mqttTopic(MQTT_TOPIC_CHANNEL, 3, false);
root["white_value_command_topic"] = mqttTopic(MQTT_TOPIC_CHANNEL, 3, true);
}
for (unsigned char i=0; i<relayCount(); i++) {
}
String topic = getSetting("haPrefix", HOMEASSISTANT_PREFIX) +
"/" + type +
"/" + getSetting("hostname") + "_" + String(i) +
"/config";
String output;
if (_haEnabled) {
DynamicJsonBuffer jsonBuffer;
JsonObject& config = jsonBuffer.createObject();
_haSendSwitch(i, config);
config.printTo(output);
}
#endif // LIGHT_PROVIDER != LIGHT_PROVIDER_NONE
mqttSendRaw(topic.c_str(), output.c_str());
mqttSend(MQTT_TOPIC_STATUS, MQTT_STATUS_ONLINE, true);
root.printTo(output);
}
#if LIGHT_PROVIDER == LIGHT_PROVIDER_NONE
String component = String("switch");
#else
String component = String("light");
#endif
}
String topic = getSetting("haPrefix", HOMEASSISTANT_PREFIX) +
"/" + component +
"/" + getSetting("hostname") + "_" + String(i) +
"/config";
// -----------------------------------------------------------------------------
mqttSendRaw(topic.c_str(), output.c_str());
mqttSend(MQTT_TOPIC_STATUS, MQTT_STATUS_ONLINE, true);
String _haGetConfig() {
}
String output;
#if (LIGHT_PROVIDER != LIGHT_PROVIDER_NONE) || (defined(ITEAD_SLAMPHER))
String type = String("light");
#else
String type = String("switch");
#endif
void _haSendSwitches() {
for (unsigned char i=0; i<relayCount(); i++) {
_haSendSwitch(i);
DynamicJsonBuffer jsonBuffer;
JsonObject& config = jsonBuffer.createObject();
_haSendSwitch(i, config);
output += type + ":\n";
bool first = true;
for (auto kv : config) {
if (first) {
output += " - ";
first = false;
} else {
output += " ";
}
output += kv.key + String(": ") + kv.value.as<String>() + String("\n");
}
output += "\n";
}
#if SENSOR_SUPPORT
for (unsigned char i=0; i<magnitudeCount(); i++) {
DynamicJsonBuffer jsonBuffer;
JsonObject& config = jsonBuffer.createObject();
_haSendMagnitude(i, config);
output += "sensor:\n";
bool first = true;
for (auto kv : config) {
if (first) {
output += " - ";
first = false;
} else {
output += " ";
}
output += kv.key + String(": ") + kv.value.as<String>() + String("\n");
}
output += "\n";
}
#endif
return output;
}
void _haSend() {
@ -161,6 +222,49 @@ void _haConfigure() {
_haSend();
}
#if WEB_SUPPORT
void _haWebSocketOnSend(JsonObject& root) {
root["haVisible"] = 1;
root["haPrefix"] = getSetting("haPrefix", HOMEASSISTANT_PREFIX);
root["haEnabled"] = getSetting("haEnabled", HOMEASSISTANT_ENABLED).toInt() == 1;
}
void _haWebSocketOnAction(uint32_t client_id, const char * action, JsonObject& data) {
if (strcmp(action, "haconfig") == 0) {
String output = _haGetConfig();
output.replace(" ", "&nbsp;");
output.replace("\n", "<br />");
output = String("{\"haConfig\": \"") + output + String("\"}");
wsSend(client_id, output.c_str());
}
}
#endif
#if TERMINAL_SUPPORT
void _haInitCommands() {
settingsRegisterCommand(F("HA.CONFIG"), [](Embedis* e) {
DEBUG_MSG(_haGetConfig().c_str());
DEBUG_MSG_P(PSTR("+OK\n"));
});
settingsRegisterCommand(F("HA.SEND"), [](Embedis* e) {
setSetting("haEnabled", "1");
_haConfigure();
wsSend(_haWebSocketOnSend);
DEBUG_MSG_P(PSTR("+OK\n"));
});
settingsRegisterCommand(F("HA.CLEAR"), [](Embedis* e) {
setSetting("haEnabled", "0");
_haConfigure();
wsSend(_haWebSocketOnSend);
DEBUG_MSG_P(PSTR("+OK\n"));
});
}
#endif
// -----------------------------------------------------------------------------
void haSetup() {
@ -170,6 +274,7 @@ void haSetup() {
#if WEB_SUPPORT
wsOnSendRegister(_haWebSocketOnSend);
wsOnAfterParseRegister(_haConfigure);
wsOnActionRegister(_haWebSocketOnAction);
#endif
// On MQTT connect check if we have something to send
@ -177,6 +282,11 @@ void haSetup() {
if (type == MQTT_CONNECT_EVENT) _haSend();
});
#if TERMINAL_SUPPORT
_haInitCommands();
#endif
}
#endif // HOMEASSISTANT_SUPPORT

+ 16
- 0
code/espurna/migrate.ino View File

@ -711,6 +711,22 @@ void migrate() {
setSetting("cf1GPIO", 5);
setSetting("cfGPIO", 4);
#elif defined(GIZWITS_WITTY_CLOUD)
setSetting("board", 54);
setSetting("ledGPIO", 0, 2);
setSetting("ledLogic", 0, 1);
setSetting("btnGPIO", 0, 4);
setSetting("relayProvider", RELAY_PROVIDER_LIGHT);
setSetting("lightProvider", LIGHT_PROVIDER_DIMMER);
setSetting("chGPIO", 0, 15);
setSetting("chGPIO", 1, 12);
setSetting("chGPIO", 2, 13);
setSetting("chLogic", 0, 0);
setSetting("chLogic", 1, 0);
setSetting("chLogic", 2, 0);
setSetting("relays", 1);
#else
// Allow users to define new settings without migration config


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


+ 2
- 2
code/espurna/uartmqtt.ino View File

@ -7,7 +7,7 @@ Adapted by Xose Pérez <xose dot perez at gmail dot com>
*/
#ifdef UART_MQTT_SUPPORT
#if UART_MQTT_SUPPORT
char _uartmqttBuffer[UART_MQTT_BUFFER_SIZE];
bool _uartmqttNewData = false;
@ -100,4 +100,4 @@ void uartmqttSetup() {
}
#endif
#endif // UART_MQTT_SUPPORT

+ 2
- 1
code/espurna/utils.ino View File

@ -336,7 +336,8 @@ void info() {
#if SENSOR_SUPPORT
DEBUG_MSG_P(PSTR("\n[INIT] SENSORS:"));
DEBUG_MSG_P(PSTR("\n"));
DEBUG_MSG_P(PSTR("[INIT] SENSORS:"));
#if ANALOG_SUPPORT
DEBUG_MSG_P(PSTR(" ANALOG"));


+ 8
- 5
code/gulpfile.js View File

@ -36,7 +36,7 @@ const inline = require('gulp-inline');
const inlineImages = require('gulp-css-base64');
const favicon = require('gulp-base64-favicon');
const htmllint = require('gulp-htmllint');
const gutil = require('gulp-util');
const log = require('fancy-log');
const csslint = require('gulp-csslint');
const dataFolder = 'espurna/data/';
@ -76,10 +76,13 @@ var toHeader = function(filename) {
var htmllintReporter = function(filepath, issues) {
if (issues.length > 0) {
issues.forEach(function (issue) {
gutil.log(
gutil.colors.cyan('[gulp-htmllint] ') +
gutil.colors.white(filepath + ' [' + issue.line + ',' + issue.column + ']: ') +
gutil.colors.red('(' + issue.code + ') ' + issue.msg)
log.info(
'[gulp-htmllint] ' +
filepath + ' [' +
issue.line + ',' +
issue.column + ']: ' +
'(' + issue.code + ') ' +
issue.msg
);
});
process.exitCode = 1;


+ 2
- 0
code/html/custom.css View File

@ -160,6 +160,7 @@ div.state {
.button-rfb-learn,
.button-upgrade-browse,
.button-ha-add,
.button-ha-config,
.button-settings-backup,
.button-settings-restore,
.button-apikey {
@ -278,6 +279,7 @@ span.slider {
display: none;
}
#haConfig,
#scanResult {
color: #888;
font-family: 'Courier New', monospace;


+ 7
- 0
code/html/custom.js View File

@ -517,6 +517,12 @@ function doScan() {
return false;
}
function doHAConfig() {
$("#haConfig").html("");
sendAction("haconfig", {});
return false;
}
// -----------------------------------------------------------------------------
// Visualization
// -----------------------------------------------------------------------------
@ -1261,6 +1267,7 @@ $(function() {
$(".button-reboot").on("click", doReboot);
$(".button-reconnect").on("click", doReconnect);
$(".button-wifi-scan").on("click", doScan);
$(".button-ha-config").on("click", doHAConfig);
$(".button-settings-backup").on("click", doBackup);
$(".button-settings-restore").on("click", doRestore);
$(".button-settings-factory").on("click", doFactoryReset);


+ 60
- 17
code/html/index.html View File

@ -118,6 +118,10 @@
<a href="#" class="pure-menu-link" data="panel-domoticz">DOMOTICZ</a>
</li>
<li class="pure-menu-item module module-ha">
<a href="#" class="pure-menu-link" data="panel-ha">HASS</a>
</li>
<li class="pure-menu-item module module-idb">
<a href="#" class="pure-menu-link" data="panel-idb">INFLUXDB</a>
</li>
@ -313,22 +317,6 @@
<div class="pure-u-1 pure-u-lg-1-4"><input type="checkbox" name="alexaEnabled" tabindex="13" /></div>
</div>
<div class="pure-g module module-ha">
<label class="pure-u-1 pure-u-lg-1-4">Home Assistant</label>
<div class="pure-u-1 pure-u-lg-1-4"><input type="checkbox" name="haEnabled" tabindex="14" /></div>
<div class="pure-u-0 pure-u-lg-1-2"></div>
<div class="pure-u-0 pure-u-lg-1-4"></div>
<div class="pure-u-1 pure-u-lg-3-4 hint">
Home Assistant auto-discovery feature. Enable and save to add the device to your HA console.
When using a colour light you might want to disable CSS style so Home Assistant can parse the color.
</div>
</div>
<div class="pure-g module module-ha">
<label class="pure-u-1 pure-u-lg-1-4">Home Assistant Prefix</label>
<input class="pure-u-1 pure-u-lg-1-4" name="haPrefix" type="text" tabindex="15" />
</div>
</fieldset>
</div>
</div>
@ -579,7 +567,7 @@
<div class="pure-g">
<div class="pure-u-0 pure-u-lg-1-4"></div>
<span class="pure-u-1 pure-u-lg-3-4 terminal" id="scanResult" name="scanResult"></span>
<span class="pure-u-1 pure-u-lg-3-4" id="scanResult" name="scanResult"></span>
</div>
<legend>Networks</legend>
@ -810,6 +798,61 @@
</div>
<div class="panel" id="panel-ha">
<div class="header">
<h1>HOME ASSISTANT</h1>
<h2>
Add this device to your Home Assistant.
</h2>
</div>
<div class="page">
<fieldset>
<legend>Discover</legend>
<div class="pure-g">
<label class="pure-u-1 pure-u-lg-1-4">Discover</label>
<div class="pure-u-1 pure-u-lg-1-4"><input type="checkbox" name="haEnabled" tabindex="14" /></div>
<div class="pure-u-0 pure-u-lg-1-2"></div>
<div class="pure-u-0 pure-u-lg-1-4"></div>
<div class="pure-u-1 pure-u-lg-3-4 hint">
Home Assistant auto-discovery feature. Enable and save to add the device to your HA console.
When using a colour light you might want to disable CSS style so Home Assistant can parse the color.
</div>
</div>
<div class="pure-g">
<label class="pure-u-1 pure-u-lg-1-4">Prefix</label>
<input class="pure-u-1 pure-u-lg-1-4" name="haPrefix" type="text" tabindex="15" />
</div>
<legend>Configuration</legend>
<div class="pure-g">
<label class="pure-u-1 pure-u-lg-1-4">Configuration</label>
<div class="pure-u-1-4 pure-u-lg-3-4"><button class="pure-button button-ha-config pure-u-1-3">Show</button></div>
<div class="pure-u-0 pure-u-lg-1-4"></div>
<div class="pure-u-1 pure-u-lg-3-4 hint">
These are the settings you should copy to your Home Assistant "configuration.yaml" file.
If any of the sections below (switch, light, sensor) already exists, do not dupplicate it,
simply copy the contents of the section below the ones already present.
</div>
</div>
<div class="pure-g">
<div class="pure-u-0 pure-u-lg-1-4"></div>
<div class="pure-u-1 pure-u-lg-3-4"><span id="haConfig" name="haConfig"></span></div>
</div>
</fieldset>
</div>
</div>
<div class="panel" id="panel-thingspeak">
<div class="header">


+ 3
- 4
code/package.json View File

@ -7,6 +7,7 @@
"license": "GPL-3.0",
"devDependencies": {
"del": "^2.2.1",
"fancy-log": "^1.3.2",
"gulp": "^3.9.1",
"gulp-base64-favicon": "^1.0.2",
"gulp-clean-css": "^3.4.2",
@ -16,8 +17,6 @@
"gulp-htmllint": "0.0.14",
"gulp-htmlmin": "^2.0.0",
"gulp-inline": "^0.1.1",
"gulp-uglify": "^1.5.3",
"gulp-util": "^3.0.8"
},
"dependencies": {}
"gulp-uglify": "^1.5.3"
}
}

+ 26
- 2
code/platformio.ini View File

@ -45,7 +45,7 @@ board = esp01_1m
board_flash_mode = dout
lib_deps = ${common.lib_deps}
lib_ignore = ${common.lib_ignore}
build_flags = ${common.build_flags_1m} -DITEAD_SONOFF_BASIC -DESPURNA_CORE
build_flags = ${common.build_flags_1m} -DESPURNA_CORE
monitor_baud = 115200
extra_scripts = ${common.extra_scripts}
@ -56,7 +56,7 @@ board = d1_mini
board_flash_mode = dout
lib_deps = ${common.lib_deps}
lib_ignore = ${common.lib_ignore}
build_flags = ${common.build_flags} -DITEAD_SONOFF_BASIC -DESPURNA_CORE
build_flags = ${common.build_flags} -DESPURNA_CORE
monitor_baud = 115200
extra_scripts = ${common.extra_scripts}
@ -1448,6 +1448,30 @@ upload_speed = 460800
monitor_baud = 115200
extra_scripts = ${common.extra_scripts}
[env:gizwits-witty-cloud]
platform = ${common.platform}
framework = arduino
board = esp12e
board_flash_mode = dout
lib_deps = ${common.lib_deps}
lib_ignore = ${common.lib_ignore}
build_flags = ${common.build_flags} -DGIZWITS_WITTY_CLOUD
monitor_baud = 115200
extra_scripts = ${common.extra_scripts}
[env:gizwits-witty-cloud-ota]
platform = ${common.platform}
framework = arduino
board = esp12e
board_flash_mode = dout
lib_deps = ${common.lib_deps}
lib_ignore = ${common.lib_ignore}
build_flags = ${common.build_flags} -DGIZWITS_WITTY_CLOUD
upload_speed = 115200
upload_port = "${env.ESPURNA_IP}"
upload_flags = --auth=${env.ESPURNA_AUTH} --port 8266
extra_scripts = ${common.extra_scripts}
[env:stm-relay-ota]
platform = ${common.platform}
framework = arduino


Loading…
Cancel
Save