2020-07-29 21:38:39 +02:00
|
|
|
#pragma once
|
|
|
|
|
|
|
|
|
|
#include <Arduino.h>
|
|
|
|
|
|
|
|
|
|
#include "Class/Item.h"
|
|
|
|
|
#include "Global.h"
|
|
|
|
|
|
2020-07-29 21:53:32 +02:00
|
|
|
class Button : public Item {
|
2020-07-29 21:38:39 +02:00
|
|
|
public:
|
2020-07-30 11:27:12 +02:00
|
|
|
Button() : Item()
|
2020-07-29 21:38:39 +02:00
|
|
|
|
|
|
|
|
void pinModeSet(int pinf) {
|
|
|
|
|
if (pin != "") {
|
|
|
|
|
pinMode(pinf, OUTPUT);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void pinStateSet(int pinf, int statef) {
|
|
|
|
|
if (state != "") {
|
|
|
|
|
digitalWrite(pinf, statef);
|
|
|
|
|
jsonWriteInt(configLiveJson, key, statef);
|
|
|
|
|
MqttClient::publishStatus(key, String(statef));
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void pinStateSetInv(int pinf, int statef) {
|
|
|
|
|
if (inv != "" && state != "") {
|
|
|
|
|
digitalWrite(pinf, !statef);
|
|
|
|
|
jsonWriteInt(configLiveJson, key, !statef);
|
|
|
|
|
MqttClient::publishStatus(key, String(!statef));
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
|
2020-07-30 11:27:12 +02:00
|
|
|
//extern Button* myButton;
|