ESPHome
2026.5.1
Loading...
Searching...
No Matches
esphome
components
homeassistant
sensor
homeassistant_sensor.h
Go to the documentation of this file.
1
#pragma once
2
3
#include "
esphome/core/component.h
"
4
#include "
esphome/components/sensor/sensor.h
"
5
6
namespace
esphome::homeassistant
{
7
8
class
HomeassistantSensor
:
public
sensor::Sensor
,
public
Component
{
9
public
:
10
void
set_entity_id
(
const
char
*entity_id) { this->
entity_id_
= entity_id; }
11
void
set_attribute
(
const
char
*attribute) { this->
attribute_
= attribute; }
12
void
setup
()
override
;
13
void
dump_config
()
override
;
14
float
get_setup_priority
()
const override
;
15
16
protected
:
17
const
char
*
entity_id_
{
nullptr
};
18
const
char
*
attribute_
{
nullptr
};
19
};
20
21
}
// namespace esphome::homeassistant
esphome::Component
Definition
component.h:145
esphome::homeassistant::HomeassistantSensor
Definition
homeassistant_sensor.h:8
esphome::homeassistant::HomeassistantSensor::set_attribute
void set_attribute(const char *attribute)
Definition
homeassistant_sensor.h:11
esphome::homeassistant::HomeassistantSensor::set_entity_id
void set_entity_id(const char *entity_id)
Definition
homeassistant_sensor.h:10
esphome::homeassistant::HomeassistantSensor::setup
void setup() override
Definition
homeassistant_sensor.cpp:10
esphome::homeassistant::HomeassistantSensor::dump_config
void dump_config() override
Definition
homeassistant_sensor.cpp:27
esphome::homeassistant::HomeassistantSensor::entity_id_
const char * entity_id_
Definition
homeassistant_sensor.h:17
esphome::homeassistant::HomeassistantSensor::attribute_
const char * attribute_
Definition
homeassistant_sensor.h:18
esphome::homeassistant::HomeassistantSensor::get_setup_priority
float get_setup_priority() const override
Definition
homeassistant_sensor.cpp:34
esphome::sensor::Sensor
Base-class for all sensors.
Definition
sensor.h:47
component.h
esphome::homeassistant
Definition
homeassistant_binary_sensor.cpp:6
sensor.h
Generated by
1.12.0