mirror of
https://github.com/esphome/esphome.git
synced 2025-10-29 22:24:26 +00:00
Allow id() syntax for custom code (#621)
* Allow id() syntax for custom code * Lint
This commit is contained in:
@@ -3,7 +3,12 @@
|
||||
|
||||
class CustomSensor : public Component, public Sensor {
|
||||
public:
|
||||
void loop() override { publish_state(42.0); }
|
||||
void loop() override {
|
||||
// Test id() helper
|
||||
float value = id(my_sensor).state;
|
||||
id(my_global_string) = "Hello World";
|
||||
publish_state(42.0);
|
||||
}
|
||||
};
|
||||
|
||||
class CustomTextSensor : public Component, public TextSensor {
|
||||
|
||||
Reference in New Issue
Block a user