mirror of
https://github.com/esphome/esphome.git
synced 2026-09-20 03:28:41 +00:00
Button device class (#2835)
This commit is contained in:
@@ -17,5 +17,12 @@ void Button::press() {
|
||||
void Button::add_on_press_callback(std::function<void()> &&callback) { this->press_callback_.add(std::move(callback)); }
|
||||
uint32_t Button::hash_base() { return 1495763804UL; }
|
||||
|
||||
void Button::set_device_class(const std::string &device_class) { this->device_class_ = device_class; }
|
||||
std::string Button::get_device_class() {
|
||||
if (this->device_class_.has_value())
|
||||
return *this->device_class_;
|
||||
return "";
|
||||
}
|
||||
|
||||
} // namespace button
|
||||
} // namespace esphome
|
||||
|
||||
Reference in New Issue
Block a user