hi all,
is there a way to integrate remote toggle buttons into typicals ?
i have 2 nodes that handle the power switching of the lights and all the wall switches publish the toggle topics for the lights to change over.
the "transmiting node " , running on wemos r1
if (DigIn(D6,Souliss_T1n_ToggleCmd,slot_canal_1))
pblsh(topic_canal_1_toggle);
if (sbscrb(topic_canal_1_on))
leds[D6] = (CRGB(200 2, 0));
if (sbscrb(topic_canal_1_off))
leds[D6] = (CRGB(2,200,0));
and the receiving node , runing on devkit esp32"
EXECUTEFAST() {
UPDATEFAST();
FAST_50ms() {
// ***lustra_dorm_mare1-----canal_1-----conexiune nr21 ----PIN:CONEXIUNE ELECTRICA1****//
if (sbscrb(topic_canal_1_toggle))
(memory_map[MaCaco_IN_s +slot_canal_1] = Souliss_T1n_ToggleCmd);
Logic_SimpleLight(slot_canal_1);
DigOut(21, Souliss_T1n_Coil,slot_canal_1);
{
if (memory_map[MaCaco_IN_s + slot_canal_1] == Souliss_T1n_Trigged )
if(memory_map[MaCaco_OUT_s +slot_canal_1] == Souliss_T1n_OnCoil)
pblsh(topic_canal_1_on);
else if(memory_map[MaCaco_OUT_s +slot_canal_1] == Souliss_T1n_OffCoil)
pblsh(topic_canal_1_off);
memory_map[MaCaco_IN_s + slot_canal_1] = Souliss_T1n_RstCmd;
}
in T1n .cpp , lights can be switched on or off using either a wall switch or a toggle button . is there any way to add the _toggle , _on, _off shared topics?
or can you guide me where to start modifying the T1n.cpp
something like:
U8 Souliss_Logic_T11_topic(U8 *memory_map,U8 slot,U8 *trigger,topic);
.
.
.
.
if (memory_map[MaCaco_IN_s + slot] == Souliss_T1n_ToggleCmd)
{
if(memory_map[MaCaco_OUT_s + slot] == Souliss_T1n_OnCoil)
memory_map[MaCaco_OUT_s + slot] = Souliss_T1n_OffCoil; // Switch OFF the output
else if(memory_map[MaCaco_OUT_s + slot] == Souliss_T1n_OffCoil)
memory_map[MaCaco_OUT_s + slot] = Souliss_T1n_OnCoil; // Switch ON the output
i_trigger = Souliss_TRIGGED;
// Reset
//memory_map[MaCaco_IN_s + slot] = Souliss_T1n_RstCmd;
memory_map[MaCaco_IN_s + slot] = Souliss_T1n_Trigged
};
else if subscrb (topic.....toggle
{
if(memory_map[MaCaco_OUT_s + slot] == Souliss_T1n_OnCoil)
memory_map[MaCaco_OUT_s + slot] = Souliss_T1n_OffCoil; // Switch OFF the output
pblsh (topic off_feedback)
else if(memory_map[MaCaco_OUT_s + slot] == Souliss_T1n_OffCoil)
memory_map[MaCaco_OUT_s + slot] = Souliss_T1n_OnCoil; // Switch ON the output
pblsh(topic off_feedback )
i_trigger = Souliss_TRIGGED;
// Reset
//memory_map[MaCaco_IN_s + slot] = Souliss_T1n_RstCmd;
memory_map[MaCaco_IN_s + slot] = Souliss_T1n_Trigged ;
the main advantage of going in this direction is that the system can be more modular, as control and action does not have to be on the same board. Further more , publish /subscribe system can be developed to the whole system,
lets say to close the curtains at night fall, or opening the gate when the car is close by.
adrian