How does the S_SCENE_CONTROLLER work?



  • Im building a scene controller with touch modules as buttons.

    Right now i have 2 buttons that is presented as S_SCENE_CONTROLLER

      present(CHILD_ID_3, S_SCENE_CONTROLLER); // Present button
      present(CHILD_ID_4, S_SCENE_CONTROLLER); // Present button 
    

    I want to make each button activate a specified scene.
    At first i tried to use this:

    MyMessage msg1(CHILD_ID_3,V_SCENE_ON); // Added message for buttons
    MyMessage msg2(CHILD_ID_4,V_SCENE_ON); // Added message for buttons
    

    I then added the node to domoticz and i got 3 devices (the node as scenecontroller and 2 devices that represent each button), i added each button as scene activators for different scenes.

    The problem is that i can only activate a scene once, so i edited my sketch to use these messages:

    MyMessage msg1(CHILD_ID_3,V_SCENE_ON); // Added message for buttons
    MyMessage msg2(CHILD_ID_4,V_SCENE_OFF); // Added message for buttons
    

    Now i can activate the scene, but i need to use my second button to deactivate it before i can activate it again.

    In domoticz its no need to deactivate scenes since turning a scene off does nothing (groups can be tuned on and off).

    How do i add a V_SCENE_OFF to the same button that sends V_SCENE_ON?


  • Admin

    What payload do you send in the message? Each scene controller can have multiple buttons. Example:

    MyMessage msg1(CHILD_ID_3,V_SCENE_ON); 
    MyMessage msg2(CHILD_ID_3,V_SCENE_OFF); 
    send(msg1.set(1));  // Turn on scene button 1
    send(msg2.set(1));  // Turn off scene button 1
    
    send(msg1.set(2));  // Turn on scene button 2
    send(msg2.set(2));  // Turn off scene button 2
    
    

Log in to reply
 

Suggested Topics

1
Online

11.2k
Users

11.1k
Topics

112.5k
Posts