2020-08-02 01:54:26 +02:00
|
|
|
#pragma once
|
|
|
|
|
|
|
|
|
|
#include <Arduino.h>
|
2020-08-02 15:58:10 +02:00
|
|
|
|
2020-08-02 01:54:26 +02:00
|
|
|
#include "Class/LineParsing.h"
|
|
|
|
|
#include "Global.h"
|
|
|
|
|
|
|
|
|
|
class Input : public LineParsing {
|
|
|
|
|
public:
|
|
|
|
|
Input() : LineParsing(){};
|
|
|
|
|
|
2020-08-03 01:09:11 +02:00
|
|
|
void inputSetDefaultFloat() {
|
|
|
|
|
inputSetFloat(_key, _state);
|
2020-08-02 01:54:26 +02:00
|
|
|
}
|
|
|
|
|
|
2020-08-03 01:09:11 +02:00
|
|
|
void inputSetDefaultStr() {
|
|
|
|
|
inputSetStr(_key, _state);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void inputSetFloat(String key, String state) {
|
2020-08-02 01:54:26 +02:00
|
|
|
eventGen(key, "");
|
2020-08-02 15:58:10 +02:00
|
|
|
jsonWriteFloat(configLiveJson, key, state.toFloat());
|
2020-08-02 01:54:26 +02:00
|
|
|
MqttClient::publishStatus(key, state);
|
|
|
|
|
}
|
2020-08-03 01:09:11 +02:00
|
|
|
|
|
|
|
|
void inputSetStr(String key, String state) {
|
|
|
|
|
eventGen(key, "");
|
|
|
|
|
jsonWriteStr(configLiveJson, key, state);
|
|
|
|
|
MqttClient::publishStatus(key, state);
|
|
|
|
|
}
|
2020-08-02 01:54:26 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
extern Input* myInput;
|