We now accept and report state changes via JSON. Also added homeassistant MQTT autodiscovery.
This commit is contained in:
@ -7,4 +7,5 @@
|
||||
static PubSubClient mqtt(wifi);
|
||||
|
||||
void mqtt_setup();
|
||||
void mqtt_loop();
|
||||
void mqtt_loop();
|
||||
void mqtt_publish_current_state(String state);
|
26
include/state.h
Normal file
26
include/state.h
Normal file
@ -0,0 +1,26 @@
|
||||
#pragma once
|
||||
#include <Arduino.h>
|
||||
#include <ArduinoJson.h>
|
||||
#include "prototypes.h"
|
||||
|
||||
class State {
|
||||
AnimationMode _mode = AM_NONE;
|
||||
uint16_t _duration = 0;
|
||||
int16_t _brightness = -1;
|
||||
uint8_t _speedup = 0;
|
||||
CRGB _color = CRGB::Black;
|
||||
|
||||
public:
|
||||
void parse_json(char* str);
|
||||
void set(String key, String value);
|
||||
void commit();
|
||||
static void publish_current_state();
|
||||
|
||||
void parse_state(String state);
|
||||
void parse_mode(String mode);
|
||||
void set_mode(AnimationMode mode);
|
||||
void set_duration(uint16_t duration);
|
||||
void set_brightness(uint8_t brightness);
|
||||
void set_color(JsonObject rgb);
|
||||
void set_speedup(uint8_t speedup);
|
||||
};
|
Reference in New Issue
Block a user