ESPHome 2026.11.0-dev
Loading...
Searching...
No Matches
bq25186_switch.h
Go to the documentation of this file.
1#pragma once
2
4#ifdef USE_BQ25186_PG_GPO
5
6#include "bq25186.h"
8
9namespace esphome::bq25186 {
10
11class BQ25186PgGpoSwitch final : public switch_::Switch, public Parented<BQ25186Component> {
12 protected:
13 void write_state(bool state) override {
14 if (this->parent_->write_pg_gpo_level(state))
15 this->publish_state(state);
16 }
17};
18
19} // namespace esphome::bq25186
20
21#endif // USE_BQ25186_PG_GPO
Helper class to easily give an object a parent of type T.
Definition helpers.h:1997
void write_state(bool state) override
Base class for all switches.
Definition switch.h:38
bool state
The current reported state of the binary sensor.
Definition switch.h:55
void publish_state(bool state)
Publish a state to the front-end from the back-end.
Definition switch.cpp:56