mirror of
https://github.com/esphome/esphome.git
synced 2026-03-04 03:38:20 -07:00
Add device class support to Switch (#3012)
Co-authored-by: Oxan van Leeuwen <oxan@oxanvanleeuwen.nl>
This commit is contained in:
@@ -46,5 +46,12 @@ void Switch::set_inverted(bool inverted) { this->inverted_ = inverted; }
|
||||
uint32_t Switch::hash_base() { return 3129890955UL; }
|
||||
bool Switch::is_inverted() const { return this->inverted_; }
|
||||
|
||||
std::string Switch::get_device_class() {
|
||||
if (this->device_class_.has_value())
|
||||
return *this->device_class_;
|
||||
return "";
|
||||
}
|
||||
void Switch::set_device_class(const std::string &device_class) { this->device_class_ = device_class; }
|
||||
|
||||
} // namespace switch_
|
||||
} // namespace esphome
|
||||
|
||||
Reference in New Issue
Block a user