Move ESPHome version define (#607)

* Move ESPHome version define

* Lint
This commit is contained in:
Otto Winter 2019-06-03 16:07:15 +02:00
parent caa5b20791
commit a933d4aeb6
No known key found for this signature in database
GPG key ID: DB66C0BE6013F97E
10 changed files with 19 additions and 6 deletions

View file

@ -6,6 +6,7 @@
#include "esphome/core/application.h"
#include "esphome/core/util.h"
#include "esphome/core/defines.h"
#include "esphome/core/version.h"
#ifdef USE_DEEP_SLEEP
#include "esphome/components/deep_sleep/deep_sleep_component.h"

View file

@ -2,6 +2,7 @@
#include "esphome/core/log.h"
#include "esphome/core/helpers.h"
#include "esphome/core/defines.h"
#include "esphome/core/version.h"
#ifdef ARDUINO_ARCH_ESP32
#include <rom/rtc.h>
@ -19,7 +20,7 @@ void DebugComponent::dump_config() {
return;
#endif
ESP_LOGD(TAG, "ESPHome Core version %s", ESPHOME_VERSION);
ESP_LOGD(TAG, "ESPHome version %s", ESPHOME_VERSION);
this->free_heap_ = ESP.getFreeHeap();
ESP_LOGD(TAG, "Free Heap Size: %u bytes", this->free_heap_);

View file

@ -2,6 +2,7 @@
#include "esphome/core/log.h"
#include "esphome/core/application.h"
#include "esphome/core/helpers.h"
#include "esphome/core/version.h"
namespace esphome {
namespace mqtt {

View file

@ -1,6 +1,7 @@
#include "version_text_sensor.h"
#include "esphome/core/log.h"
#include "esphome/core/application.h"
#include "esphome/core/version.h"
namespace esphome {
namespace version {

View file

@ -1,5 +1,6 @@
#include "esphome/core/application.h"
#include "esphome/core/log.h"
#include "esphome/core/version.h"
#ifdef USE_STATUS_LED
#include "esphome/components/status_led/status_led.h"

View file

@ -1,8 +1,6 @@
#pragma once
// This file is auto-generated! Do not edit!
#define ESPHOME_VERSION "dev"
#define USE_API
#define USE_LOGGER
#define USE_BINARY_SENSOR

View file

@ -1,6 +1,7 @@
#include "esphome/core/util.h"
#include "esphome/core/defines.h"
#include "esphome/core/application.h"
#include "esphome/core/version.h"
#ifdef USE_WIFI
#include "esphome/components/wifi/wifi_component.h"

3
esphome/core/version.h Normal file
View file

@ -0,0 +1,3 @@
#pragma once
// This file is auto-generated! Do not edit!
#define ESPHOME_VERSION "dev"

View file

@ -10,7 +10,7 @@ from esphome.const import ARDUINO_VERSION_ESP32_DEV, ARDUINO_VERSION_ESP8266_DEV
CONF_ESPHOME, CONF_INCLUDES, CONF_LIBRARIES, \
CONF_NAME, CONF_ON_BOOT, CONF_ON_LOOP, CONF_ON_SHUTDOWN, CONF_PLATFORM, \
CONF_PLATFORMIO_OPTIONS, CONF_PRIORITY, CONF_TRIGGER_ID, \
CONF_ESP8266_RESTORE_FROM_FLASH, __version__, ARDUINO_VERSION_ESP8266_2_3_0, \
CONF_ESP8266_RESTORE_FROM_FLASH, ARDUINO_VERSION_ESP8266_2_3_0, \
ARDUINO_VERSION_ESP8266_2_5_0, ARDUINO_VERSION_ESP8266_2_5_1, ARDUINO_VERSION_ESP8266_2_5_2
from esphome.core import CORE, coroutine_with_priority
from esphome.helpers import copy_file_if_changed, walk_files
@ -201,7 +201,6 @@ def add_includes(includes):
@coroutine_with_priority(100.0)
def to_code(config):
cg.add_global(cg.global_ns.namespace('esphome').using)
cg.add_define('ESPHOME_VERSION', __version__)
cg.add(cg.App.pre_setup(config[CONF_NAME], cg.RawExpression('__DATE__ ", " __TIME__')))
for conf in config.get(CONF_ON_BOOT, []):

View file

@ -6,7 +6,7 @@ import re
from esphome.config import iter_components
from esphome.const import CONF_BOARD_FLASH_MODE, CONF_ESPHOME, CONF_PLATFORMIO_OPTIONS, \
HEADER_FILE_EXTENSIONS, SOURCE_FILE_EXTENSIONS
HEADER_FILE_EXTENSIONS, SOURCE_FILE_EXTENSIONS, __version__
from esphome.core import CORE, EsphomeError
from esphome.helpers import mkdir_p, read_file, write_file_if_changed, walk_files
from esphome.storage_json import StorageJSON, storage_path
@ -268,7 +268,12 @@ DEFINES_H_FORMAT = ESPHOME_H_FORMAT = u"""\
#pragma once
{}
"""
VERSION_H_FORMAT = u"""\
#pragma once
#define ESPHOME_VERSION "{}"
"""
DEFINES_H_TARGET = 'esphome/core/defines.h'
VERSION_H_TARGET = 'esphome/core/version.h'
ESPHOME_README_TXT = u"""
THIS DIRECTORY IS AUTO-GENERATED, DO NOT MODIFY
@ -335,6 +340,8 @@ def copy_src_tree():
CORE.relative_src_path('esphome', 'README.txt'))
write_file_if_changed(ESPHOME_H_FORMAT.format(include_s),
CORE.relative_src_path('esphome.h'))
write_file_if_changed(VERSION_H_FORMAT.format(__version__),
CORE.relative_src_path('esphome' 'core', 'version.h'))
def generate_defines_h():