mirror of
https://github.com/esphome/esphome.git
synced 2024-11-22 23:18:10 +01:00
add water delivered to dsmr component (#4237)
Co-authored-by: Jerome <jerome992@internet.lu>
This commit is contained in:
parent
d9398a91d1
commit
bd9a4ff8de
2 changed files with 10 additions and 0 deletions
|
@ -19,6 +19,7 @@ CONF_CRC_CHECK = "crc_check"
|
||||||
CONF_DECRYPTION_KEY = "decryption_key"
|
CONF_DECRYPTION_KEY = "decryption_key"
|
||||||
CONF_DSMR_ID = "dsmr_id"
|
CONF_DSMR_ID = "dsmr_id"
|
||||||
CONF_GAS_MBUS_ID = "gas_mbus_id"
|
CONF_GAS_MBUS_ID = "gas_mbus_id"
|
||||||
|
CONF_WATER_MBUS_ID = "water_mbus_id"
|
||||||
CONF_MAX_TELEGRAM_LENGTH = "max_telegram_length"
|
CONF_MAX_TELEGRAM_LENGTH = "max_telegram_length"
|
||||||
CONF_REQUEST_INTERVAL = "request_interval"
|
CONF_REQUEST_INTERVAL = "request_interval"
|
||||||
CONF_REQUEST_PIN = "request_pin"
|
CONF_REQUEST_PIN = "request_pin"
|
||||||
|
@ -53,6 +54,7 @@ CONFIG_SCHEMA = cv.All(
|
||||||
cv.Optional(CONF_DECRYPTION_KEY): _validate_key,
|
cv.Optional(CONF_DECRYPTION_KEY): _validate_key,
|
||||||
cv.Optional(CONF_CRC_CHECK, default=True): cv.boolean,
|
cv.Optional(CONF_CRC_CHECK, default=True): cv.boolean,
|
||||||
cv.Optional(CONF_GAS_MBUS_ID, default=1): cv.int_,
|
cv.Optional(CONF_GAS_MBUS_ID, default=1): cv.int_,
|
||||||
|
cv.Optional(CONF_WATER_MBUS_ID, default=2): cv.int_,
|
||||||
cv.Optional(CONF_MAX_TELEGRAM_LENGTH, default=1500): cv.int_,
|
cv.Optional(CONF_MAX_TELEGRAM_LENGTH, default=1500): cv.int_,
|
||||||
cv.Optional(CONF_REQUEST_PIN): pins.gpio_output_pin_schema,
|
cv.Optional(CONF_REQUEST_PIN): pins.gpio_output_pin_schema,
|
||||||
cv.Optional(
|
cv.Optional(
|
||||||
|
@ -82,6 +84,7 @@ async def to_code(config):
|
||||||
cg.add(var.set_receive_timeout(config[CONF_RECEIVE_TIMEOUT].total_milliseconds))
|
cg.add(var.set_receive_timeout(config[CONF_RECEIVE_TIMEOUT].total_milliseconds))
|
||||||
|
|
||||||
cg.add_build_flag("-DDSMR_GAS_MBUS_ID=" + str(config[CONF_GAS_MBUS_ID]))
|
cg.add_build_flag("-DDSMR_GAS_MBUS_ID=" + str(config[CONF_GAS_MBUS_ID]))
|
||||||
|
cg.add_build_flag("-DDSMR_WATER_MBUS_ID=" + str(config[CONF_WATER_MBUS_ID]))
|
||||||
|
|
||||||
# DSMR Parser
|
# DSMR Parser
|
||||||
cg.add_library("glmnet/Dsmr", "0.7")
|
cg.add_library("glmnet/Dsmr", "0.7")
|
||||||
|
|
|
@ -8,6 +8,7 @@ from esphome.const import (
|
||||||
DEVICE_CLASS_GAS,
|
DEVICE_CLASS_GAS,
|
||||||
DEVICE_CLASS_POWER,
|
DEVICE_CLASS_POWER,
|
||||||
DEVICE_CLASS_VOLTAGE,
|
DEVICE_CLASS_VOLTAGE,
|
||||||
|
DEVICE_CLASS_WATER,
|
||||||
STATE_CLASS_MEASUREMENT,
|
STATE_CLASS_MEASUREMENT,
|
||||||
STATE_CLASS_TOTAL_INCREASING,
|
STATE_CLASS_TOTAL_INCREASING,
|
||||||
UNIT_AMPERE,
|
UNIT_AMPERE,
|
||||||
|
@ -236,6 +237,12 @@ CONFIG_SCHEMA = cv.Schema(
|
||||||
device_class=DEVICE_CLASS_GAS,
|
device_class=DEVICE_CLASS_GAS,
|
||||||
state_class=STATE_CLASS_TOTAL_INCREASING,
|
state_class=STATE_CLASS_TOTAL_INCREASING,
|
||||||
),
|
),
|
||||||
|
cv.Optional("water_delivered"): sensor.sensor_schema(
|
||||||
|
unit_of_measurement=UNIT_CUBIC_METER,
|
||||||
|
accuracy_decimals=3,
|
||||||
|
device_class=DEVICE_CLASS_WATER,
|
||||||
|
state_class=STATE_CLASS_TOTAL_INCREASING,
|
||||||
|
),
|
||||||
}
|
}
|
||||||
).extend(cv.COMPONENT_SCHEMA)
|
).extend(cv.COMPONENT_SCHEMA)
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue