test: delete publishActorState function
This commit is contained in:
+3
-15
@@ -4,15 +4,15 @@
|
|||||||
#include <ArduinoJson.h>
|
#include <ArduinoJson.h>
|
||||||
#include <Hash.h>
|
#include <Hash.h>
|
||||||
|
|
||||||
// ---- Configure these ----
|
|
||||||
const char *WIFI_SSID = "seminardemo";
|
const char *WIFI_SSID = "seminardemo";
|
||||||
const char *WIFI_PASS = "seminardemo";
|
const char *WIFI_PASS = "seminardemo";
|
||||||
|
|
||||||
const char *MQTT_HOST = "192.168.1.16"; // broker address (use host running mosquitto)
|
const char *MQTT_HOST = "192.168.1.16"; // broker
|
||||||
const uint16_t MQTT_PORT = 1883;
|
const uint16_t MQTT_PORT = 1883;
|
||||||
const char *MQTT_USER = "testuser"; // from test/.env
|
const char *MQTT_USER = "testuser"; // from test/.env
|
||||||
const char *MQTT_PASS = "testpass"; // from test/.env
|
const char *MQTT_PASS = "testpass"; // from test/.env
|
||||||
\
|
|
||||||
const char *MQTT_TOPIC = "lambdaiot"; // main topic
|
const char *MQTT_TOPIC = "lambdaiot"; // main topic
|
||||||
|
|
||||||
// GPIO
|
// GPIO
|
||||||
@@ -174,17 +174,6 @@ void publishSensorReading() {
|
|||||||
mqtt.publish(MQTT_TOPIC, buf, n);
|
mqtt.publish(MQTT_TOPIC, buf, n);
|
||||||
}
|
}
|
||||||
|
|
||||||
void publishActorState(int state) {
|
|
||||||
StaticJsonDocument<256> doc;
|
|
||||||
doc["type"] = "actor_state";
|
|
||||||
doc["actor_id"] = actorId;
|
|
||||||
doc["value"] = state;
|
|
||||||
|
|
||||||
char buf[256];
|
|
||||||
size_t n = serializeJson(doc, buf, sizeof(buf));
|
|
||||||
mqtt.publish(MQTT_TOPIC, buf, n);
|
|
||||||
}
|
|
||||||
|
|
||||||
void publishDeviceCheckResponse() {
|
void publishDeviceCheckResponse() {
|
||||||
StaticJsonDocument<256> doc;
|
StaticJsonDocument<256> doc;
|
||||||
doc["type"] = "device_check_response";
|
doc["type"] = "device_check_response";
|
||||||
@@ -218,7 +207,6 @@ void handleActorCommand(JsonObject payload) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
digitalWrite(ACTOR_PIN, value ? HIGH : LOW);
|
digitalWrite(ACTOR_PIN, value ? HIGH : LOW);
|
||||||
publishActorState(value);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void handleSensorTrigger(JsonObject payload) {
|
void handleSensorTrigger(JsonObject payload) {
|
||||||
|
|||||||
Reference in New Issue
Block a user