Make garage-gate.yaml fully local
This commit is contained in:
@@ -0,0 +1,42 @@
|
||||
#pragma once
|
||||
|
||||
#include "../ratgdo.h"
|
||||
#include "../ratgdo_state.h"
|
||||
#include "esphome/components/number/number.h"
|
||||
#include "esphome/core/component.h"
|
||||
#include "esphome/core/defines.h"
|
||||
|
||||
namespace esphome::ratgdo {
|
||||
|
||||
enum NumberType {
|
||||
RATGDO_CLIENT_ID,
|
||||
RATGDO_ROLLING_CODE_COUNTER,
|
||||
RATGDO_OPENING_DURATION,
|
||||
RATGDO_CLOSING_DURATION,
|
||||
#ifdef RATGDO_USE_CLOSING_DELAY
|
||||
RATGDO_CLOSING_DELAY,
|
||||
#endif
|
||||
#ifdef RATGDO_USE_DISTANCE_SENSOR
|
||||
RATGDO_TARGET_DISTANCE_MEASUREMENT,
|
||||
#endif
|
||||
};
|
||||
|
||||
class RATGDONumber : public number::Number, public RATGDOClient, public Component {
|
||||
public:
|
||||
void dump_config() override;
|
||||
void setup() override;
|
||||
void set_number_type(NumberType number_type);
|
||||
// other esphome components that persist state in the flash have HARDWARE priority
|
||||
// ensure we get initialized before them, so that the state doesn't get invalidated
|
||||
// by components that might be added in the future
|
||||
float get_setup_priority() const override { return setup_priority::HARDWARE + 1; }
|
||||
|
||||
void update_state(float value);
|
||||
void control(float value) override;
|
||||
|
||||
protected:
|
||||
NumberType number_type_;
|
||||
ESPPreferenceObject pref_;
|
||||
};
|
||||
|
||||
} // namespace esphome::ratgdo
|
||||
Reference in New Issue
Block a user