Merge branch 'dev' into features/dfrobot_sn0395/targets-tracking

This commit is contained in:
Robin Thoni 2024-06-24 10:53:18 +02:00 committed by GitHub
commit 0e000a3164
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
13 changed files with 20 additions and 44 deletions

View file

@ -56,7 +56,7 @@ SENSOR_TYPES = {
CONFIG_SCHEMA = cv.Schema( CONFIG_SCHEMA = cv.Schema(
{ {
cv.Required(CONF_HAIER_ID): cv.use_id(HonClimate), cv.GenerateID(CONF_HAIER_ID): cv.use_id(HonClimate),
} }
).extend({cv.Optional(type): schema for type, schema in SENSOR_TYPES.items()}) ).extend({cv.Optional(type): schema for type, schema in SENSOR_TYPES.items()})
@ -64,8 +64,8 @@ CONFIG_SCHEMA = cv.Schema(
async def to_code(config): async def to_code(config):
paren = await cg.get_variable(config[CONF_HAIER_ID]) paren = await cg.get_variable(config[CONF_HAIER_ID])
for type, _ in SENSOR_TYPES.items(): for type_ in SENSOR_TYPES:
if conf := config.get(type): if conf := config.get(type_):
sens = await binary_sensor.new_binary_sensor(conf) sens = await binary_sensor.new_binary_sensor(conf)
binary_sensor_type = getattr(BinarySensorTypeEnum, type.upper()) binary_sensor_type = getattr(BinarySensorTypeEnum, type_.upper())
cg.add(paren.set_sub_binary_sensor(binary_sensor_type, sens)) cg.add(paren.set_sub_binary_sensor(binary_sensor_type, sens))

View file

@ -21,7 +21,7 @@ ICON_SPRAY_BOTTLE = "mdi:spray-bottle"
CONFIG_SCHEMA = cv.Schema( CONFIG_SCHEMA = cv.Schema(
{ {
cv.Required(CONF_HAIER_ID): cv.use_id(HonClimate), cv.GenerateID(CONF_HAIER_ID): cv.use_id(HonClimate),
cv.Optional(CONF_SELF_CLEANING): button.button_schema( cv.Optional(CONF_SELF_CLEANING): button.button_schema(
SelfCleaningButton, SelfCleaningButton,
icon=ICON_SPRAY_BOTTLE, icon=ICON_SPRAY_BOTTLE,

View file

@ -183,7 +183,6 @@ BASE_CONFIG_SCHEMA = (
cv.Optional( cv.Optional(
CONF_SUPPORTED_SWING_MODES, CONF_SUPPORTED_SWING_MODES,
default=[ default=[
"OFF",
"VERTICAL", "VERTICAL",
"HORIZONTAL", "HORIZONTAL",
"BOTH", "BOTH",
@ -211,7 +210,7 @@ CONFIG_SCHEMA = cv.All(
): cv.boolean, ): cv.boolean,
cv.Optional( cv.Optional(
CONF_SUPPORTED_PRESETS, CONF_SUPPORTED_PRESETS,
default=list(["BOOST", "COMFORT"]), # No AWAY by default default=["BOOST", "COMFORT"], # No AWAY by default
): cv.ensure_list( ): cv.ensure_list(
cv.enum(SUPPORTED_CLIMATE_PRESETS_SMARTAIR2_OPTIONS, upper=True) cv.enum(SUPPORTED_CLIMATE_PRESETS_SMARTAIR2_OPTIONS, upper=True)
), ),
@ -231,7 +230,7 @@ CONFIG_SCHEMA = cv.All(
): cv.int_range(min=PROTOCOL_CONTROL_PACKET_SIZE, max=50), ): cv.int_range(min=PROTOCOL_CONTROL_PACKET_SIZE, max=50),
cv.Optional( cv.Optional(
CONF_SUPPORTED_PRESETS, CONF_SUPPORTED_PRESETS,
default=list(["BOOST", "ECO", "SLEEP"]), # No AWAY by default default=["BOOST", "ECO", "SLEEP"], # No AWAY by default
): cv.ensure_list( ): cv.ensure_list(
cv.enum(SUPPORTED_CLIMATE_PRESETS_HON_OPTIONS, upper=True) cv.enum(SUPPORTED_CLIMATE_PRESETS_HON_OPTIONS, upper=True)
), ),
@ -427,11 +426,7 @@ def _final_validate(config):
"No logger component found, logging for Haier protocol is disabled" "No logger component found, logging for Haier protocol is disabled"
) )
cg.add_build_flag("-DHAIER_LOG_LEVEL=0") cg.add_build_flag("-DHAIER_LOG_LEVEL=0")
if ( if config.get(CONF_WIFI_SIGNAL) and CONF_WIFI not in full_config:
(CONF_WIFI_SIGNAL in config)
and (config[CONF_WIFI_SIGNAL])
and CONF_WIFI not in full_config
):
raise cv.Invalid( raise cv.Invalid(
f"No WiFi configured, if you want to use haier climate without WiFi add {CONF_WIFI_SIGNAL}: false to climate configuration" f"No WiFi configured, if you want to use haier climate without WiFi add {CONF_WIFI_SIGNAL}: false to climate configuration"
) )

View file

@ -137,16 +137,16 @@ SENSOR_TYPES = {
CONFIG_SCHEMA = cv.Schema( CONFIG_SCHEMA = cv.Schema(
{ {
cv.Required(CONF_HAIER_ID): cv.use_id(HonClimate), cv.GenerateID(CONF_HAIER_ID): cv.use_id(HonClimate),
} }
).extend({cv.Optional(type): schema for type, schema in SENSOR_TYPES.items()}) ).extend({cv.Optional(type_): schema for type_, schema in SENSOR_TYPES.items()})
async def to_code(config): async def to_code(config):
paren = await cg.get_variable(config[CONF_HAIER_ID]) paren = await cg.get_variable(config[CONF_HAIER_ID])
for type, _ in SENSOR_TYPES.items(): for type_ in SENSOR_TYPES:
if conf := config.get(type): if conf := config.get(type_):
sens = await sensor.new_sensor(conf) sens = await sensor.new_sensor(conf)
sensor_type = getattr(SensorTypeEnum, type.upper()) sensor_type = getattr(SensorTypeEnum, type_.upper())
cg.add(paren.set_sub_sensor(sensor_type, sens)) cg.add(paren.set_sub_sensor(sensor_type, sens))

View file

@ -39,7 +39,7 @@ TEXT_SENSOR_TYPES = {
CONFIG_SCHEMA = cv.Schema( CONFIG_SCHEMA = cv.Schema(
{ {
cv.Required(CONF_HAIER_ID): cv.use_id(HonClimate), cv.GenerateID(CONF_HAIER_ID): cv.use_id(HonClimate),
} }
).extend({cv.Optional(type): schema for type, schema in TEXT_SENSOR_TYPES.items()}) ).extend({cv.Optional(type): schema for type, schema in TEXT_SENSOR_TYPES.items()})
@ -47,8 +47,8 @@ CONFIG_SCHEMA = cv.Schema(
async def to_code(config): async def to_code(config):
paren = await cg.get_variable(config[CONF_HAIER_ID]) paren = await cg.get_variable(config[CONF_HAIER_ID])
for type, _ in TEXT_SENSOR_TYPES.items(): for type_ in TEXT_SENSOR_TYPES:
if conf := config.get(type): if conf := config.get(type_):
sens = await text_sensor.new_text_sensor(conf) sens = await text_sensor.new_text_sensor(conf)
text_sensor_type = getattr(TextSensorTypeEnum, type.upper()) text_sensor_type = getattr(TextSensorTypeEnum, type_.upper())
cg.add(paren.set_sub_text_sensor(text_sensor_type, sens)) cg.add(paren.set_sub_text_sensor(text_sensor_type, sens))

View file

@ -149,6 +149,7 @@ template<typename... Ts> class HttpRequestSendAction : public Action<Ts...> {
} }
response_body.reserve(read_index); response_body.reserve(read_index);
response_body.assign((char *) buf, read_index); response_body.assign((char *) buf, read_index);
allocator.deallocate(buf, max_length);
} }
} }

View file

@ -88,7 +88,7 @@ def validate_parameter_name(value):
raise cv.Invalid(f"Script's parameter name cannot be {CONF_ID}") raise cv.Invalid(f"Script's parameter name cannot be {CONF_ID}")
ALLOWED_PARAM_TYPE_CHARSET = set("abcdefghijklmnopqrstuvwxyz0123456789_:*&[]") ALLOWED_PARAM_TYPE_CHARSET = set("abcdefghijklmnopqrstuvwxyz0123456789_:*&[]<>")
def validate_parameter_type(value): def validate_parameter_type(value):

View file

@ -69,7 +69,7 @@ async def setup_update_core_(var, config):
await mqtt.register_mqtt_component(mqtt_, config) await mqtt.register_mqtt_component(mqtt_, config)
if web_server_id_config := config.get(CONF_WEB_SERVER_ID): if web_server_id_config := config.get(CONF_WEB_SERVER_ID):
web_server_ = cg.get_variable(web_server_id_config) web_server_ = await cg.get_variable(web_server_id_config)
web_server.add_entity_to_sorting_list(web_server_, var, config) web_server.add_entity_to_sorting_list(web_server_, var, config)

View file

@ -54,7 +54,6 @@ climate:
sensor: sensor:
- platform: haier - platform: haier
haier_id: haier_ac
outdoor_temperature: outdoor_temperature:
name: Haier outdoor temperature name: Haier outdoor temperature
humidity: humidity:
@ -80,7 +79,6 @@ sensor:
binary_sensor: binary_sensor:
- platform: haier - platform: haier
haier_id: haier_ac
compressor_status: compressor_status:
name: Haier Outdoor Compressor Status name: Haier Outdoor Compressor Status
defrost_status: defrost_status:
@ -96,7 +94,6 @@ binary_sensor:
button: button:
- platform: haier - platform: haier
haier_id: haier_ac
self_cleaning: self_cleaning:
name: Haier start self cleaning name: Haier start self cleaning
steri_cleaning: steri_cleaning:
@ -104,7 +101,6 @@ button:
text_sensor: text_sensor:
- platform: haier - platform: haier
haier_id: haier_ac
appliance_name: appliance_name:
name: Haier appliance name name: Haier appliance name
cleaning_status: cleaning_status:

View file

@ -54,7 +54,6 @@ climate:
sensor: sensor:
- platform: haier - platform: haier
haier_id: haier_ac
outdoor_temperature: outdoor_temperature:
name: Haier outdoor temperature name: Haier outdoor temperature
humidity: humidity:
@ -80,7 +79,6 @@ sensor:
binary_sensor: binary_sensor:
- platform: haier - platform: haier
haier_id: haier_ac
compressor_status: compressor_status:
name: Haier Outdoor Compressor Status name: Haier Outdoor Compressor Status
defrost_status: defrost_status:
@ -96,7 +94,6 @@ binary_sensor:
button: button:
- platform: haier - platform: haier
haier_id: haier_ac
self_cleaning: self_cleaning:
name: Haier start self cleaning name: Haier start self cleaning
steri_cleaning: steri_cleaning:
@ -104,7 +101,6 @@ button:
text_sensor: text_sensor:
- platform: haier - platform: haier
haier_id: haier_ac
appliance_name: appliance_name:
name: Haier appliance name name: Haier appliance name
cleaning_status: cleaning_status:

View file

@ -54,7 +54,6 @@ climate:
sensor: sensor:
- platform: haier - platform: haier
haier_id: haier_ac
outdoor_temperature: outdoor_temperature:
name: Haier outdoor temperature name: Haier outdoor temperature
humidity: humidity:
@ -80,7 +79,6 @@ sensor:
binary_sensor: binary_sensor:
- platform: haier - platform: haier
haier_id: haier_ac
compressor_status: compressor_status:
name: Haier Outdoor Compressor Status name: Haier Outdoor Compressor Status
defrost_status: defrost_status:
@ -96,7 +94,6 @@ binary_sensor:
button: button:
- platform: haier - platform: haier
haier_id: haier_ac
self_cleaning: self_cleaning:
name: Haier start self cleaning name: Haier start self cleaning
steri_cleaning: steri_cleaning:
@ -104,7 +101,6 @@ button:
text_sensor: text_sensor:
- platform: haier - platform: haier
haier_id: haier_ac
appliance_name: appliance_name:
name: Haier appliance name name: Haier appliance name
cleaning_status: cleaning_status:

View file

@ -54,7 +54,6 @@ climate:
sensor: sensor:
- platform: haier - platform: haier
haier_id: haier_ac
outdoor_temperature: outdoor_temperature:
name: Haier outdoor temperature name: Haier outdoor temperature
humidity: humidity:
@ -80,7 +79,6 @@ sensor:
binary_sensor: binary_sensor:
- platform: haier - platform: haier
haier_id: haier_ac
compressor_status: compressor_status:
name: Haier Outdoor Compressor Status name: Haier Outdoor Compressor Status
defrost_status: defrost_status:
@ -96,7 +94,6 @@ binary_sensor:
button: button:
- platform: haier - platform: haier
haier_id: haier_ac
self_cleaning: self_cleaning:
name: Haier start self cleaning name: Haier start self cleaning
steri_cleaning: steri_cleaning:
@ -104,7 +101,6 @@ button:
text_sensor: text_sensor:
- platform: haier - platform: haier
haier_id: haier_ac
appliance_name: appliance_name:
name: Haier appliance name name: Haier appliance name
cleaning_status: cleaning_status:

View file

@ -54,7 +54,6 @@ climate:
sensor: sensor:
- platform: haier - platform: haier
haier_id: haier_ac
outdoor_temperature: outdoor_temperature:
name: Haier outdoor temperature name: Haier outdoor temperature
humidity: humidity:
@ -80,7 +79,6 @@ sensor:
binary_sensor: binary_sensor:
- platform: haier - platform: haier
haier_id: haier_ac
compressor_status: compressor_status:
name: Haier Outdoor Compressor Status name: Haier Outdoor Compressor Status
defrost_status: defrost_status:
@ -96,7 +94,6 @@ binary_sensor:
button: button:
- platform: haier - platform: haier
haier_id: haier_ac
self_cleaning: self_cleaning:
name: Haier start self cleaning name: Haier start self cleaning
steri_cleaning: steri_cleaning:
@ -104,7 +101,6 @@ button:
text_sensor: text_sensor:
- platform: haier - platform: haier
haier_id: haier_ac
appliance_name: appliance_name:
name: Haier appliance name name: Haier appliance name
cleaning_status: cleaning_status: