ESPHomeMarlin2/automation.h

22 lines
517 B
C
Raw Normal View History

2025-03-03 09:46:15 +01:00
#pragma once
#include "esphome/core/automation.h"
2025-03-05 19:03:06 +01:00
#include "esphome/core/component.h"
#include "marlin2.h"
2024-12-31 08:22:30 +01:00
namespace esphome {
2025-03-05 19:03:06 +01:00
template<typename... Ts> class Marlin2WriteAction : public Action<Ts...> {
2025-03-03 09:46:15 +01:00
public:
2025-03-05 19:03:06 +01:00
explicit Marlin2WriteAction(Marlin2 *marlin2) : marlin2_(marlin2) {}
TEMPLATABLE_VALUE(std::string, value)
2025-03-03 09:46:15 +01:00
void play(Ts... x) override {
2025-03-05 19:03:06 +01:00
this->marlin2_->write("M117 Action Called!");
2025-03-03 09:46:15 +01:00
}
2025-03-05 19:03:06 +01:00
2025-03-03 09:46:15 +01:00
protected:
2025-03-05 17:42:01 +01:00
Marlin2 *marlin2_;
2025-03-03 09:46:15 +01:00
};
2024-12-31 08:22:30 +01:00
} // namespace esphome