mirror of
https://github.com/HASwitchPlate/openHASP.git
synced 2025-07-26 04:36:38 +00:00
Add custom_state_subtopic #611
This commit is contained in:
parent
a9d514b04c
commit
1f471ad308
@ -98,4 +98,8 @@ 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);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void custom_state_subtopic(const char* subtopic, const char* payload){
|
||||||
|
// Not used
|
||||||
|
}
|
||||||
|
|
||||||
#endif // HASP_USE_CUSTOM
|
#endif // HASP_USE_CUSTOM
|
||||||
|
@ -53,4 +53,9 @@ void custom_topic_payload(const char* topic, const char* payload, uint8_t source
|
|||||||
// Not used
|
// Not used
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void custom_state_subtopic(const char* subtopic, const char* payload){
|
||||||
|
// Not used
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
#endif // HASP_USE_CUSTOM
|
#endif // HASP_USE_CUSTOM
|
@ -32,6 +32,11 @@ void custom_get_sensors(JsonDocument& doc);
|
|||||||
/* Receive custom topic & payload messages */
|
/* Receive custom topic & payload messages */
|
||||||
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);
|
||||||
|
|
||||||
|
/* Get notified when a state message is sent out */
|
||||||
|
/* Can be used to send state changes through other means then MQTT, e.g. Serial2 */
|
||||||
|
/* https://github.com/HASwitchPlate/openHASP/issues/611 */
|
||||||
|
void custom_state_subtopic(const char* subtopic, const char* payload);
|
||||||
|
|
||||||
#endif // HASP_USE_CUSTOM
|
#endif // HASP_USE_CUSTOM
|
||||||
|
|
||||||
#endif // HASP_CUSTOM_H
|
#endif // HASP_CUSTOM_H
|
||||||
|
@ -43,7 +43,7 @@ uint16_t dispatchSecondsToNextTeleperiod = 0;
|
|||||||
uint16_t dispatchSecondsToNextSensordata = 0;
|
uint16_t dispatchSecondsToNextSensordata = 0;
|
||||||
uint16_t dispatchSecondsToNextDiscovery = 0;
|
uint16_t dispatchSecondsToNextDiscovery = 0;
|
||||||
uint8_t nCommands = 0;
|
uint8_t nCommands = 0;
|
||||||
haspCommand_t commands[28];
|
haspCommand_t commands[29];
|
||||||
|
|
||||||
moodlight_t moodlight = {.brightness = 255};
|
moodlight_t moodlight = {.brightness = 255};
|
||||||
uint8_t saved_jsonl_page = 0;
|
uint8_t saved_jsonl_page = 0;
|
||||||
@ -74,6 +74,10 @@ void dispatch_state_subtopic(const char* subtopic, const char* payload)
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#if HASP_USE_CUSTOM > 0
|
||||||
|
custom_state_subtopic(subtopic, payload);
|
||||||
|
#endif
|
||||||
|
|
||||||
#if HASP_USE_TASMOTA_CLIENT > 0
|
#if HASP_USE_TASMOTA_CLIENT > 0
|
||||||
slave_send_state(subtopic, payload);
|
slave_send_state(subtopic, payload);
|
||||||
#endif
|
#endif
|
||||||
@ -864,6 +868,11 @@ void dispatch_run_script(const char*, const char* payload, uint8_t source)
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void dispatch_dir(const char*, const char* payload, uint8_t source)
|
||||||
|
{
|
||||||
|
filesystem_list_path(payload);
|
||||||
|
}
|
||||||
|
|
||||||
#if HASP_TARGET_PC
|
#if HASP_TARGET_PC
|
||||||
static void shell_command_thread(char* cmdline)
|
static void shell_command_thread(char* cmdline)
|
||||||
{
|
{
|
||||||
@ -1592,6 +1601,7 @@ void dispatchSetup()
|
|||||||
dispatch_add_command(PSTR("sensors"), dispatch_send_sensordata);
|
dispatch_add_command(PSTR("sensors"), dispatch_send_sensordata);
|
||||||
dispatch_add_command(PSTR("theme"), dispatch_theme);
|
dispatch_add_command(PSTR("theme"), dispatch_theme);
|
||||||
dispatch_add_command(PSTR("run"), dispatch_run_script);
|
dispatch_add_command(PSTR("run"), dispatch_run_script);
|
||||||
|
dispatch_add_command(PSTR("dir"), dispatch_dir);
|
||||||
#if HASP_TARGET_PC
|
#if HASP_TARGET_PC
|
||||||
dispatch_add_command(PSTR("shell"), dispatch_shell_execute);
|
dispatch_add_command(PSTR("shell"), dispatch_shell_execute);
|
||||||
#endif
|
#endif
|
||||||
|
Loading…
x
Reference in New Issue
Block a user