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
DaLiD

DaLi

@DaLi
About
Posts
3
Topics
2
Shares
0
Groups
0
Followers
0
Following
0

Posts

Recent Best Controversial

  • Push V_VAR from Vera controller to sensor?
    DaLiD DaLi

    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?

    Troubleshooting

  • Request data from another sensor?
    DaLiD DaLi

    That totally makes sense.
    I have come to the conclusion that I will probably let my Vera push the info to the LCD node.

    Development

  • Request data from another sensor?
    DaLiD DaLi

    Hi all, first post from me.

    As I have understood, it is possible for sensor A to fetch values from sensor B. Can someone provide an example of how that is done?
    My goal is to create a sensor that has an LCD connected that will display the temperature from other sensors (preferably both MySensor and z-wave).

    Development
  • Login

  • Don't have an account? Register

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