mirror of
https://github.com/esphome/esphome.git
synced 2024-12-18 03:24:54 +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,13 +475,12 @@ async def to_code(config):
|
||||||
|
|
||||||
async def new_sensor(c, args, setter):
|
async def new_sensor(c, args, setter):
|
||||||
s = None
|
s = None
|
||||||
match args[1]:
|
if args[1] == "sensor":
|
||||||
case "sensor":
|
s = await sensor.new_sensor(c)
|
||||||
s = await sensor.new_sensor(c)
|
elif args[1] == "binary_sensor":
|
||||||
case "binary_sensor":
|
s = await binary_sensor.new_binary_sensor(c)
|
||||||
s = await binary_sensor.new_binary_sensor(c)
|
elif args[1] == "text_sensor":
|
||||||
case "text_sensor":
|
s = await text_sensor.new_text_sensor(c)
|
||||||
s = await text_sensor.new_text_sensor(c)
|
|
||||||
cg.add(getattr(var, setter + "_" + args[1])(s))
|
cg.add(getattr(var, setter + "_" + args[1])(s))
|
||||||
|
|
||||||
await for_each_conf(config, SENSORS, new_sensor)
|
await for_each_conf(config, SENSORS, new_sensor)
|
||||||
|
|
|
@ -1,5 +1,8 @@
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
|
namespace esphome {
|
||||||
|
namespace si4713 {
|
||||||
|
|
||||||
#ifndef SUB_TEXT
|
#ifndef SUB_TEXT
|
||||||
#define SUB_TEXT(name) \
|
#define SUB_TEXT(name) \
|
||||||
protected: \
|
protected: \
|
||||||
|
@ -50,3 +53,5 @@
|
||||||
void publish_##name##_text_sensor() { this->publish(this->name##_text_sensor_, this->get_##name##_text_sensor()); } \
|
void publish_##name##_text_sensor() { this->publish(this->name##_text_sensor_, this->get_##name##_text_sensor()); } \
|
||||||
std::string get_##name##_text_sensor();
|
std::string get_##name##_text_sensor();
|
||||||
|
|
||||||
|
} // namespace si4713
|
||||||
|
} // namespace esphome
|
||||||
|
|
Loading…
Reference in a new issue