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. Troubleshooting
  3. Push V_VAR from Vera controller to sensor?

Push V_VAR from Vera controller to sensor?

Scheduled Pinned Locked Moved Troubleshooting
2 Posts 2 Posters 1.6k Views 2 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.
  • DaLiD Offline
    DaLiD Offline
    DaLi
    wrote on last edited by
    #1

    Hi,

    I've just started with MySensors, and am trying to get my first sketch working.
    I have an LCD display that I want to update from my Vera by setting V_VAR1 to V_VAR4.

    This is my sketch:

    #define SN "LCD Display"
    #define SV "1.0"
    #define NODE_ID 10
    
    #include <MySensor.h> 
    #include <SPI.h>
    #include <Wire.h>
    #include <LiquidCrystal_I2C.h>
    
    MySensor gw;
    
    static int backlight = 0;
    MyMessage backlightMsg(0, V_LIGHT);
    MyMessage var1text(0, V_VAR1);
    MyMessage var2text(0, V_VAR2);
    MyMessage var3text(0, V_VAR3);
    MyMessage var4text(0, V_VAR4);
    
    LiquidCrystal_I2C lcd(0x27, 2, 1, 0, 4, 5, 6, 7, 3, POSITIVE);
    //LiquidCrystal_I2C lcd(0x27); //set the LCD address to 0x27 for a 16 chars and 2 line display
    
    void setup()
    {
      Serial.begin(9600);  // Used to type in characters
      lcd.begin(20,4);
    
      // ------- Quick 3 blinks of backlight  -------------
      for(int i = 0; i< 3; i++)
      {
        lcd.backlight();
        delay(250);
        lcd.noBacklight();
        delay(250);
      }
      lcd.backlight(); // finish with backlight on  
    
      lcd.setCursor(0,0); //Start at character 4 on line 0
      lcd.print("   MySensors LCD    ");
      delay(1000);
      lcd.setCursor(0,2);
      lcd.print("Waiting for gateway");
      
      Serial.println( SN ); 
      gw.begin( incomingMessage, NODE_ID );
      gw.present( 0, S_LIGHT );
      gw.sendSketchInfo(SN, SV);
      // Pull the gateway's light status
      gw.request( 0, V_STATUS );
      gw.request( 0, V_VAR1 );
      gw.request( 0, V_VAR2 );
      gw.request( 0, V_VAR3 );
      gw.request( 0, V_VAR4 );
      
    
    }/*--(end setup )---*/
    
    
    void loop()
    {
      gw.process();
    }
    
    void incomingMessage(const MyMessage &message) {
      if (message.type == V_STATUS) {
        
        //  Retrieve on/off from the incoming request message
        int backlight = atoi( message.data );
    
        if (backlight){
          lcd.backlight();
        }
        else {
          lcd.noBacklight();
        }
    
        }
      if (message.type == V_VAR1) {
        String lcdtext = String(message.data);
        updateLCDRow(0, lcdtext);
      }
    
      if (message.type == V_VAR2) {
        String lcdtext = String(message.data);
        updateLCDRow(1, lcdtext);
      }
    
      if (message.type == V_VAR3) {
        String lcdtext = String(message.data);
        updateLCDRow(2, lcdtext);
      }
    
      if (message.type == V_VAR4) {
        String lcdtext = String(message.data);
        updateLCDRow(3, lcdtext);
      }
    }
    
    void updateLCDRow(int row, String text) {
      lcd.setCursor(0,row);
      lcd.print("                    ");
      lcd.setCursor(0,row);
      lcd.print(text);
    }
    
    

    The problem is that changing the variables in Vera doesn't update the LCD (only once during setup). Do I have to do a gw.request() in the loop in order to get the data? That seems a bit inefficient...
    Is it possible to push the data?

    1 Reply Last reply
    0
    • H Offline
      H Offline
      hek
      Admin
      wrote on last edited by
      #2

      You can push data using a scene or via lua...

      
      
      luup.call_action("urn:upnp-arduino-cc:serviceId:arduino1", "SendCommand", {radioId="1;2", variableId="VAR_1", value="Hello"}, 372)
      

      1 - node id
      2 - sensor id
      372 is your arduino device id

      1 Reply Last reply
      0

      Hello! It looks like you're interested in this conversation, but you don't have an account yet.

      Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.

      With your input, this post could be even better 💗

      Register Login
      Reply
      • Reply as topic
      Log in to reply
      • Oldest to Newest
      • Newest to Oldest
      • Most Votes


      18

      Online

      12.0k

      Users

      11.2k

      Topics

      113.4k

      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