From 95b10c087e4e3698c5fbae7b49281a045307c993 Mon Sep 17 00:00:00 2001 From: Knut Ahlers Date: Wed, 31 Oct 2018 13:41:26 +0100 Subject: [PATCH] Rebuild using config-overrides Signed-off-by: Knut Ahlers --- .gitignore | 4 +- Makefile | 24 ++++++-- config_sonoff-minimal.yml | 45 --------------- config_sonoff.yml | 30 ---------- override_sonoff-minimal.h | 116 ++++++++++++++++++++++++++++++++++++++ override_sonoff.h | 114 +++++++++++++++++++++++++++++++++++++ requirements.txt | 1 + 7 files changed, 253 insertions(+), 81 deletions(-) delete mode 100644 config_sonoff-minimal.yml delete mode 100644 config_sonoff.yml create mode 100644 override_sonoff-minimal.h create mode 100644 override_sonoff.h create mode 100644 requirements.txt diff --git a/.gitignore b/.gitignore index 3a9ff58..3eecb05 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,5 @@ +build +env +korvike tasmota venv -build diff --git a/Makefile b/Makefile index 6d27a4f..eaf25fc 100644 --- a/Makefile +++ b/Makefile @@ -1,4 +1,5 @@ -TASMOTA_VERSION=v6.2.1 +TASMOTA_VERSION=v6.3.0 +export PLATFORMIO_BUILD_FLAGS=-DUSE_CONFIG_OVERRIDE default: build_sonoff build_sonoff-minimal @@ -7,14 +8,14 @@ chown: ci: full-clean default -build_%: download - $(MAKE) update_user-config_$* +build_%: download korvike venv + ./korvike -i override_$*.h -o tasmota/sonoff/user_config_override.h cd tasmota && ../venv/bin/platformio run -e $* mkdir -p build cp tasmota/.pioenvs/$*/firmware.bin build/$*.bin -clean: - rm -rf tasmota venv +clean final: + rm -rf korvike tasmota venv download: git clone https://github.com/arendst/Sonoff-Tasmota.git tasmota @@ -22,3 +23,16 @@ download: full-clean: clean rm -rf build + +korvike: + curl -sSfL https://github.com/Luzifer/korvike/releases/download/v0.5.0/korvike_linux_amd64.tar.gz | tar -xz + mv korvike_linux_amd64 korvike + +venv: + virtualenv -p python2 venv + ./venv/bin/pip install -r requirements.txt + +.PHONY: venv + +manual: + vault2env --key=secret/jenkins/build-tasmota -- bash -eux -o pipefail -c 'env | grep -v PATH > ./env && docker run --rm -i --env-file=env -e UID=$(shell id -u) -v "$(CURDIR):/src" -w /src python:2.7 make ci chown final' diff --git a/config_sonoff-minimal.yml b/config_sonoff-minimal.yml deleted file mode 100644 index 85fb841..0000000 --- a/config_sonoff-minimal.yml +++ /dev/null @@ -1,45 +0,0 @@ ---- - -STA_SSID1: '${WIFI_SSID}' -STA_PASS1: '${WIFI_PASS}' - -OTA_URL: '${OTA_URL}' - -MQTT_HOST: '${MQTT_HOST}' -MQTT_USER: '${MQTT_USER}' -MQTT_PASS: '${MQTT_PASS}' -MQTT_TOPIC: '"unconfigured"' - -TELE_PERIOD: '30' - -USE_DS18x20: '!undef' - -USE_DOMOTICZ: '!undef' -USE_HOME_ASSISTANT: '!undef' -HOME_ASSISTANT_DISCOVERY_ENABLE: "0" -USE_EMULATION: '!undef' -USE_DISCOVERY: '!undef' -USE_TIMERS: '!undef' -USE_RULES: '!undef' -USE_I2C: '!undef' - -USE_MHZ19: '!undef' -USE_SENSEAIR: '!undef' -USE_PMS5003: '!undef' -USE_NOVA_SDS: '!undef' -USE_PZEM004T: '!undef' -USE_SERIAL_BRIDGE: '!undef' -USE_IR_RECEIVE: '!undef' -USE_SR04: '!undef' - -NTP_SERVER1: '"ptbtime1.ptb.de"' -NTP_SERVER2: '"ptbtime2.ptb.de"' - -USE_IR_REMOTE: '!undef' -USE_WS2812: '!undef' -USE_ARILUX_RF: '!undef' -USE_RF_FLASH: '!undef' - -BE_MINIMAL: '!def' - -... diff --git a/config_sonoff.yml b/config_sonoff.yml deleted file mode 100644 index e4d02dd..0000000 --- a/config_sonoff.yml +++ /dev/null @@ -1,30 +0,0 @@ ---- - -STA_SSID1: '${WIFI_SSID}' -STA_PASS1: '${WIFI_PASS}' - -OTA_URL: '${OTA_URL}' - -MQTT_HOST: '${MQTT_HOST}' -MQTT_USER: '${MQTT_USER}' -MQTT_PASS: '${MQTT_PASS}' -MQTT_TOPIC: '"unconfigured"' - -TELE_PERIOD: '30' - -USE_DS18x20: '!undef' - -USE_DOMOTICZ: '!undef' -HOME_ASSISTANT_DISCOVERY_ENABLE: "0" -USE_EMULATION: '!undef' -USE_DISCOVERY: '!undef' - -NTP_SERVER1: '"ptbtime1.ptb.de"' -NTP_SERVER2: '"ptbtime2.ptb.de"' - -USE_IR_REMOTE: '!undef' -USE_WS2812: '!undef' -USE_ARILUX_RF: '!undef' -USE_RF_FLASH: '!undef' - -... diff --git a/override_sonoff-minimal.h b/override_sonoff-minimal.h new file mode 100644 index 0000000..9cf87e3 --- /dev/null +++ b/override_sonoff-minimal.h @@ -0,0 +1,116 @@ +#ifndef _USER_CONFIG_OVERRIDE_H_ +#define _USER_CONFIG_OVERRIDE_H_ + +// force the compiler to show a warning to confirm that this file is inlcuded +#warning **** user_config_override.h: Using settings override with flavour "sonoff-minimal" + +/*********************************************************************************************\ + * SECTION 1 + * - After initial load any change here only take effect if CFG_HOLDER is changed too +\*********************************************************************************************/ + +// -- Wifi ---------------------------------------- + +#undef STA_SSID1 +#define STA_SSID1 "{{ env "WIFI_SSID" }}" // [Ssid1] Wifi SSID + +#undef STA_PASS1 +#define STA_PASS1 "{{ env "WIFI_PASS" }}" // [Password1] Wifi password + +// -- Ota ----------------------------------------- +#undef OTA_URL +#define OTA_URL "{{ env "OTA_URL" }}" // [OtaUrl] + +// -- MQTT ---------------------------------------- +#undef MQTT_HOST +#define MQTT_HOST "{{ env "MQTT_HOST" }}" // [MqttHost] + +#undef MQTT_USER +#define MQTT_USER "{{ env "MQTT_USER" }}" // [MqttUser] MQTT user + +#undef MQTT_PASS +#define MQTT_PASS "{{ env "MQTT_PASS" }}" // [MqttPassword] MQTT password + +// -- MQTT topics --------------------------------- +// %topic% token options (also ButtonTopic and SwitchTopic) +#undef MQTT_TOPIC +#define MQTT_TOPIC "unconfigured" // [Topic] (unique) MQTT device topic, set to 'PROJECT "_%06X"' for unique topic including device MAC address + +// -- MQTT - Telemetry ---------------------------- +#undef TELE_PERIOD +#define TELE_PERIOD 30 // [TelePeriod] Telemetry (0 = disable, 10 - 3600 seconds) + +// -- Time - Up to three NTP servers in your region +#undef NTP_SERVER1 +#define NTP_SERVER1 "ptbtime1.ptb.de" // [NtpServer1] Select first NTP server by name or IP address (129.250.35.250) + +#undef NTP_SERVER2 +#define NTP_SERVER2 "ptbtime2.ptb.de" // [NtpServer2] Select second NTP server by name or IP address (5.39.184.5) + +// -- Location ------------------------------------ +#undef LATITUDE +#define LATITUDE 53.58328 // [Latitude] Your location to be used with sunrise and sunset + +#undef LONGITUDE +#define LONGITUDE 9.71719 // [Longitude] Your location to be used with sunrise and sunset + +/*********************************************************************************************\ + * END OF SECTION 1 + * + * SECTION 2 + * - Enable a feature by removing both // in front of it + * - Disable a feature by preceding it with // +\*********************************************************************************************/ + +// -- MQTT - Domoticz ----------------------------- +#undef USE_DOMOTICZ // Enable Domoticz (+6k code, +0.3k mem) + +// -- MQTT - Home Assistant Discovery ------------- +#undef USE_HOME_ASSISTANT // Enable Home Assistant Discovery Support (+2k code) + +// -- HTTP ---------------------------------------- + #undef USE_EMULATION // Enable Belkin WeMo and Hue Bridge emulation for Alexa (+16k code, +2k mem) + +// -- mDNS ---------------------------------------- +#undef USE_DISCOVERY // Enable mDNS for the following services (+8k code, +0.3k mem) + +// -- Time ---------------------------------------- +#undef USE_TIMERS // Add support for up to 16 timers (+2k2 code) + +// -- Rules --------------------------------------- +#undef USE_RULES // Add support for rules (+4k4 code) + +// -- Internal Analog input ----------------------- +#define USE_ADC_VCC // Display Vcc in Power status. Disable for use as Analog input on selected devices + +// -- One wire sensors ---------------------------- +#undef USE_DS18x20 // Optional for more than one DS18x20 sensors with id sort, single scan and read retry (+1k3 code) + +// -- I2C sensors --------------------------------- +#undef USE_I2C + +// -- Serial sensors ------------------------------ +#undef USE_MHZ19 // Add support for MH-Z19 CO2 sensor (+2k code) +#undef USE_SENSEAIR // Add support for SenseAir K30, K70 and S8 CO2 sensor (+2k3 code) +#undef USE_PMS5003 // Add support for PMS5003 and PMS7003 particle concentration sensor (+1k3 code) +#undef USE_NOVA_SDS // Add support for SDS011 and SDS021 particle concentration sensor (+0k7 code) +#undef USE_SERIAL_BRIDGE // Add support for software Serial Bridge (+0k8 code) +#undef USE_TUYA_DIMMER // Add support for Tuya Serial Dimmer + +// Power monitoring sensors ----------------------- +#undef USE_PZEM004T // Add support for PZEM004T Energy monitor (+2k code) +#undef USE_PZEM_AC // Add support for PZEM014,016 Energy monitor (+1k1 code) +#undef USE_PZEM_DC // Add support for PZEM003,017 Energy monitor (+1k1 code) +#undef USE_MCP39F501 // Add support for MCP39F501 Energy monitor as used in Shelly 2 (+3k1 code) + +// -- Low level interface devices ----------------- +#undef USE_IR_REMOTE // Send IR remote commands using library IRremoteESP8266 and ArduinoJson (+4k code, 0k3 mem, 48 iram) +#undef USE_WS2812 // WS2812 Led string using library NeoPixelBus (+5k code, +1k mem, 232 iram) - Disable by // +#undef USE_ARILUX_RF // Add support for Arilux RF remote controller (+0k8 code, 252 iram (non 2.3.0)) +#undef USE_SR04 // Add support for HC-SR04 ultrasonic devices (+1k code) +#undef USE_HX711 // Add support for HX711 load cell (+1k5 code) +#undef USE_RF_FLASH // Add support for flashing the EFM8BB1 chip on the Sonoff RF Bridge. C2CK must be connected to GPIO4, C2D to GPIO5 on the PCB (+3k code) +#undef USE_TX20_WIND_SENSOR // Add support for La Crosse TX20 anemometer (+2k code) +#undef USE_RC_SWITCH // Add support for RF transceiver using library RcSwitch (+2k7 code, 460 iram) + +#endif // _USER_CONFIG_OVERRIDE_H_ diff --git a/override_sonoff.h b/override_sonoff.h new file mode 100644 index 0000000..57ee3db --- /dev/null +++ b/override_sonoff.h @@ -0,0 +1,114 @@ +#ifndef _USER_CONFIG_OVERRIDE_H_ +#define _USER_CONFIG_OVERRIDE_H_ + +// force the compiler to show a warning to confirm that this file is inlcuded +#warning **** user_config_override.h: Using settings override with flavour "sonoff" + +/*********************************************************************************************\ + * SECTION 1 + * - After initial load any change here only take effect if CFG_HOLDER is changed too +\*********************************************************************************************/ + +// -- Wifi ---------------------------------------- + +#undef STA_SSID1 +#define STA_SSID1 "{{ env "WIFI_SSID" }}" // [Ssid1] Wifi SSID + +#undef STA_PASS1 +#define STA_PASS1 "{{ env "WIFI_PASS" }}" // [Password1] Wifi password + +// -- Ota ----------------------------------------- +#undef OTA_URL +#define OTA_URL "{{ env "OTA_URL" }}" // [OtaUrl] + +// -- MQTT ---------------------------------------- +#undef MQTT_HOST +#define MQTT_HOST "{{ env "MQTT_HOST" }}" // [MqttHost] + +#undef MQTT_USER +#define MQTT_USER "{{ env "MQTT_USER" }}" // [MqttUser] MQTT user + +#undef MQTT_PASS +#define MQTT_PASS "{{ env "MQTT_PASS" }}" // [MqttPassword] MQTT password + +// -- MQTT topics --------------------------------- +// %topic% token options (also ButtonTopic and SwitchTopic) +#undef MQTT_TOPIC +#define MQTT_TOPIC "unconfigured" // [Topic] (unique) MQTT device topic, set to 'PROJECT "_%06X"' for unique topic including device MAC address + +// -- MQTT - Telemetry ---------------------------- +#undef TELE_PERIOD +#define TELE_PERIOD 30 // [TelePeriod] Telemetry (0 = disable, 10 - 3600 seconds) + +// -- Time - Up to three NTP servers in your region +#undef NTP_SERVER1 +#define NTP_SERVER1 "ptbtime1.ptb.de" // [NtpServer1] Select first NTP server by name or IP address (129.250.35.250) + +#undef NTP_SERVER2 +#define NTP_SERVER2 "ptbtime2.ptb.de" // [NtpServer2] Select second NTP server by name or IP address (5.39.184.5) + +// -- Location ------------------------------------ +#undef LATITUDE +#define LATITUDE 53.58328 // [Latitude] Your location to be used with sunrise and sunset + +#undef LONGITUDE +#define LONGITUDE 9.71719 // [Longitude] Your location to be used with sunrise and sunset + +/*********************************************************************************************\ + * END OF SECTION 1 + * + * SECTION 2 + * - Enable a feature by removing both // in front of it + * - Disable a feature by preceding it with // +\*********************************************************************************************/ + +// -- MQTT - Domoticz ----------------------------- +#undef USE_DOMOTICZ // Enable Domoticz (+6k code, +0.3k mem) + +// -- MQTT - Home Assistant Discovery ------------- +#undef USE_HOME_ASSISTANT // Enable Home Assistant Discovery Support (+2k code) + +// -- HTTP ---------------------------------------- + #undef USE_EMULATION // Enable Belkin WeMo and Hue Bridge emulation for Alexa (+16k code, +2k mem) + +// -- Time ---------------------------------------- +#undef USE_TIMERS // Add support for up to 16 timers (+2k2 code) + +// -- Rules --------------------------------------- +#undef USE_RULES // Add support for rules (+4k4 code) + +// -- Internal Analog input ----------------------- +#define USE_ADC_VCC // Display Vcc in Power status. Disable for use as Analog input on selected devices + +// -- One wire sensors ---------------------------- + // WARNING: Select none for default one DS18B20 sensor or enable one of the following two options for multiple sensors +//#define USE_DS18x20_LEGACY // Optional for more than one DS18x20 sensors with dynamic scan using library OneWire (+1k5 code) +#undef USE_DS18x20 // Optional for more than one DS18x20 sensors with id sort, single scan and read retry (+1k3 code) +// #define W1_PARASITE_POWER // If using USE_DS18x20 then optimize for parasite powered sensors + +// -- Serial sensors ------------------------------ +#undef USE_MHZ19 // Add support for MH-Z19 CO2 sensor (+2k code) +#undef USE_SENSEAIR // Add support for SenseAir K30, K70 and S8 CO2 sensor (+2k3 code) +#undef USE_PMS5003 // Add support for PMS5003 and PMS7003 particle concentration sensor (+1k3 code) +#undef USE_NOVA_SDS // Add support for SDS011 and SDS021 particle concentration sensor (+0k7 code) +#undef USE_SERIAL_BRIDGE // Add support for software Serial Bridge (+0k8 code) +#undef USE_TUYA_DIMMER // Add support for Tuya Serial Dimmer + +// Power monitoring sensors ----------------------- +#undef USE_PZEM004T // Add support for PZEM004T Energy monitor (+2k code) +#undef USE_PZEM_AC // Add support for PZEM014,016 Energy monitor (+1k1 code) +#undef USE_PZEM_DC // Add support for PZEM003,017 Energy monitor (+1k1 code) +#undef USE_MCP39F501 // Add support for MCP39F501 Energy monitor as used in Shelly 2 (+3k1 code) + +// -- Low level interface devices ----------------- +#undef USE_IR_REMOTE // Send IR remote commands using library IRremoteESP8266 and ArduinoJson (+4k code, 0k3 mem, 48 iram) +#undef USE_WS2812 // WS2812 Led string using library NeoPixelBus (+5k code, +1k mem, 232 iram) - Disable by // +#undef USE_ARILUX_RF // Add support for Arilux RF remote controller (+0k8 code, 252 iram (non 2.3.0)) +#undef USE_SR04 // Add support for HC-SR04 ultrasonic devices (+1k code) +#undef USE_HX711 // Add support for HX711 load cell (+1k5 code) +#undef USE_RF_FLASH // Add support for flashing the EFM8BB1 chip on the Sonoff RF Bridge. C2CK must be connected to GPIO4, C2D to GPIO5 on the PCB (+3k code) +#undef USE_TX20_WIND_SENSOR // Add support for La Crosse TX20 anemometer (+2k code) +#undef USE_RC_SWITCH // Add support for RF transceiver using library RcSwitch (+2k7 code, 460 iram) + + +#endif // _USER_CONFIG_OVERRIDE_H_ diff --git a/requirements.txt b/requirements.txt new file mode 100644 index 0000000..7c71512 --- /dev/null +++ b/requirements.txt @@ -0,0 +1 @@ +platformio