looks like pythons match isn't recognized yet

This commit is contained in:
Gábor Poczkodi 2024-10-19 21:58:52 +02:00
parent ac257a6a55
commit c1f968c9dc
2 changed files with 11 additions and 7 deletions

View file

@ -475,12 +475,11 @@ async def to_code(config):
async def new_sensor(c, args, setter):
s = None
match args[1]:
case "sensor":
if args[1] == "sensor":
s = await sensor.new_sensor(c)
case "binary_sensor":
elif args[1] == "binary_sensor":
s = await binary_sensor.new_binary_sensor(c)
case "text_sensor":
elif args[1] == "text_sensor":
s = await text_sensor.new_text_sensor(c)
cg.add(getattr(var, setter + "_" + args[1])(s))

View file

@ -1,5 +1,8 @@
#pragma once
namespace esphome {
namespace si4713 {
#ifndef SUB_TEXT
#define SUB_TEXT(name) \
protected: \
@ -50,3 +53,5 @@
void publish_##name##_text_sensor() { this->publish(this->name##_text_sensor_, this->get_##name##_text_sensor()); } \
std::string get_##name##_text_sensor();
} // namespace si4713
} // namespace esphome