subscribe_state.h 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. #pragma once
  2. #include "esphome/core/component.h"
  3. #include "esphome/core/controller.h"
  4. #include "esphome/core/defines.h"
  5. #include "util.h"
  6. namespace esphome {
  7. namespace api {
  8. class APIConnection;
  9. class InitialStateIterator : public ComponentIterator {
  10. public:
  11. InitialStateIterator(APIServer *server, APIConnection *client);
  12. #ifdef USE_BINARY_SENSOR
  13. bool on_binary_sensor(binary_sensor::BinarySensor *binary_sensor) override;
  14. #endif
  15. #ifdef USE_COVER
  16. bool on_cover(cover::Cover *cover) override;
  17. #endif
  18. #ifdef USE_FAN
  19. bool on_fan(fan::FanState *fan) override;
  20. #endif
  21. #ifdef USE_LIGHT
  22. bool on_light(light::LightState *light) override;
  23. #endif
  24. #ifdef USE_SENSOR
  25. bool on_sensor(sensor::Sensor *sensor) override;
  26. #endif
  27. #ifdef USE_SWITCH
  28. bool on_switch(switch_::Switch *a_switch) override;
  29. #endif
  30. #ifdef USE_TEXT_SENSOR
  31. bool on_text_sensor(text_sensor::TextSensor *text_sensor) override;
  32. #endif
  33. #ifdef USE_CLIMATE
  34. bool on_climate(climate::Climate *climate) override;
  35. #endif
  36. protected:
  37. APIConnection *client_;
  38. };
  39. } // namespace api
  40. } // namespace esphome
  41. #include "api_server.h"