mirror of
https://github.com/HASwitchPlate/openHASP.git
synced 2025-07-28 05:36:37 +00:00
Update custom templates
This commit is contained in:
parent
b250e1044d
commit
163bc8480f
@ -14,6 +14,7 @@
|
|||||||
|
|
||||||
#if defined(HASP_USE_CUSTOM) && false // <-- set this to true in your code
|
#if defined(HASP_USE_CUSTOM) && false // <-- set this to true in your code
|
||||||
|
|
||||||
|
#include "hasp_debug.h"
|
||||||
#include "custom/my_custom.h"
|
#include "custom/my_custom.h"
|
||||||
|
|
||||||
uint16_t fanspeed = 0; // rotation off by default (the time between angle turns in ms)
|
uint16_t fanspeed = 0; // rotation off by default (the time between angle turns in ms)
|
||||||
@ -73,7 +74,7 @@ void custom_get_sensors(JsonDocument& doc)
|
|||||||
void custom_topic_payload(const char* topic, const char* payload, uint8_t source)
|
void custom_topic_payload(const char* topic, const char* payload, uint8_t source)
|
||||||
{
|
{
|
||||||
bool update = strlen(payload) > 0;
|
bool update = strlen(payload) > 0;
|
||||||
Log.notice(TAG_CUSTOM, "Handling custom message: %s => %s", topic, payload);
|
LOG_INFO(TAG_CUSTOM, "Handling custom message: %s => %s", topic, payload);
|
||||||
|
|
||||||
if(update) {
|
if(update) {
|
||||||
if(!strcmp(topic, "fanspeed")) {
|
if(!strcmp(topic, "fanspeed")) {
|
||||||
@ -95,7 +96,7 @@ void custom_topic_payload(const char* topic, const char* payload, uint8_t source
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Log.verbose(TAG_CUSTOM, "Handled custom message: %s => %s", topic, payload);
|
// LOG_VERBOSE(TAG_CUSTOM, "Handled custom message: %s => %s", topic, payload);
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif // HASP_USE_CUSTOM
|
#endif // HASP_USE_CUSTOM
|
||||||
|
@ -8,6 +8,7 @@
|
|||||||
|
|
||||||
#if defined(HASP_USE_CUSTOM) && false // <-- set this to true in your code
|
#if defined(HASP_USE_CUSTOM) && false // <-- set this to true in your code
|
||||||
|
|
||||||
|
#include "hasp_debug.h"
|
||||||
#include "custom/my_custom.h"
|
#include "custom/my_custom.h"
|
||||||
|
|
||||||
void custom_setup()
|
void custom_setup()
|
||||||
@ -28,7 +29,7 @@ void custom_every_second()
|
|||||||
|
|
||||||
void custom_every_5seconds()
|
void custom_every_5seconds()
|
||||||
{
|
{
|
||||||
Log.verbose(TAG_CUSTOM, "5 seconds have passsed...");
|
LOG_VERBOSE(TAG_CUSTOM, "5 seconds have passsed...");
|
||||||
dispatch_state_subtopic("my_sensor","{\"test\":123}");
|
dispatch_state_subtopic("my_sensor","{\"test\":123}");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user