mirror of
https://github.com/esphome/esphome.git
synced 2024-12-25 15:04:54 +01:00
Merge branch 'dev' into hbridge-switch
This commit is contained in:
commit
54c732b1e1
6 changed files with 24 additions and 9 deletions
|
@ -1,13 +1,13 @@
|
|||
# Dummy integration to allow relying on AsyncTCP
|
||||
import esphome.codegen as cg
|
||||
import esphome.config_validation as cv
|
||||
from esphome.core import CORE, coroutine_with_priority
|
||||
from esphome.const import (
|
||||
PLATFORM_BK72XX,
|
||||
PLATFORM_ESP32,
|
||||
PLATFORM_ESP8266,
|
||||
PLATFORM_BK72XX,
|
||||
PLATFORM_RTL87XX,
|
||||
)
|
||||
from esphome.core import CORE, coroutine_with_priority
|
||||
|
||||
CODEOWNERS = ["@OttoWinter"]
|
||||
|
||||
|
@ -22,7 +22,7 @@ CONFIG_SCHEMA = cv.All(
|
|||
async def to_code(config):
|
||||
if CORE.is_esp32 or CORE.is_libretiny:
|
||||
# https://github.com/esphome/AsyncTCP/blob/master/library.json
|
||||
cg.add_library("esphome/AsyncTCP-esphome", "2.1.3")
|
||||
cg.add_library("esphome/AsyncTCP-esphome", "2.1.4")
|
||||
elif CORE.is_esp8266:
|
||||
# https://github.com/esphome/ESPAsyncTCP
|
||||
cg.add_library("esphome/ESPAsyncTCP-esphome", "2.0.0")
|
||||
|
|
|
@ -256,6 +256,7 @@ bool Dsmr::parse_telegram() {
|
|||
MyData data;
|
||||
ESP_LOGV(TAG, "Trying to parse telegram");
|
||||
this->stop_requesting_data_();
|
||||
|
||||
::dsmr::ParseResult<void> res =
|
||||
::dsmr::P1Parser::parse(&data, this->telegram_, this->bytes_read_, false,
|
||||
this->crc_check_); // Parse telegram according to data definition. Ignore unknown values.
|
||||
|
@ -267,6 +268,11 @@ bool Dsmr::parse_telegram() {
|
|||
} else {
|
||||
this->status_clear_warning();
|
||||
this->publish_sensors(data);
|
||||
|
||||
// publish the telegram, after publishing the sensors so it can also trigger action based on latest values
|
||||
if (this->s_telegram_ != nullptr) {
|
||||
this->s_telegram_->publish_state(std::string(this->telegram_, this->bytes_read_));
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -85,6 +85,9 @@ class Dsmr : public Component, public uart::UARTDevice {
|
|||
void set_##s(text_sensor::TextSensor *sensor) { s_##s##_ = sensor; }
|
||||
DSMR_TEXT_SENSOR_LIST(DSMR_SET_TEXT_SENSOR, )
|
||||
|
||||
// handled outside dsmr
|
||||
void set_telegram(text_sensor::TextSensor *sensor) { s_telegram_ = sensor; }
|
||||
|
||||
protected:
|
||||
void receive_telegram_();
|
||||
void receive_encrypted_telegram_();
|
||||
|
@ -124,6 +127,9 @@ class Dsmr : public Component, public uart::UARTDevice {
|
|||
bool header_found_{false};
|
||||
bool footer_found_{false};
|
||||
|
||||
// handled outside dsmr
|
||||
text_sensor::TextSensor *s_telegram_{nullptr};
|
||||
|
||||
// Sensor member pointers
|
||||
#define DSMR_DECLARE_SENSOR(s) sensor::Sensor *s_##s##_{nullptr};
|
||||
DSMR_SENSOR_LIST(DSMR_DECLARE_SENSOR, )
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
import esphome.codegen as cg
|
||||
import esphome.config_validation as cv
|
||||
from esphome.components import text_sensor
|
||||
|
||||
from esphome.const import CONF_INTERNAL
|
||||
from . import Dsmr, CONF_DSMR_ID
|
||||
|
||||
AUTO_LOAD = ["dsmr"]
|
||||
|
@ -22,6 +22,9 @@ CONFIG_SCHEMA = cv.Schema(
|
|||
cv.Optional("water_equipment_id"): text_sensor.text_sensor_schema(),
|
||||
cv.Optional("sub_equipment_id"): text_sensor.text_sensor_schema(),
|
||||
cv.Optional("gas_delivered_text"): text_sensor.text_sensor_schema(),
|
||||
cv.Optional("telegram"): text_sensor.text_sensor_schema().extend(
|
||||
{cv.Optional(CONF_INTERNAL, default=True): cv.boolean}
|
||||
),
|
||||
}
|
||||
).extend(cv.COMPONENT_SCHEMA)
|
||||
|
||||
|
@ -37,7 +40,9 @@ async def to_code(config):
|
|||
if id and id.type == text_sensor.TextSensor:
|
||||
var = await text_sensor.new_text_sensor(conf)
|
||||
cg.add(getattr(hub, f"set_{key}")(var))
|
||||
text_sensors.append(f"F({key})")
|
||||
if key != "telegram":
|
||||
# telegram is not handled by dsmr
|
||||
text_sensors.append(f"F({key})")
|
||||
|
||||
if text_sensors:
|
||||
cg.add_define(
|
||||
|
|
|
@ -170,13 +170,11 @@ def _notify_old_style(config):
|
|||
return config
|
||||
|
||||
|
||||
# NOTE: Keep this in mind when updating the recommended version:
|
||||
# * For all constants below, update platformio.ini (in this repo)
|
||||
# The dev and latest branches will be at *least* this version, which is what matters.
|
||||
ARDUINO_VERSIONS = {
|
||||
"dev": (cv.Version(1, 7, 0), "https://github.com/libretiny-eu/libretiny.git"),
|
||||
"latest": (cv.Version(1, 7, 0), "libretiny"),
|
||||
"recommended": (cv.Version(1, 5, 1), None),
|
||||
"recommended": (cv.Version(1, 7, 0), None),
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -119,7 +119,7 @@ lib_deps =
|
|||
WiFi ; wifi,web_server_base,ethernet (Arduino built-in)
|
||||
Update ; ota,web_server_base (Arduino built-in)
|
||||
${common:arduino.lib_deps}
|
||||
esphome/AsyncTCP-esphome@2.1.3 ; async_tcp
|
||||
esphome/AsyncTCP-esphome@2.1.4 ; async_tcp
|
||||
WiFiClientSecure ; http_request,nextion (Arduino built-in)
|
||||
HTTPClient ; http_request,nextion (Arduino built-in)
|
||||
ESPmDNS ; mdns (Arduino built-in)
|
||||
|
|
Loading…
Reference in a new issue