
#pragma once

#include "esphome/core/automation.h"
#include "esphome/core/component.h"
#include "ratgdo.h"

namespace esphome::ratgdo {

class SyncFailed : public Trigger<> {
public:
    explicit SyncFailed(RATGDOComponent* parent)
    {
        parent->subscribe_sync_failed([this](optional<bool> state) {
            if (state.value_or(false))
                this->trigger();
        });
    }
};

} // namespace esphome::ratgdo
