Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ enum AlarmControlPanelFeature : uint8_t {

class AlarmControlPanel : public EntityBase {
public:
AlarmControlPanel() : EntityBase(EntityType::ALARM_CONTROL_PANEL) {}
/** Make a AlarmControlPanelCall
*
*/
Expand Down
1 change: 1 addition & 0 deletions esphome/components/button/button.h
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ void log_button(const char *tag, const char *prefix, const char *type, Button *o
*/
class Button : public EntityBase, public EntityBase_DeviceClass {
public:
Button() : EntityBase(EntityType::BUTTON) {}
/** Press this button. This is called by the front-end.
*
* For implementing buttons, please override press_action.
Expand Down
2 changes: 1 addition & 1 deletion esphome/components/climate/climate.h
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,7 @@ struct ClimateDeviceRestoreState {
*/
class Climate : public EntityBase {
public:
Climate() {}
Climate() : EntityBase(EntityType::CLIMATE) {}

/// The active mode of the climate device.
ClimateMode mode{CLIMATE_MODE_OFF};
Expand Down
2 changes: 1 addition & 1 deletion esphome/components/cover/cover.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ const char *cover_operation_to_str(CoverOperation op) {
}
}

Cover::Cover() : position{COVER_OPEN} {}
Cover::Cover() : EntityBase(EntityType::COVER), position{COVER_OPEN} {}

CoverCall::CoverCall(Cover *parent) : parent_(parent) {}
CoverCall &CoverCall::set_command(const char *command) {
Expand Down
1 change: 1 addition & 0 deletions esphome/components/datetime/date_entity.h
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ struct DateEntityRestoreState {

class DateEntity : public DateTimeBase {
protected:
DateEntity() : DateTimeBase(EntityType::DATETIME_DATE) {}
uint16_t year_;
uint8_t month_;
uint8_t day_;
Comment on lines +38 to 41
Expand Down
1 change: 1 addition & 0 deletions esphome/components/datetime/datetime_base.h
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ namespace datetime {

class DateTimeBase : public EntityBase {
public:
DateTimeBase(EntityType type) : EntityBase(type) {}
virtual ESPTime state_as_esptime() const = 0;

void add_on_state_callback(std::function<void()> &&callback) { this->state_callback_.add(std::move(callback)); }
Expand Down
1 change: 1 addition & 0 deletions esphome/components/datetime/datetime_entity.h
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ class DateTimeEntity : public DateTimeBase {
uint8_t second_;

public:
DateTimeEntity() : DateTimeBase(EntityType::DATETIME_DATETIME) {}
void publish_state();
DateTimeCall make_call();

Expand Down
1 change: 1 addition & 0 deletions esphome/components/datetime/time_entity.h
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ class TimeEntity : public DateTimeBase {
uint8_t second_;

public:
TimeEntity() : DateTimeBase(EntityType::DATETIME_TIME) {}
void publish_state();
TimeCall make_call();

Expand Down
1 change: 1 addition & 0 deletions esphome/components/event/event.h
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ namespace event {

class Event : public EntityBase, public EntityBase_DeviceClass {
public:
Event() : EntityBase(EntityType::EVENT) {}
const std::string *last_event_type;
Comment on lines +26 to 27

void trigger(const std::string &event_type);
Expand Down
1 change: 1 addition & 0 deletions esphome/components/fan/fan.h
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,7 @@ struct FanRestoreState {

class Fan : public EntityBase {
public:
Fan() : EntityBase(EntityType::FAN) {}
/// The current on/off state of the fan.
bool state{false};
/// The current oscillation state of the fan.
Expand Down
2 changes: 1 addition & 1 deletion esphome/components/light/light_state.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ namespace light {

static const char *const TAG = "light";

LightState::LightState(LightOutput *output) : output_(output) {}
LightState::LightState(LightOutput *output) : EntityBase(EntityType::LIGHT), output_(output) {}

LightTraits LightState::get_traits() { return this->output_->get_traits(); }
LightCall LightState::turn_on() { return this->make_call().set_state(true); }
Expand Down
2 changes: 1 addition & 1 deletion esphome/components/lock/lock.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ const char *lock_state_to_string(LockState state) {
}
}

Lock::Lock() : state(LOCK_STATE_NONE) {}
Lock::Lock() : EntityBase(EntityType::LOCK), state(LOCK_STATE_NONE) {}
LockCall Lock::make_call() { return LockCall(this); }

void Lock::lock() {
Expand Down
1 change: 1 addition & 0 deletions esphome/components/media_player/media_player.h
Original file line number Diff line number Diff line change
Expand Up @@ -142,6 +142,7 @@ class MediaPlayer : public EntityBase {
MediaPlayerState state{MEDIA_PLAYER_STATE_NONE};
float volume{1.0f};

MediaPlayer() : EntityBase(EntityType::MEDIA_PLAYER) {}
MediaPlayerCall make_call() { return MediaPlayerCall(this); }

void publish_state();
Expand Down
1 change: 1 addition & 0 deletions esphome/components/number/number.h
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ class Number;
*/
class Number : public EntityBase {
public:
Number() : EntityBase(EntityType::NUMBER) {}
float state;
Comment on lines +32 to 33

void publish_state(float state);
Expand Down
1 change: 1 addition & 0 deletions esphome/components/select/select.h
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ class Select : public EntityBase {
std::string state;
SelectTraits traits;

Select() : EntityBase(EntityType::SELECT) {}
void publish_state(const std::string &state);

/// Instantiate a SelectCall object to modify this select component's state.
Expand Down
1 change: 1 addition & 0 deletions esphome/components/text/text.h
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ class Text : public EntityBase {
std::string state;
TextTraits traits;

Text() : EntityBase(EntityType::TEXT) {}
void publish_state(const std::string &state);

/// Instantiate a TextCall object to modify this text component's state.
Expand Down
2 changes: 1 addition & 1 deletion esphome/components/text_sensor/text_sensor.h
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ void log_text_sensor(const char *tag, const char *prefix, const char *type, Text

class TextSensor : public EntityBase, public EntityBase_DeviceClass {
public:
TextSensor() = default;
TextSensor() : EntityBase(EntityType::TEXT_SENSOR) {}

/// Getter-syntax for .state.
std::string get_state() const;
Expand Down
1 change: 1 addition & 0 deletions esphome/components/update/update_entity.h
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ enum UpdateState : uint8_t {

class UpdateEntity : public EntityBase, public EntityBase_DeviceClass {
public:
UpdateEntity() : EntityBase(EntityType::UPDATE) {}
void publish_state();
Comment on lines +32 to 33

void perform() { this->perform(false); }
Expand Down
2 changes: 1 addition & 1 deletion esphome/components/valve/valve.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ const char *valve_operation_to_str(ValveOperation op) {
}
}

Valve::Valve() : position{VALVE_OPEN} {}
Valve::Valve() : EntityBase(EntityType::VALVE), position{VALVE_OPEN} {}

ValveCall::ValveCall(Valve *parent) : parent_(parent) {}
ValveCall &ValveCall::set_command(const char *command) {
Expand Down
Loading