Button device class (#2835)

This commit is contained in:
Jesse Hills
2021-11-30 16:18:21 +01:00
committed by GitHub
parent 0f47ffd908
commit b32b918936
11 changed files with 64 additions and 4 deletions
+7
View File
@@ -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