Navigation

    • Register
    • Login
    • Search
    • OpenHardware.io
    • Categories
    • Recent
    • Tags
    • Popular
    1. Home
    2. boum
    • Profile
    • Following
    • Followers
    • Topics
    • Posts
    • Best
    • Groups

    boum

    @boum

    7
    Reputation
    8
    Posts
    4
    Profile views
    0
    Followers
    1
    Following
    Joined Last Online

    boum Follow

    Best posts made by boum

    • RE: Help coding: adding functionality relying on MySensors-func/library (saveState/loadState) (c++)

      If you cannot include the whole mysensors header, you maybe can just forward declare the function. (basically, just copy the line from the mysensors.h in your mysEeprom.cpp file.

      /*extern*/ void saveState(uint8_t pos, uint8_t value);
      // extern probably not needed, that's real old C, but you I have had 
      // surprises with the arduino compiler… You might need to add it.
      

      What's the issue with namespaces or classes?

      posted in Troubleshooting
      boum
      boum
    • RE: getting data from sensor to sensor

      Just an opinion about this issue. If you don't want to modify your sensor code and keep it "generic", you should move the logic and communication to the controller. Domoticz (or any other controller) already receives the data. It can conditionally send it to the LCD node.
      Having the code on the gateway or on nodes makes sense if you want it to work when the controller/gateway are out of reach.

      posted in Domoticz
      boum
      boum
    • RE: gw.sendVariable - library question

      You should post the code you're trying to compile. But it looks like it is using an older version of MySensors. The object model with Sensor gw is deprecated now.
      To send values to the gateway, you should use MyMessage messageName(CHILD_ID, V_type_of_message);

      posted in Development
      boum
      boum
    • RE: AnalogRead problem

      @MasMat
      The integer division might be the cause. Please try to force conversion to floating point:

        float readingSau = (1023.f / adcTmm)  - 1.f;
      
      posted in Troubleshooting
      boum
      boum
    • RE: Trying to automate in Domoticz

      First, make sure your switch is really named 'switch', the scripts are case sensitive, so neither 'Switch' nor 'SWITCH' will work. Also, verify you don't have a trailing space in the name ('switch ').
      To check your script is run when the device is changed, add a domoticz.log first line in the execute function.
      Hope this helps.

      posted in Domoticz
      boum
      boum
    • RE: Node to Node communication

      The destination is a state inside the MyMessage object. You need to reset it every time you change destination, from controller to the other node and back:

       send(msg_LEAK_1.setDestination(0).setSensor(LEAK_1_CHILD_ID).set(LEAK_1));
       send(msg_LEAK_1.setDestination(15).setSensor(10).set(LEAK_1));
      
      

      Or you could create a second message object for the node to node communication:

      MyMessage msg_LEAK_1(LEAK_1_CHILD_ID,V_TRIPPED);
      MyMessage msg_LEAK_to_15(10,V_TRIPPED);
      
      void setup()  
      {  
        pinMode(LEAK_1_PIN,INPUT_PULLUP);
      
        // Set destination only once, sensor is set on constructor above
        msg_LEAK_to_15.setDestination(15);
      }
      //[...]
       if (LEAK_1 != last_LEAK_1) 
       {
         send(msg_LEAK_1.set(LEAK_1));
         send(msg_LEAK_to_15.set(LEAK_1));
         last_LEAK_1 = LEAK_1;
       }
      
      posted in Development
      boum
      boum

    Latest posts made by boum

    • RE: Help coding: adding functionality relying on MySensors-func/library (saveState/loadState) (c++)

      If you cannot include the whole mysensors header, you maybe can just forward declare the function. (basically, just copy the line from the mysensors.h in your mysEeprom.cpp file.

      /*extern*/ void saveState(uint8_t pos, uint8_t value);
      // extern probably not needed, that's real old C, but you I have had 
      // surprises with the arduino compiler… You might need to add it.
      

      What's the issue with namespaces or classes?

      posted in Troubleshooting
      boum
      boum
    • RE: Trying to automate in Domoticz

      First, make sure your switch is really named 'switch', the scripts are case sensitive, so neither 'Switch' nor 'SWITCH' will work. Also, verify you don't have a trailing space in the name ('switch ').
      To check your script is run when the device is changed, add a domoticz.log first line in the execute function.
      Hope this helps.

      posted in Domoticz
      boum
      boum
    • RE: Node to Node communication

      Yes, you should replace the sleep with a wait. If you module is sleeping, it won't receive any message.
      While prototyping/debugging, you should put more Serial.print around your blocks, not only in the innermost block.

      I guess you are mixing different things in the message object. In the receive() function, you should test message.sensor against 10, the sensor value you put in the sent message, 15 is the node ID destination, that is the current node.

      posted in Development
      boum
      boum
    • RE: Node to Node communication

      The destination is a state inside the MyMessage object. You need to reset it every time you change destination, from controller to the other node and back:

       send(msg_LEAK_1.setDestination(0).setSensor(LEAK_1_CHILD_ID).set(LEAK_1));
       send(msg_LEAK_1.setDestination(15).setSensor(10).set(LEAK_1));
      
      

      Or you could create a second message object for the node to node communication:

      MyMessage msg_LEAK_1(LEAK_1_CHILD_ID,V_TRIPPED);
      MyMessage msg_LEAK_to_15(10,V_TRIPPED);
      
      void setup()  
      {  
        pinMode(LEAK_1_PIN,INPUT_PULLUP);
      
        // Set destination only once, sensor is set on constructor above
        msg_LEAK_to_15.setDestination(15);
      }
      //[...]
       if (LEAK_1 != last_LEAK_1) 
       {
         send(msg_LEAK_1.set(LEAK_1));
         send(msg_LEAK_to_15.set(LEAK_1));
         last_LEAK_1 = LEAK_1;
       }
      
      posted in Development
      boum
      boum
    • RE: Domoticz/Mysensors

      @JeeLet Hi. First, you probably should have started another thread rather than hijacking this one since the situation is barely related.

      Looking here, I found that !MCO:PRO:RC=1 is caused mainly by calling send() or wait() inside the receive() function.
      I have not completely understood how things are happening but I think at best you're receiving a message while processing the current one. From several sources on this forum, you should keep your receive() function small. Process the content of the message and do all the work in loop().

      I would probably do something like that, but ⚠ I didn't compile and test the code :

      /*
       *  Alco_TL_Impuls_Light.ino
       *
       * https://forum.mysensors.org/topic/11263/domoticz-mysensors
       *
       *
       * REVISION HISTORY
       * Version 1.0 - Gateway Serial par Alco 
       * Version 0.0 - Node en RS485 par JeeLet
       * 
       *LA DESCRIPTION 
       * TL :Commande Impulsionnelle de TeLerupteur d'Eclairage 
       * TS :Retour d'Etat par un contact auxiliaire du TL. 
       * 
       * L'installation Electrique n'est pas modifiee, 
       * les boutons poussoir de l'habitat Cmd aussi le TL. 
       *  
       *  
       */ 
      
      //#define MY_DEBUG
      #define MY_NODE_ID 24           /*pour Node ID static*/
      
      /* ----- Module RS485 ----*/
      #define MY_RS485
      #define MY_RS485_DE_PIN 2
      #define MY_RS485_BAUD_RATE 9600
      // #define MY_RS485_HWSERIAL Serial1 /* Mega2560, port Serial X? */
      
      #include <MySensors.h>
      #include <Bounce2.h>
      
      #define STATE_CHILD_ID 0   /*Id du capteur (enfant)*/
      
      #define RELAY_PIN  4   // pin Cmd Telerupteur     "TL"
      #define CONTROL_INPUT_PIN  3  // pin Contact Auxiliaire  "TS"
      
      #define RELAY_ON 1 
      #define RELAY_OFF 0
      
      Bounce debouncer = Bounce();  // initialize debouncer
      
      MyMessage msg(STATE_CHILD_ID,V_STATUS);
      
      void setup()
      {
          pinMode(CONTROL_INPUT_PIN, INPUT_PULLUP);
          pinMode(RELAY_PIN, OUTPUT);
          digitalWrite(RELAY_PIN, RELAY_OFF);
      
          debouncer.attach(CONTROL_INPUT_PIN);
          debouncer.interval(20); // minimum ?
      }
      
      bool currentState;
      bool controllerState;
      
      void presentation()
      {
          sendSketchInfo("Cmd TL", "1.a");
          present(STATE_CHILD_ID, S_LIGHT);
      }
      
      void loop()
      {
          // Send impulse if controller changed state
          if (controllerState != currentState)
          {
              currentState = controllerState;
              digitalWrite(RELAY_PIN, RELAY_ON);
              wait(200);                          //delai On-Off Impuls
              digitalWrite(RELAY_PIN, RELAY_OFF);
          }
      
          // Inform controller if state change from input
          if (debouncer.update()) 
          {
              bool newState = !digitalRead(CONTROL_INPUT_PIN);
              if (newState != currentState)
              {
                  currentState = newState;
                  if (currentState != controllerState)
                  {
                      send(msg.set(currentState));
                  }
              }
          }
      }
      
      void receive(const MyMessage &message)
      {
          if (message.isEcho()) // keep message.isAck() for older MySensors version
          {
              Serial.println("Ceci est un accusé de réception de la passerelle");
              Serial.println("Cmd TL 1.a");
              return;
          }
      
          if (message.type==V_STATUS) // V_STATUS pour MyS v2.0, annulé V_LIGHT. 
          {    
              controllerState = message.getBool();
          }
      
          // Write some debug info
          Serial.print("Changement entrant pour le capteur:");
          Serial.print(message.sensor);
          Serial.print(", New status: ");
          Serial.println(message.getBool());
      }
      // ------------ fin Pgm -----------
      

      You may have to tweak the conditions and tests so that your sensor is always in a consistent state, but that should resolve the recursion error message.

      posted in Domoticz
      boum
      boum
    • RE: gw.sendVariable - library question

      You should post the code you're trying to compile. But it looks like it is using an older version of MySensors. The object model with Sensor gw is deprecated now.
      To send values to the gateway, you should use MyMessage messageName(CHILD_ID, V_type_of_message);

      posted in Development
      boum
      boum
    • RE: getting data from sensor to sensor

      Just an opinion about this issue. If you don't want to modify your sensor code and keep it "generic", you should move the logic and communication to the controller. Domoticz (or any other controller) already receives the data. It can conditionally send it to the LCD node.
      Having the code on the gateway or on nodes makes sense if you want it to work when the controller/gateway are out of reach.

      posted in Domoticz
      boum
      boum
    • RE: AnalogRead problem

      @MasMat
      The integer division might be the cause. Please try to force conversion to floating point:

        float readingSau = (1023.f / adcTmm)  - 1.f;
      
      posted in Troubleshooting
      boum
      boum