mirror of
https://github.com/esphome/esphome.git
synced 2024-11-27 17:27:59 +01:00
looks like pythons match isn't recognized yet
This commit is contained in:
parent
ac257a6a55
commit
c1f968c9dc
2 changed files with 11 additions and 7 deletions
|
@ -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))
|
||||
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in a new issue