1
0
mirror of https://github.com/esphome/esphome.git synced 2025-11-20 08:46:01 +00:00

Add valve component (#6447)

Co-authored-by: Jesse Hills <3060199+jesserockz@users.noreply.github.com>
This commit is contained in:
Keith Burzinski
2024-04-22 23:47:03 -05:00
committed by GitHub
parent fa8d09aca9
commit eb89d99999
37 changed files with 1765 additions and 0 deletions

View File

@@ -0,0 +1,41 @@
#pragma once
#include "esphome/core/defines.h"
#include "mqtt_component.h"
#ifdef USE_MQTT
#ifdef USE_VALVE
#include "esphome/components/valve/valve.h"
namespace esphome {
namespace mqtt {
class MQTTValveComponent : public mqtt::MQTTComponent {
public:
explicit MQTTValveComponent(valve::Valve *valve);
void setup() override;
void send_discovery(JsonObject root, mqtt::SendDiscoveryConfig &config) override;
MQTT_COMPONENT_CUSTOM_TOPIC(position, command)
MQTT_COMPONENT_CUSTOM_TOPIC(position, state)
bool send_initial_state() override;
bool publish_state();
void dump_config() override;
protected:
std::string component_type() const override;
const EntityBase *get_entity() const override;
valve::Valve *valve_;
};
} // namespace mqtt
} // namespace esphome
#endif
#endif // USE_MQTT