Skip to content
  • MySensors
  • OpenHardware.io
  • Categories
  • Recent
  • Tags
  • Popular
Skins
  • Light
  • Brite
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Brand Logo
  1. Home
  2. Controllers
  3. Domoticz
  4. Push V_Text value update from Domoticz to MySensors node

Push V_Text value update from Domoticz to MySensors node

Scheduled Pinned Locked Moved Domoticz
6 Posts 2 Posters 3.0k Views 3 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • L Offline
    L Offline
    LastSamurai
    Hardware Contributor
    wrote on last edited by LastSamurai
    #1

    Hi, I am currently working on a 433Mhz gateway. It is a mysensors node that has a 433Mhz sender and receiver. It presents two S_INFO/V_TEXT children: the sender and the receiver. The idea is that the receiver receives a message via 433Mhz and sends the code as text to the controller. The controller decides what to do and then sends back a text with the answer code to the node. The node than takes that code and sends it via 433Mhz.
    My problem at the moment is that no message seems to get send to the node when I update the text value in domoticz. Does anyone have an idea why? I saw other people sending messages from the controller to a node.

    Here is my code:

    
    // define radio stuff
    #define MY_RADIO_NRF24
    #define MY_BAUD_RATE 9600
    #define MY_DEBUG    // Enables debug messages in the serial log
    //#define MY_NODE_ID 13
    
    // add signing stuff
    //#define MY_SIGNING_SOFT // Enables software signing
    //#define MY_SIGNING_REQUEST_SIGNATURES // Always request signing from gateway
    //#define MY_SIGNING_SOFT_RANDOMSEED_PIN 7 // floating pin for randomness
    //#define MY_DEBUG_VERBOSE_SIGNING
    
    #include <EEPROM.h>
    #include <SPI.h>
    #include <MyConfig.h>
    #include <MySensors.h>
    #include <Vcc.h>
    #include <RCSwitch.h>
    
    const long RECEIVER_PIN = 0;
    const long SENDER_PIN = 7;
    const long DEBOUNCE = 500;
    const long CHILD_RECEIVER = 0;
    const long CHILD_SENDER = 1;
    
    
    RCSwitch wirelessSwitch = RCSwitch();
    
    
    void presentation()
    {
      sendSketchInfo("433 Wireless Gateway", "29062017");
    
      present(CHILD_RECEIVER, S_INFO); // able to receive text
      present(CHILD_SENDER, S_INFO); // able to send text
    }
    
    void setup() {
      wirelessSwitch.enableReceive(RECEIVER_PIN); // Receiver on interrupt 0 => that is pin #2
      wirelessSwitch.enableTransmit(SENDER_PIN);  // Sender on pin 7
      Serial.println("Started listening on pin 2 for incoming 433Mhz messages");
    }
    
    void loop() {
      if (wirelessSwitch.available()) {
      	// for testing
        //output(wirelessSwitch.getReceivedValue(), wirelessSwitch.getReceivedBitlength(), wirelessSwitch.getReceivedDelay(), wirelessSwitch.getReceivedRawdata(),wirelessSwitch.getReceivedProtocol());
    
        unsigned long received_val = wirelessSwitch.getReceivedValue();
    
        Serial.print("Received 433Mhz message: ");
        Serial.println(received_val);
    
        send(MyMessage(CHILD_RECEIVER, V_TEXT).set(received_val));
    
        // software debounce
        wait(DEBOUNCE);
        wirelessSwitch.resetAvailable();
      }
    }
    
    void receive(const MyMessage &message) {
      Serial.print("Sensor: "); Serial.print(message.sensor); Serial.print(", Message: "); Serial.println(message.getString()); 
      if (message.type == V_TEXT) { 
        if (message.sensor == CHILD_SENDER) {
          Serial.println("Sending message via 433Mhz");
          char * messageContent = strdup(message.getString());
          wirelessSwitch.send(messageContent);
        }
      }
    }
    

    On the domoticz side I have a piece of lua code (using dzVents) that just copies the receiver value to the sender

    return {
            active = true,
            on = {
                '433Receiver'
            },
            execute = function(domoticz, sensor)
    
                domoticz.log("Received from gateway " .. sensor.state)
                -- check sensor values 
                domoticz.devices['433Sender'].updateText(sensor.state)
            end
        }
    

    and its working in the domoticz ui... Is this a domoticz error or am I missing something in my code?

    1 Reply Last reply
    0
    • L Offline
      L Offline
      LastSamurai
      Hardware Contributor
      wrote on last edited by
      #2

      PS part of the problem might be that the value gets updated in the normal domoticz ui but in the hardware tab in the details of the gateway I still see no value at all for the sender child. Does anyone know if I am missing some code in my lua perhaps, or if this is a bug in domoticz or the mysensors integration?

      YveauxY 1 Reply Last reply
      0
      • L LastSamurai

        PS part of the problem might be that the value gets updated in the normal domoticz ui but in the hardware tab in the details of the gateway I still see no value at all for the sender child. Does anyone know if I am missing some code in my lua perhaps, or if this is a bug in domoticz or the mysensors integration?

        YveauxY Offline
        YveauxY Offline
        Yveaux
        Mod
        wrote on last edited by
        #3

        @LastSamurai I ran into the same issue lately. IIRR it is an issue with Domoticz: V_TEXT can only be sent by a node to Domoticz. Domoticz will not send an updated text back to a node...
        A very lame workaround could be to trigger Domoticz to send something to the node (e.g. V_STATUS) which triggers the node to request the latest V_TEXT from Domoticz :hankey:

        http://yveaux.blogspot.nl

        1 Reply Last reply
        1
        • L Offline
          L Offline
          LastSamurai
          Hardware Contributor
          wrote on last edited by
          #4

          Well thats bad :( Thanks for the help though! I hope domoticz adds this feature soon

          YveauxY 1 Reply Last reply
          0
          • L LastSamurai

            Well thats bad :( Thanks for the help though! I hope domoticz adds this feature soon

            YveauxY Offline
            YveauxY Offline
            Yveaux
            Mod
            wrote on last edited by
            #5

            @LastSamurai well, you could always ask /discuss on the domoticz forum

            http://yveaux.blogspot.nl

            1 Reply Last reply
            0
            • L Offline
              L Offline
              LastSamurai
              Hardware Contributor
              wrote on last edited by
              #6

              I already have (in a github issue). Didn't get any answer yet. I am currently trying to simply use some other type of sensor (as I just need to send an integer) but none of them have really worked yet.

              1 Reply Last reply
              1
              Reply
              • Reply as topic
              Log in to reply
              • Oldest to Newest
              • Newest to Oldest
              • Most Votes


              28

              Online

              11.7k

              Users

              11.2k

              Topics

              113.1k

              Posts


              Copyright 2025 TBD   |   Forum Guidelines   |   Privacy Policy   |   Terms of Service
              • Login

              • Don't have an account? Register

              • Login or register to search.
              • First post
                Last post
              0
              • MySensors
              • OpenHardware.io
              • Categories
              • Recent
              • Tags
              • Popular