Add device class support to Switch (#3012)
Co-authored-by: Oxan van Leeuwen <oxan@oxanvanleeuwen.nl>
This commit is contained in:
1 parent
21803607e7
commit
e7864a28a1
9 files changed
+49
-1
No files matched your search
@@ -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