Navigation

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

    Posts made by cleight

    • RE: Iboard - Cheap Single board Ethernet Arduino with Radio

      Hello,

      I have been trying to get my iBoard working correctly for a few months on and off and finally got it up and running with good range and things are working good. However I am having an issue with the gateway always being stuck in inclusion mode, I have the following sketch, I would like to retain the onboard LED's but I don't have an inclusion button or need one since I can start the inclusion process from Vera. Any guidance would be greatly appreciated.

      /**
       * The MySensors Arduino library handles the wireless radio link and protocol
       * between your home built sensors/actuators and HA controller of choice.
       * The sensors forms a self healing radio network with optional repeaters. Each
       * repeater and gateway builds a routing tables in EEPROM which keeps track of the
       * network topology allowing messages to be routed to nodes.
       *
       * Created by Henrik Ekblad <henrik.ekblad@mysensors.org>
       * Copyright (C) 2013-2015 Sensnology AB
       * Full contributor list: https://github.com/mysensors/Arduino/graphs/contributors
       *
       * Documentation: http://www.mysensors.org
       * Support Forum: http://forum.mysensors.org
       *
       * This program is free software; you can redistribute it and/or
       * modify it under the terms of the GNU General Public License
       * version 2 as published by the Free Software Foundation.
       *
       *******************************
       *
       * REVISION HISTORY
       * Version 1.0 - Henrik EKblad
       * Contribution by a-lurker and Anticimex, 
       * Contribution by Norbert Truchsess <norbert.truchsess@t-online.de>
       *
       * 
       * DESCRIPTION
       * The EthernetGateway sends data received from sensors to the ethernet link. 
       * The gateway also accepts input on ethernet interface, which is then sent out to the radio network.
       *
       * The GW code is designed for Arduino 328p / 16MHz.  ATmega168 does not have enough memory to run this program.
       * 
       *
       * COMPILING WIZNET (W5100) ETHERNET MODULE
       * > Edit MyConfig.h in (libraries\MySensors\) to enable softspi (remove // before "#define SOFTSPI").
       *
       * COMPILING ENC28J60 ETHERNET MODULE
       * > Use Arduino IDE 1.5.7 (or later) 
       * > Disable DEBUG in Sensor.h before compiling this sketch. Othervise the sketch will probably not fit in program space when downloading. 
       * > Remove Ethernet.h include below and include UIPEthernet.h 
       * > Remove DigitalIO include 
       * Note that I had to disable UDP and DHCP support in uipethernet-conf.h to reduce space. (which means you have to choose a static IP for that module)
       *
       * VERA CONFIGURATION:
       * Enter "ip-number:port" in the ip-field of the Arduino GW device. This will temporarily override any serial configuration for the Vera plugin. 
       * E.g. If you want to use the defualt values in this sketch enter: 192.168.178.66:5003
       *
       * LED purposes:
       * - To use the feature, uncomment WITH_LEDS_BLINKING in MyConfig.h
       * - RX (green) - blink fast on radio message recieved. In inclusion mode will blink fast only on presentation recieved
       * - TX (yellow) - blink fast on radio message transmitted. In inclusion mode will blink slowly
       * - ERR (red) - fast blink on error during transmission error or recieve crc error  
       * 
       * See http://www.mysensors.org/build/ethernet_gateway for wiring instructions.
       *
       */
      #define NO_PORTB_PINCHANGES 
      
      #include <DigitalIO.h>     // This include can be removed when using UIPEthernet module  
      #include <SPI.h>  
      
      #include <MySigningNone.h>
      #include <MyTransportRFM69.h>
      #include <MyTransportNRF24.h>
      #include <MyHwATMega328.h>
      #include <MySigningAtsha204Soft.h>
      #include <MySigningAtsha204.h>
      
      #include <MyParserSerial.h>  
      #include <MySensor.h>  
      #include <stdarg.h>
      #include <PinChangeInt.h>
      #include "GatewayUtil.h"
      
      
      // Use this if you have attached a Ethernet ENC28J60 shields  
      // #include <UIPEthernet.h>  
      
      // Use this for WizNET W5100 module and Arduino Ethernet Shield 
      #include <Ethernet.h>   
      
      
      #define INCLUSION_MODE_TIME 1 // Number of minutes inclusion mode is enabled
      #define INCLUSION_MODE_PIN  14 // Digital pin used for inclusion mode button
      
      #define RADIO_CE_PIN        3  // radio chip enable
      #define RADIO_SPI_SS_PIN    8  // radio SPI serial select
      
      #define RADIO_ERROR_LED_PIN 7  // Error led pin
      #define RADIO_RX_LED_PIN    6  // Receive led pin
      #define RADIO_TX_LED_PIN    9  // the PCB, on board LED
      
      
      // NRFRF24L01 radio driver (set low transmit power by default) 
      MyTransportNRF24 transport(RADIO_CE_PIN, RADIO_SPI_SS_PIN, RF24_PA_LEVEL_GW);  
      //MyTransportRFM69 transport;
      
      // Message signing driver (signer needed if MY_SIGNING_FEATURE is turned on in MyConfig.h)
      //MySigningNone signer;
      //MySigningAtsha204Soft signer;
      //MySigningAtsha204 signer;
      
      // Hardware profile 
      MyHwATMega328 hw;
      
      // Construct MySensors library (signer needed if MY_SIGNING_FEATURE is turned on in MyConfig.h)
      // To use LEDs blinking, uncomment WITH_LEDS_BLINKING in MyConfig.h
      #ifdef WITH_LEDS_BLINKING
      MySensor gw(transport, hw /*, signer*/, RADIO_RX_LED_PIN, RADIO_TX_LED_PIN, RADIO_ERROR_LED_PIN);
      #else
      MySensor gw(transport, hw /*, signer*/);
      #endif
      
      
      #define IP_PORT 5003        // The port you want to open 
      IPAddress myIp (192, 168, 2, 62);  // Configure your static ip-address here    COMPILE ERROR HERE? Use Arduino IDE 1.5.7 or later!
      
      // The MAC address can be anything you want but should be unique on your network.
      // Newer boards have a MAC address printed on the underside of the PCB, which you can (optionally) use.
      // Note that most of the Ardunio examples use  "DEAD BEEF FEED" for the MAC address.
      byte mac[] = { 0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0xED };  // DEAD BEEF FEED
      
      // a R/W server on the port
      EthernetServer server = EthernetServer(IP_PORT);
      // handle to open connection
      EthernetClient client = EthernetClient();
      
      char inputString[MAX_RECEIVE_LENGTH] = "";    // A string to hold incoming commands from serial/ethernet interface
      int inputPos = 0;
      bool sentReady = false;
      
      void output(const char *fmt, ... ) {
         va_list args;
         va_start (args, fmt );
         vsnprintf_P(serialBuffer, MAX_SEND_LENGTH, fmt, args);
         va_end (args);
         Serial.print(serialBuffer);
         server.write(serialBuffer);
      }
      
      void setup()  
      { 
        Ethernet.begin(mac, myIp);
      
        setupGateway(INCLUSION_MODE_PIN, INCLUSION_MODE_TIME, output);
      
        // Add interrupt for inclusion button to pin
        PCintPort::attachInterrupt(pinInclusion, startInclusionInterrupt, RISING);
      
        // give the Ethernet interface a second to initialize
        delay(1000);
      
        // Initialize gateway at maximum PA level, channel 70 and callback for write operations 
        gw.begin(incomingMessage, 0, true, 0);
      
        
        // start listening for clients
        server.begin();
      
      }
      
      
      void loop() {
        gw.process();  
        
        checkButtonTriggeredInclusion();
        checkInclusionFinished();
        
        // if an incoming client connects, there will be
        // bytes available to read via the client object
        EthernetClient newclient = server.available();
        // if a new client connects make sure to dispose any previous existing sockets
        if (newclient) {
            if (client != newclient) {
             client.stop();
             client = newclient;
             output(PSTR("0;0;%d;0;%d;Gateway startup complete.\n"),  C_INTERNAL, I_GATEWAY_READY);
           }
         }
              
         if (client) {
           if (!client.connected()) {
             client.stop();
           } else if (client.available()) { 
             // read the bytes incoming from the client
             char inChar = client.read();
             if (inputPos<MAX_RECEIVE_LENGTH-1) { 
               // if newline then command is complete
               if (inChar == '\n') {  
                 Serial.println("Finished");
                  // a command was issued by the client
                  // we will now try to send it to the actuator
                  inputString[inputPos] = 0;
            
                  // echo the string to the serial port
                  Serial.print(inputString);
            
                  parseAndSend(gw, inputString);
            
                  // clear the string:
                  inputPos = 0;
               } else {  
                 // add it to the inputString:
                 inputString[inputPos] = inChar;
                 inputPos++;
               }
            } else {
               // Incoming message too long. Throw away 
               inputPos = 0;
            }
          }
        }
      }
      
      posted in Hardware
      cleight
      cleight
    • Ethernet Gateway stuck in inclusion mode

      Good evening everyone,

      I have been having issues with getting my iBoard gateway with the hardware mod to be stable. I finally got my range issues straightened out and now I am on to the next issue, the gateway being stuck in inclusion mode. I don't have an inclusion button connected to the gateway nor LED's with the exception of the onboard ones. I somehow need to remove the inclusion button from the sketch but not sure how to go about doing that.

      Gateway Sketch:

      /**
       * The MySensors Arduino library handles the wireless radio link and protocol
       * between your home built sensors/actuators and HA controller of choice.
       * The sensors forms a self healing radio network with optional repeaters. Each
       * repeater and gateway builds a routing tables in EEPROM which keeps track of the
       * network topology allowing messages to be routed to nodes.
       *
       * Created by Henrik Ekblad <henrik.ekblad@mysensors.org>
       * Copyright (C) 2013-2015 Sensnology AB
       * Full contributor list: https://github.com/mysensors/Arduino/graphs/contributors
       *
       * Documentation: http://www.mysensors.org
       * Support Forum: http://forum.mysensors.org
       *
       * This program is free software; you can redistribute it and/or
       * modify it under the terms of the GNU General Public License
       * version 2 as published by the Free Software Foundation.
       *
       *******************************
       *
       * REVISION HISTORY
       * Version 1.0 - Henrik EKblad
       * Contribution by a-lurker and Anticimex, 
       * Contribution by Norbert Truchsess <norbert.truchsess@t-online.de>
       *
       * 
       * DESCRIPTION
       * The EthernetGateway sends data received from sensors to the ethernet link. 
       * The gateway also accepts input on ethernet interface, which is then sent out to the radio network.
       *
       * The GW code is designed for Arduino 328p / 16MHz.  ATmega168 does not have enough memory to run this program.
       * 
       *
       * COMPILING WIZNET (W5100) ETHERNET MODULE
       * > Edit MyConfig.h in (libraries\MySensors\) to enable softspi (remove // before "#define SOFTSPI").
       *
       * COMPILING ENC28J60 ETHERNET MODULE
       * > Use Arduino IDE 1.5.7 (or later) 
       * > Disable DEBUG in Sensor.h before compiling this sketch. Othervise the sketch will probably not fit in program space when downloading. 
       * > Remove Ethernet.h include below and include UIPEthernet.h 
       * > Remove DigitalIO include 
       * Note that I had to disable UDP and DHCP support in uipethernet-conf.h to reduce space. (which means you have to choose a static IP for that module)
       *
       * VERA CONFIGURATION:
       * Enter "ip-number:port" in the ip-field of the Arduino GW device. This will temporarily override any serial configuration for the Vera plugin. 
       * E.g. If you want to use the defualt values in this sketch enter: 192.168.178.66:5003
       *
       * LED purposes:
       * - To use the feature, uncomment WITH_LEDS_BLINKING in MyConfig.h
       * - RX (green) - blink fast on radio message recieved. In inclusion mode will blink fast only on presentation recieved
       * - TX (yellow) - blink fast on radio message transmitted. In inclusion mode will blink slowly
       * - ERR (red) - fast blink on error during transmission error or recieve crc error  
       * 
       * See http://www.mysensors.org/build/ethernet_gateway for wiring instructions.
       *
       */
      #define NO_PORTB_PINCHANGES 
      
      #include <DigitalIO.h>     // This include can be removed when using UIPEthernet module  
      #include <SPI.h>  
      
      #include <MySigningNone.h>
      #include <MyTransportRFM69.h>
      #include <MyTransportNRF24.h>
      #include <MyHwATMega328.h>
      #include <MySigningAtsha204Soft.h>
      #include <MySigningAtsha204.h>
      
      #include <MyParserSerial.h>  
      #include <MySensor.h>  
      #include <stdarg.h>
      #include <PinChangeInt.h>
      #include "GatewayUtil.h"
      
      
      // Use this if you have attached a Ethernet ENC28J60 shields  
      // #include <UIPEthernet.h>  
      
      // Use this for WizNET W5100 module and Arduino Ethernet Shield 
      #include <Ethernet.h>   
      
      
      #define INCLUSION_MODE_TIME 1 // Number of minutes inclusion mode is enabled
      #define INCLUSION_MODE_PIN  14 // Digital pin used for inclusion mode button
      
      #define RADIO_CE_PIN        3  // radio chip enable
      #define RADIO_SPI_SS_PIN    8  // radio SPI serial select
      
      #define RADIO_ERROR_LED_PIN 7  // Error led pin
      #define RADIO_RX_LED_PIN    6  // Receive led pin
      #define RADIO_TX_LED_PIN    9  // the PCB, on board LED
      
      
      // NRFRF24L01 radio driver (set low transmit power by default) 
      MyTransportNRF24 transport(RADIO_CE_PIN, RADIO_SPI_SS_PIN, RF24_PA_LEVEL_GW);  
      //MyTransportRFM69 transport;
      
      // Message signing driver (signer needed if MY_SIGNING_FEATURE is turned on in MyConfig.h)
      //MySigningNone signer;
      //MySigningAtsha204Soft signer;
      //MySigningAtsha204 signer;
      
      // Hardware profile 
      MyHwATMega328 hw;
      
      // Construct MySensors library (signer needed if MY_SIGNING_FEATURE is turned on in MyConfig.h)
      // To use LEDs blinking, uncomment WITH_LEDS_BLINKING in MyConfig.h
      #ifdef WITH_LEDS_BLINKING
      MySensor gw(transport, hw /*, signer*/, RADIO_RX_LED_PIN, RADIO_TX_LED_PIN, RADIO_ERROR_LED_PIN);
      #else
      MySensor gw(transport, hw /*, signer*/);
      #endif
      
      
      #define IP_PORT 5003        // The port you want to open 
      IPAddress myIp (192, 168, 2, 62);  // Configure your static ip-address here    COMPILE ERROR HERE? Use Arduino IDE 1.5.7 or later!
      
      // The MAC address can be anything you want but should be unique on your network.
      // Newer boards have a MAC address printed on the underside of the PCB, which you can (optionally) use.
      // Note that most of the Ardunio examples use  "DEAD BEEF FEED" for the MAC address.
      byte mac[] = { 0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0xED };  // DEAD BEEF FEED
      
      // a R/W server on the port
      EthernetServer server = EthernetServer(IP_PORT);
      // handle to open connection
      EthernetClient client = EthernetClient();
      
      char inputString[MAX_RECEIVE_LENGTH] = "";    // A string to hold incoming commands from serial/ethernet interface
      int inputPos = 0;
      bool sentReady = false;
      
      void output(const char *fmt, ... ) {
         va_list args;
         va_start (args, fmt );
         vsnprintf_P(serialBuffer, MAX_SEND_LENGTH, fmt, args);
         va_end (args);
         Serial.print(serialBuffer);
         server.write(serialBuffer);
      }
      
      void setup()  
      { 
        Ethernet.begin(mac, myIp);
      
        setupGateway(INCLUSION_MODE_PIN, INCLUSION_MODE_TIME, output);
      
        // Add interrupt for inclusion button to pin
        PCintPort::attachInterrupt(pinInclusion, startInclusionInterrupt, RISING);
      
        // give the Ethernet interface a second to initialize
        delay(1000);
      
        // Initialize gateway at maximum PA level, channel 70 and callback for write operations 
        gw.begin(incomingMessage, 0, true, 0);
      
        
        // start listening for clients
        server.begin();
      
      }
      
      
      void loop() {
        gw.process();  
        
        checkButtonTriggeredInclusion();
        checkInclusionFinished();
        
        // if an incoming client connects, there will be
        // bytes available to read via the client object
        EthernetClient newclient = server.available();
        // if a new client connects make sure to dispose any previous existing sockets
        if (newclient) {
            if (client != newclient) {
             client.stop();
             client = newclient;
             output(PSTR("0;0;%d;0;%d;Gateway startup complete.\n"),  C_INTERNAL, I_GATEWAY_READY);
           }
         }
              
         if (client) {
           if (!client.connected()) {
             client.stop();
           } else if (client.available()) { 
             // read the bytes incoming from the client
             char inChar = client.read();
             if (inputPos<MAX_RECEIVE_LENGTH-1) { 
               // if newline then command is complete
               if (inChar == '\n') {  
                 Serial.println("Finished");
                  // a command was issued by the client
                  // we will now try to send it to the actuator
                  inputString[inputPos] = 0;
            
                  // echo the string to the serial port
                  Serial.print(inputString);
            
                  parseAndSend(gw, inputString);
            
                  // clear the string:
                  inputPos = 0;
               } else {  
                 // add it to the inputString:
                 inputString[inputPos] = inChar;
                 inputPos++;
               }
            } else {
               // Incoming message too long. Throw away 
               inputPos = 0;
            }
          }
        }
      }
      
      posted in Troubleshooting
      cleight
      cleight
    • RE: Poor Signal range from sensor to gateway

      Hardware mod

      posted in Troubleshooting
      cleight
      cleight
    • RE: Poor Signal range from sensor to gateway

      Good news! I was able to get everything working finally! Here it must of been an issue with my gateway sketch along with changing power settings on the gateway to RF24_PA_LOW. my only issue now with my gateway is Vera shows it constantly in inclusion mode, I believe it has something to do with my sketch, I don't have an inclusion button on my iBoard Gateway so I changed the PIN in the sketch to a fictitious pin but that seems to have just compounded the issue, if anyone can point me in the right direction on that front it would be much appreciated.

      /**
       * The MySensors Arduino library handles the wireless radio link and protocol
       * between your home built sensors/actuators and HA controller of choice.
       * The sensors forms a self healing radio network with optional repeaters. Each
       * repeater and gateway builds a routing tables in EEPROM which keeps track of the
       * network topology allowing messages to be routed to nodes.
       *
       * Created by Henrik Ekblad <henrik.ekblad@mysensors.org>
       * Copyright (C) 2013-2015 Sensnology AB
       * Full contributor list: https://github.com/mysensors/Arduino/graphs/contributors
       *
       * Documentation: http://www.mysensors.org
       * Support Forum: http://forum.mysensors.org
       *
       * This program is free software; you can redistribute it and/or
       * modify it under the terms of the GNU General Public License
       * version 2 as published by the Free Software Foundation.
       *
       *******************************
       *
       * REVISION HISTORY
       * Version 1.0 - Henrik EKblad
       * Contribution by a-lurker and Anticimex, 
       * Contribution by Norbert Truchsess <norbert.truchsess@t-online.de>
       *
       * 
       * DESCRIPTION
       * The EthernetGateway sends data received from sensors to the ethernet link. 
       * The gateway also accepts input on ethernet interface, which is then sent out to the radio network.
       *
       * The GW code is designed for Arduino 328p / 16MHz.  ATmega168 does not have enough memory to run this program.
       * 
       *
       * COMPILING WIZNET (W5100) ETHERNET MODULE
       * > Edit MyConfig.h in (libraries\MySensors\) to enable softspi (remove // before "#define SOFTSPI").
       *
       * COMPILING ENC28J60 ETHERNET MODULE
       * > Use Arduino IDE 1.5.7 (or later) 
       * > Disable DEBUG in Sensor.h before compiling this sketch. Othervise the sketch will probably not fit in program space when downloading. 
       * > Remove Ethernet.h include below and include UIPEthernet.h 
       * > Remove DigitalIO include 
       * Note that I had to disable UDP and DHCP support in uipethernet-conf.h to reduce space. (which means you have to choose a static IP for that module)
       *
       * VERA CONFIGURATION:
       * Enter "ip-number:port" in the ip-field of the Arduino GW device. This will temporarily override any serial configuration for the Vera plugin. 
       * E.g. If you want to use the defualt values in this sketch enter: 192.168.178.66:5003
       *
       * LED purposes:
       * - To use the feature, uncomment WITH_LEDS_BLINKING in MyConfig.h
       * - RX (green) - blink fast on radio message recieved. In inclusion mode will blink fast only on presentation recieved
       * - TX (yellow) - blink fast on radio message transmitted. In inclusion mode will blink slowly
       * - ERR (red) - fast blink on error during transmission error or recieve crc error  
       * 
       * See http://www.mysensors.org/build/ethernet_gateway for wiring instructions.
       *
       */
      #define NO_PORTB_PINCHANGES 
      
      #include <DigitalIO.h>     // This include can be removed when using UIPEthernet module  
      #include <SPI.h>  
      
      #include <MySigningNone.h>
      #include <MyTransportRFM69.h>
      #include <MyTransportNRF24.h>
      #include <MyHwATMega328.h>
      #include <MySigningAtsha204Soft.h>
      #include <MySigningAtsha204.h>
      
      #include <MyParserSerial.h>  
      #include <MySensor.h>  
      #include <stdarg.h>
      #include <PinChangeInt.h>
      #include "GatewayUtil.h"
      
      
      // Use this if you have attached a Ethernet ENC28J60 shields  
      // #include <UIPEthernet.h>  
      
      // Use this for WizNET W5100 module and Arduino Ethernet Shield 
      #include <Ethernet.h>   
      
      
      #define INCLUSION_MODE_TIME 1 // Number of minutes inclusion mode is enabled
      #define INCLUSION_MODE_PIN  14 // Digital pin used for inclusion mode button
      
      #define RADIO_CE_PIN        3  // radio chip enable
      #define RADIO_SPI_SS_PIN    8  // radio SPI serial select
      
      #define RADIO_ERROR_LED_PIN 7  // Error led pin
      #define RADIO_RX_LED_PIN    6  // Receive led pin
      #define RADIO_TX_LED_PIN    9  // the PCB, on board LED
      
      
      // NRFRF24L01 radio driver (set low transmit power by default) 
      MyTransportNRF24 transport(RADIO_CE_PIN, RADIO_SPI_SS_PIN, RF24_PA_LEVEL_GW);  
      //MyTransportRFM69 transport;
      
      // Message signing driver (signer needed if MY_SIGNING_FEATURE is turned on in MyConfig.h)
      //MySigningNone signer;
      //MySigningAtsha204Soft signer;
      //MySigningAtsha204 signer;
      
      // Hardware profile 
      MyHwATMega328 hw;
      
      // Construct MySensors library (signer needed if MY_SIGNING_FEATURE is turned on in MyConfig.h)
      // To use LEDs blinking, uncomment WITH_LEDS_BLINKING in MyConfig.h
      #ifdef WITH_LEDS_BLINKING
      MySensor gw(transport, hw /*, signer*/, RADIO_RX_LED_PIN, RADIO_TX_LED_PIN, RADIO_ERROR_LED_PIN);
      #else
      MySensor gw(transport, hw /*, signer*/);
      #endif
      
      
      #define IP_PORT 5003        // The port you want to open 
      IPAddress myIp (192, 168, 2, 62);  // Configure your static ip-address here    COMPILE ERROR HERE? Use Arduino IDE 1.5.7 or later!
      
      // The MAC address can be anything you want but should be unique on your network.
      // Newer boards have a MAC address printed on the underside of the PCB, which you can (optionally) use.
      // Note that most of the Ardunio examples use  "DEAD BEEF FEED" for the MAC address.
      byte mac[] = { 0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0xED };  // DEAD BEEF FEED
      
      // a R/W server on the port
      EthernetServer server = EthernetServer(IP_PORT);
      // handle to open connection
      EthernetClient client = EthernetClient();
      
      char inputString[MAX_RECEIVE_LENGTH] = "";    // A string to hold incoming commands from serial/ethernet interface
      int inputPos = 0;
      bool sentReady = false;
      
      void output(const char *fmt, ... ) {
         va_list args;
         va_start (args, fmt );
         vsnprintf_P(serialBuffer, MAX_SEND_LENGTH, fmt, args);
         va_end (args);
         Serial.print(serialBuffer);
         server.write(serialBuffer);
      }
      
      void setup()  
      { 
        Ethernet.begin(mac, myIp);
      
        setupGateway(INCLUSION_MODE_PIN, INCLUSION_MODE_TIME, output);
      
        // Add interrupt for inclusion button to pin
        PCintPort::attachInterrupt(pinInclusion, startInclusionInterrupt, RISING);
      
        // give the Ethernet interface a second to initialize
        delay(1000);
      
        // Initialize gateway at maximum PA level, channel 70 and callback for write operations 
        gw.begin(incomingMessage, 0, true, 0);
      
        
        // start listening for clients
        server.begin();
      
      }
      
      
      void loop() {
        gw.process();  
        
        checkButtonTriggeredInclusion();
        checkInclusionFinished();
        
        // if an incoming client connects, there will be
        // bytes available to read via the client object
        EthernetClient newclient = server.available();
        // if a new client connects make sure to dispose any previous existing sockets
        if (newclient) {
            if (client != newclient) {
             client.stop();
             client = newclient;
             output(PSTR("0;0;%d;0;%d;Gateway startup complete.\n"),  C_INTERNAL, I_GATEWAY_READY);
           }
         }
              
         if (client) {
           if (!client.connected()) {
             client.stop();
           } else if (client.available()) { 
             // read the bytes incoming from the client
             char inChar = client.read();
             if (inputPos<MAX_RECEIVE_LENGTH-1) { 
               // if newline then command is complete
               if (inChar == '\n') {  
                 Serial.println("Finished");
                  // a command was issued by the client
                  // we will now try to send it to the actuator
                  inputString[inputPos] = 0;
            
                  // echo the string to the serial port
                  Serial.print(inputString);
            
                  parseAndSend(gw, inputString);
            
                  // clear the string:
                  inputPos = 0;
               } else {  
                 // add it to the inputString:
                 inputString[inputPos] = inChar;
                 inputPos++;
               }
            } else {
               // Incoming message too long. Throw away 
               inputPos = 0;
            }
          }
        }
      }
      
      posted in Troubleshooting
      cleight
      cleight
    • RE: Poor Signal range from sensor to gateway

      I recieved my NRF24L01+PA+LNA yesterday in the mail. I installed this on my gateway and still the range is exactly how it was to my sensors. I have built another simple temp/humidity sensor that is only 10' from the gateway and still cannot communicate to the gateway. I still have RF24_PA_MAX for both the sensors and the gateway and nothing.

      I am now at the point of wondering if I have a bad iBoard (gateway) that is causing these issues. Any more insight before I order another iBoard for a gateway?

      Also if I wanted to temporarily change from an ethernet gateway to a serial/usb gateway with Vera what all would be involved?

      posted in Troubleshooting
      cleight
      cleight
    • RE: Poor Signal range from sensor to gateway

      So my only options are a lp radio with an extension cable /antenna outside the hot tub cabinet or possibly the rm69 radio correct?

      Would it be possible to hard wire the sensor via ether net to the mysen sort network?

      posted in Troubleshooting
      cleight
      cleight
    • RE: Poor Signal range from sensor to gateway

      Since no one has posted anything in the form of suggestions. I am going to order a NRF24L01+PA+LNA for my gateway and see if it helps. I built a simple temp/humidity sensor from the examples and have it directly 1 floor above the gateway and it isn't being picked up by the gateway either. The power supply going to my iBoard gateway is a 9V 1000ma wall wart, I believe this has plenty of power to run the Ardunio, Ethernet, and the radio. I have also switched the 4.7uf capacitor for a 47uf capacitor without luck either.

      posted in Troubleshooting
      cleight
      cleight
    • Poor Signal range from sensor to gateway

      I am hoping someone here could possibly shed some insight as to what steps to take next. I am having issues getting a sensor that is approximately 15ft (3m) from the gateway to communicate. It appears it will not communicate with the gateway unless it is approximately 3ft (1m) away from the gateway. Here is some background of my environment:

      Gateway:
      itead studio iBoard
      NRF24L01+ (Added 4.7u Decoupling Capacitor, didn't make a difference)
      Version 1.5
      Sketch:

      /**
       * The MySensors Arduino library handles the wireless radio link and protocol
       * between your home built sensors/actuators and HA controller of choice.
       * The sensors forms a self healing radio network with optional repeaters. Each
       * repeater and gateway builds a routing tables in EEPROM which keeps track of the
       * network topology allowing messages to be routed to nodes.
       *
       * Created by Henrik Ekblad <henrik.ekblad@mysensors.org>
       * Copyright (C) 2013-2015 Sensnology AB
       * Full contributor list: https://github.com/mysensors/Arduino/graphs/contributors
       *
       * Documentation: http://www.mysensors.org
       * Support Forum: http://forum.mysensors.org
       *
       * This program is free software; you can redistribute it and/or
       * modify it under the terms of the GNU General Public License
       * version 2 as published by the Free Software Foundation.
       *
       *******************************
       *
       * REVISION HISTORY
       * Version 1.0 - Henrik EKblad
       * Contribution by a-lurker and Anticimex, 
       * Contribution by Norbert Truchsess <norbert.truchsess@t-online.de>
       *
       * 
       * DESCRIPTION
       * The EthernetGateway sends data received from sensors to the ethernet link. 
       * The gateway also accepts input on ethernet interface, which is then sent out to the radio network.
       *
       * The GW code is designed for Arduino 328p / 16MHz.  ATmega168 does not have enough memory to run this program.
       * 
       *
       * COMPILING WIZNET (W5100) ETHERNET MODULE
       * > Edit MyConfig.h in (libraries\MySensors\) to enable softspi (remove // before "#define SOFTSPI").
       *
       * COMPILING ENC28J60 ETHERNET MODULE
       * > Use Arduino IDE 1.5.7 (or later) 
       * > Disable DEBUG in Sensor.h before compiling this sketch. Othervise the sketch will probably not fit in program space when downloading. 
       * > Remove Ethernet.h include below and include UIPEthernet.h 
       * > Remove DigitalIO include 
       * Note that I had to disable UDP and DHCP support in uipethernet-conf.h to reduce space. (which means you have to choose a static IP for that module)
       *
       * VERA CONFIGURATION:
       * Enter "ip-number:port" in the ip-field of the Arduino GW device. This will temporarily override any serial configuration for the Vera plugin. 
       * E.g. If you want to use the defualt values in this sketch enter: 192.168.178.66:5003
       *
       * LED purposes:
       * - To use the feature, uncomment WITH_LEDS_BLINKING in MyConfig.h
       * - RX (green) - blink fast on radio message recieved. In inclusion mode will blink fast only on presentation recieved
       * - TX (yellow) - blink fast on radio message transmitted. In inclusion mode will blink slowly
       * - ERR (red) - fast blink on error during transmission error or recieve crc error  
       * 
       * See http://www.mysensors.org/build/ethernet_gateway for wiring instructions.
       *
       */
      #define NO_PORTB_PINCHANGES 
      
      #include <DigitalIO.h>     // This include can be removed when using UIPEthernet module  
      #include <SPI.h>  
      
      #include <MySigningNone.h>
      #include <MyTransportRFM69.h>
      #include <MyTransportNRF24.h>
      #include <MyHwATMega328.h>
      #include <MySigningAtsha204Soft.h>
      #include <MySigningAtsha204.h>
      
      #include <MyParserSerial.h>  
      #include <MySensor.h>  
      #include <stdarg.h>
      #include <PinChangeInt.h>
      #include "GatewayUtil.h"
      
      
      // Use this if you have attached a Ethernet ENC28J60 shields  
      // #include <UIPEthernet.h>  
      
      // Use this for WizNET W5100 module and Arduino Ethernet Shield 
      #include <Ethernet.h>   
      
      
      #define INCLUSION_MODE_TIME 1 // Number of minutes inclusion mode is enabled
      #define INCLUSION_MODE_PIN  3 // Digital pin used for inclusion mode button
      
      #define RADIO_CE_PIN        3  // radio chip enable
      #define RADIO_SPI_SS_PIN    8  // radio SPI serial select
      
      #define RADIO_ERROR_LED_PIN 7  // Error led pin
      #define RADIO_RX_LED_PIN    6  // Receive led pin
      #define RADIO_TX_LED_PIN    9  // the PCB, on board LED
      
      
      // NRFRF24L01 radio driver (set low transmit power by default) 
      MyTransportNRF24 transport(RADIO_CE_PIN, RADIO_SPI_SS_PIN, RF24_PA_LEVEL_GW);  
      //MyTransportRFM69 transport;
      
      // Message signing driver (signer needed if MY_SIGNING_FEATURE is turned on in MyConfig.h)
      //MySigningNone signer;
      //MySigningAtsha204Soft signer;
      //MySigningAtsha204 signer;
      
      // Hardware profile 
      MyHwATMega328 hw;
      
      // Construct MySensors library (signer needed if MY_SIGNING_FEATURE is turned on in MyConfig.h)
      // To use LEDs blinking, uncomment WITH_LEDS_BLINKING in MyConfig.h
      #ifdef WITH_LEDS_BLINKING
      MySensor gw(transport, hw /*, signer*/, RADIO_RX_LED_PIN, RADIO_TX_LED_PIN, RADIO_ERROR_LED_PIN);
      #else
      MySensor gw(transport, hw /*, signer*/);
      #endif
      
      
      #define IP_PORT 5003        // The port you want to open 
      IPAddress myIp (192, 168, 2, 62);  // Configure your static ip-address here    COMPILE ERROR HERE? Use Arduino IDE 1.5.7 or later!
      
      // The MAC address can be anything you want but should be unique on your network.
      // Newer boards have a MAC address printed on the underside of the PCB, which you can (optionally) use.
      // Note that most of the Ardunio examples use  "DEAD BEEF FEED" for the MAC address.
      byte mac[] = { 0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0xED };  // DEAD BEEF FEED
      
      // a R/W server on the port
      EthernetServer server = EthernetServer(IP_PORT);
      // handle to open connection
      EthernetClient client = EthernetClient();
      
      char inputString[MAX_RECEIVE_LENGTH] = "";    // A string to hold incoming commands from serial/ethernet interface
      int inputPos = 0;
      bool sentReady = false;
      
      void output(const char *fmt, ... ) {
         va_list args;
         va_start (args, fmt );
         vsnprintf_P(serialBuffer, MAX_SEND_LENGTH, fmt, args);
         va_end (args);
         Serial.print(serialBuffer);
         server.write(serialBuffer);
      }
      
      void setup()  
      { 
        Ethernet.begin(mac, myIp);
      
        setupGateway(INCLUSION_MODE_PIN, INCLUSION_MODE_TIME, output);
      
        // Add interrupt for inclusion button to pin
        PCintPort::attachInterrupt(pinInclusion, startInclusionInterrupt, RISING);
      
        // give the Ethernet interface a second to initialize
        delay(1000);
      
        // Initialize gateway at maximum PA level, channel 70 and callback for write operations 
        gw.begin(incomingMessage, 0, true, 0);
      
        
        // start listening for clients
        server.begin();
      
      }
      
      
      void loop() {
        gw.process();  
        
        checkButtonTriggeredInclusion();
        checkInclusionFinished();
        
        // if an incoming client connects, there will be
        // bytes available to read via the client object
        EthernetClient newclient = server.available();
        // if a new client connects make sure to dispose any previous existing sockets
        if (newclient) {
            if (client != newclient) {
             client.stop();
             client = newclient;
             output(PSTR("0;0;%d;0;%d;Gateway startup complete.\n"),  C_INTERNAL, I_GATEWAY_READY);
           }
         }
              
         if (client) {
           if (!client.connected()) {
             client.stop();
           } else if (client.available()) { 
             // read the bytes incoming from the client
             char inChar = client.read();
             if (inputPos<MAX_RECEIVE_LENGTH-1) { 
               // if newline then command is complete
               if (inChar == '\n') {  
                 Serial.println("Finished");
                  // a command was issued by the client
                  // we will now try to send it to the actuator
                  inputString[inputPos] = 0;
            
                  // echo the string to the serial port
                  Serial.print(inputString);
            
                  parseAndSend(gw, inputString);
            
                  // clear the string:
                  inputPos = 0;
               } else {  
                 // add it to the inputString:
                 inputString[inputPos] = inChar;
                 inputPos++;
               }
            } else {
               // Incoming message too long. Throw away 
               inputPos = 0;
            }
          }
        }
      }
      
      

      Sensor:
      Arduino Nano
      NRF24L01+ (Added 4.7u Decoupling Capacitor)
      Dallas Waterproof Temperature Sensor
      DHT II (temp/humidity)
      AC/DC Converter - https://www.itead.cc/power/ac-dc-power-module-5v-700ma-v2.html
      Sketch:

      #include <SPI.h>
      #include <MySensor.h>  
      #include <DHT.h>
      #include <DallasTemperature.h>
      #include <OneWire.h>
      
      #define CHILD_ID_HUM 1
      #define CHILD_ID_TEMP 2
      #define CHILD_ID_HTTEMP 3
      #define HUMIDITY_SENSOR_DIGITAL_PIN 3
      //Waterproof Sensor addition
      #define ONE_WIRE_BUS 4 //Pin where waterproof temp sensor is connected
      #define MAX_ATTACHED_DS18B20 16
      unsigned long SLEEP_TIME = 30000; // Sleep time between reads (in milliseconds)
      OneWire oneWire(ONE_WIRE_BUS);
      DallasTemperature sensors(&oneWire);
      
      MySensor gw;
      DHT dht;
      float lastTemperature[MAX_ATTACHED_DS18B20];
      int numSensors=0;
      boolean receivedConfig = false;
      float lastTemp;
      float lastHum;
      boolean metric = false; 
      MyMessage msgHum(CHILD_ID_HUM, V_HUM);
      MyMessage msgHumLCD(CHILD_ID_HUM, V_HUM);
      MyMessage msgTemp(CHILD_ID_TEMP, V_TEMP);
      MyMessage msgTempLCD(CHILD_ID_TEMP, V_TEMP);
      MyMessage msgHTTemp(CHILD_ID_HTTEMP, V_TEMP);
      MyMessage msgHTTempLCD(CHILD_ID_HTTEMP, V_TEMP);
      
      void setup()  
      { 
        // Startup OneWire
        sensors.begin();
      
        gw.begin();
        dht.setup(HUMIDITY_SENSOR_DIGITAL_PIN); 
        //Send Child Sensors to node 11
        msgHumLCD.setDestination(11);
        msgTempLCD.setDestination(11);
        msgHTTempLCD.setDestination(11);
      
        // Send the Sketch Version Information to the Gateway
        gw.sendSketchInfo("Hot Tub Monitor", "2.4");
      
        // Fetch the number of attached temperature sensors
        numSensors = sensors.getDeviceCount();
      
        // Present all sensors to controller
        for (int i=0; i<numSensors && i<MAX_ATTACHED_DS18B20; i++) {
          gw.present(i, S_TEMP);
        }
      
        // Register all sensors to gw (they will be created as child devices)
        gw.present(CHILD_ID_HUM, S_HUM);
        gw.present(CHILD_ID_TEMP, S_TEMP);
      
        metric = gw.getConfig().isMetric;
      }
      
      void loop()      
      {  
        // Process incoming messages (like config from server)
        gw.process();
      
        //Fetch temperatures from Dallas sensors
        sensors.requestTemperatures();
      
        // Red temperatures and send them to the controller
        for (int i=0; i<numSensors && i<MAX_ATTACHED_DS18B20; i++) {
      
          // Fetch and round temperature to one decimal
          float temperature = static_cast<float>(static_cast<int>((sensors.getTempFByIndex(i)) * 10.)) / 10.;
      
          //Only send data if temperature has changed and no error
          if (lastTemperature[i] != temperature && temperature != -127.00) {
      
            // Send in the new temperature
            delay(100);
            gw.send(msgHTTemp.setSensor(i).set(temperature,1));
            gw.send(msgHTTempLCD.set(static_cast<int>(temperature)));
            Serial.print("T2: ");
            Serial.println(temperature);
            lastTemperature[i]=temperature;
          }
        }
      
        delay(dht.getMinimumSamplingPeriod());
      
        //float temperature = dht.getTemperature();
        float temperature = dht.getTemperature()*9/5 + 32;
        if (isnan(temperature)) {
          Serial.println("Failed reading temperature from DHT");
        } 
        else if (temperature != lastTemp) {
          lastTemp = temperature;
          if (!metric) {
            //temperature = dht.toFahrenheit(temperature);
            temperature = dht.getTemperature()*9/5 + 32;
          }
          delay(100);
          gw.send(msgTemp.set(temperature, 1));
          gw.send(msgTempLCD.set(static_cast<int>(temperature)));
          Serial.print("T: ");
          Serial.println(temperature);
        }
      
        float humidity = dht.getHumidity();
        if (isnan(humidity)) {
          Serial.println("Failed reading humidity from DHT");
        } 
        else if (humidity != lastHum) {
          lastHum = humidity;
          delay(100);
          gw.send(msgHum.set(humidity, 1));
          gw.send(msgHumLCD.set(static_cast<int>(humidity)));
          Serial.print("H: ");
          Serial.println(humidity);
        }
      
        gw.sleep(SLEEP_TIME); //sleep a bit
      }
      

      Debug Log from Sensor:

      send: 1-1-0-0 s=255,c=0,t=17,pt=0,l=5,sg=0,st=fail:1.5.1
      send: 1-1-0-0 s=255,c=3,t=6,pt=1,l=1,sg=0,st=fail:0
      sensor started, id=1, parent=0, distance=1
      send: 1-1-0-0 s=255,c=3,t=11,pt=0,l=15,sg=0,st=fail:Hot Tub Monitor
      send: 1-1-0-0 s=255,c=3,t=12,pt=0,l=3,sg=0,st=fail:2.4
      send: 1-1-0-0 s=0,c=0,t=6,pt=0,l=0,sg=0,st=fail:
      send: 1-1-0-0 s=1,c=0,t=7,pt=0,l=0,sg=0,st=fail:
      find parent
      send: 1-1-255-255 s=255,c=3,t=7,pt=0,l=0,sg=0,st=bc:
      send: 1-1-0-0 s=2,c=0,t=6,pt=0,l=0,sg=0,st=fail:
      send: 1-1-0-0 s=0,c=1,t=0,pt=7,l=5,sg=0,st=fail:96.1
      send: 1-1-0-11 s=3,c=1,t=0,pt=2,l=2,sg=0,st=fail:96
      T2: 96.10
      send: 1-1-0-0 s=2,c=1,t=0,pt=7,l=5,sg=0,st=fail:71.6
      send: 1-1-0-11 s=2,c=1,t=0,pt=2,l=2,sg=0,st=fail:71
      T: 71.60
      send: 1-1-0-0 s=1,c=1,t=1,pt=7,l=5,sg=0,st=fail:39.0
      find parent
      send: 1-1-255-255 s=255,c=3,t=7,pt=0,l=0,sg=0,st=bc:
      send: 1-1-0-11 s=1,c=1,t=1,pt=2,l=2,sg=0,st=fail:39
      H: 39.00
      
      

      I have changed the wireless channel to 120, this didn't make any difference. I have also increased the power levels in myconfig.h to the following:

      #define RF24_PA_LEVEL 	   RF24_PA_MAX
      #define RF24_PA_LEVEL_GW   RF24_PA_MAX
      

      Didn't help so I then changed them to:

      #define RF24_PA_LEVEL 	   RF24_PA_HIGH
      #define RF24_PA_LEVEL_GW   RF24_PA_HIGH
      

      At this point I am not sure what to try. The sensor is inside of my Hot Tub Cabinet, doesn't have any metal around it but the signal does need to go around or through the 400 gallons of water.

      posted in Troubleshooting
      cleight
      cleight
    • Last Update Date

      Hello, I am running a Vera Lite running on UI5. Is it possible to somehow get the last update date along with the time? I have issues were sensors sometimes hang and I'm not sure exactly when the hang occured.

      posted in Vera
      cleight
      cleight
    • RE: Node to Node Communication

      @Chaotic Sorry for not getting back sooner on this, but I did confirm that your solution does indeed work and works very well. I can't wait to finish this project up and be able to post the Pictures/Sketch to share with the community.

      posted in Development
      cleight
      cleight
    • RE: Node to Node Communication

      Ok last issue to be worked out and I think I am good to go, thanks again to @Chaotic and @hek for there assistance with my project.

      Last issue is with the sensor node, it sends the data to the LCD Node (node 11) but only sends the data to the gateway on boot, it will not send it to the gateway after it starts sending to Node 11. I would like it to send to both the Node and the Gateway all the time, that way Vera see the information as well as my LCD.

      Here is the output of the Serial Monitor, also for some reason on each temp update it sends to node 11 twice for some reason:
      sensor started, id 1
      send: 1-1-0-0 s=255,c=0,t=17,pt=0,l=5,st=ok:1.4.1
      send: 1-1-0-0 s=255,c=3,t=6,pt=1,l=1,st=ok:0
      read: 0-0-1 s=255,c=3,t=6,pt=0,l=1:I
      send: 1-1-0-0 s=255,c=3,t=11,pt=0,l=15,st=ok:Hot Tub Monitor
      send: 1-1-0-0 s=255,c=3,t=12,pt=0,l=3,st=ok:2.0
      send: 1-1-0-0 s=0,c=0,t=6,pt=0,l=5,st=ok:1.4.1
      send: 1-1-0-0 s=1,c=0,t=7,pt=0,l=5,st=ok:1.4.1
      send: 1-1-0-0 s=2,c=0,t=6,pt=0,l=5,st=ok:1.4.1
      send: 1-1-0-0 s=0,c=1,t=0,pt=7,l=5,st=ok:67.2
      send: 1-1-0-11 s=0,c=1,t=0,pt=2,l=2,st=ok:67
      T2: 67.20
      send: 1-1-0-0 s=2,c=1,t=0,pt=7,l=5,st=ok:66.2
      T: 66.20
      send: 1-1-0-0 s=1,c=1,t=1,pt=7,l=5,st=ok:36.0
      send: 1-1-0-11 s=1,c=1,t=1,pt=2,l=2,st=ok:36
      H: 36.00
      send: 1-1-0-11 s=0,c=1,t=0,pt=7,l=5,st=ok:75.7
      send: 1-1-0-11 s=0,c=1,t=0,pt=2,l=2,st=ok:75
      T2: 75.70
      send: 1-1-0-11 s=0,c=1,t=0,pt=7,l=5,st=ok:80.1
      send: 1-1-0-11 s=0,c=1,t=0,pt=2,l=2,st=ok:80
      T2: 80.10
      send: 1-1-0-11 s=0,c=1,t=0,pt=7,l=5,st=ok:81.6
      send: 1-1-0-11 s=0,c=1,t=0,pt=2,l=2,st=ok:81
      T2: 81.60
      send: 1-1-0-11 s=0,c=1,t=0,pt=7,l=5,st=ok:81.7
      send: 1-1-0-11 s=0,c=1,t=0,pt=2,l=2,st=ok:81
      T2: 81.70
      send: 1-1-0-11 s=0,c=1,t=0,pt=7,l=5,st=ok:79.8
      send: 1-1-0-11 s=0,c=1,t=0,pt=2,l=2,st=ok:79
      T2: 79.80
      send: 1-1-0-11 s=0,c=1,t=0,pt=7,l=5,st=ok:78.1
      send: 1-1-0-11 s=0,c=1,t=0,pt=2,l=2,st=ok:78
      T2: 78.10
      send: 1-1-0-11 s=0,c=1,t=0,pt=7,l=5,st=ok:76.7
      send: 1-1-0-11 s=0,c=1,t=0,pt=2,l=2,st=ok:76
      T2: 76.70
      send: 1-1-0-11 s=0,c=1,t=0,pt=7,l=5,st=ok:75.5
      send: 1-1-0-11 s=0,c=1,t=0,pt=2,l=2,st=ok:75
      T2: 75.50

      Here is the sketch:

      #include <SPI.h>
      #include <MySensor.h>  
      #include <DHT.h>
      #include <DallasTemperature.h>
      #include <OneWire.h>
      
      #define CHILD_ID_HUM 1
      #define CHILD_ID_TEMP 2
      #define CHILD_ID_HTTEMP 3
      #define HUMIDITY_SENSOR_DIGITAL_PIN 3
      //Waterproof Sensor addition
      #define ONE_WIRE_BUS 4 //Pin where waterproof temp sensor is connected
      #define MAX_ATTACHED_DS18B20 16
      unsigned long SLEEP_TIME = 30000; // Sleep time between reads (in milliseconds)
      OneWire oneWire(ONE_WIRE_BUS);
      DallasTemperature sensors(&oneWire);
      
      MySensor gw;
      DHT dht;
      float lastTemperature[MAX_ATTACHED_DS18B20];
      int numSensors=0;
      boolean receivedConfig = false;
      float lastTemp;
      float lastHum;
      boolean metric = false; 
      MyMessage msgHum(CHILD_ID_HUM, V_HUM);
      MyMessage msgTemp(CHILD_ID_TEMP, V_TEMP);
      MyMessage msgHTTemp(CHILD_ID_HTTEMP, V_TEMP);
      
      void setup()  
      { 
        // Startup OneWire
        sensors.begin();
      
        gw.begin();
        dht.setup(HUMIDITY_SENSOR_DIGITAL_PIN); 
      
        // Send the Sketch Version Information to the Gateway
        gw.sendSketchInfo("Hot Tub Monitor", "2.0");
      
        // Fetch the number of attached temperature sensors
        numSensors = sensors.getDeviceCount();
      
        // Present all sensors to controller
        for (int i=0; i<numSensors && i<MAX_ATTACHED_DS18B20; i++) {
          gw.present(i, S_TEMP);
        }
      
        // Register all sensors to gw (they will be created as child devices)
        gw.present(CHILD_ID_HUM, S_HUM);
        gw.present(CHILD_ID_TEMP, S_TEMP);
      
        metric = gw.getConfig().isMetric;
      }
      
      void loop()      
      {  
        // Process incoming messages (like config from server)
        gw.process();
      
        //Fetch temperatures from Dallas sensors
        sensors.requestTemperatures();
      
        // Red temperatures and send them to the controller
        for (int i=0; i<numSensors && i<MAX_ATTACHED_DS18B20; i++) {
      
          // Fetch and round temperature to one decimal
          float temperature = static_cast<float>(static_cast<int>((sensors.getTempFByIndex(i)) * 10.)) / 10.;
      
          //Only send data if temperature has changed and no error
          if (lastTemperature[i] != temperature && temperature != -127.00) {
      
            // Send in the new temperature
            delay(100);
            gw.send(msgHTTemp.setSensor(i).set(temperature,1));
            gw.send(msgHTTemp.setDestination(11).set(static_cast<int>(temperature)));
            Serial.print("T2: ");
            Serial.println(temperature);
            lastTemperature[i]=temperature;
          }
        }
      
        delay(dht.getMinimumSamplingPeriod());
      
        //float temperature = dht.getTemperature();
        float temperature = dht.getTemperature()*9/5 + 32;
        if (isnan(temperature)) {
          Serial.println("Failed reading temperature from DHT");
        } 
        else if (temperature != lastTemp) {
          lastTemp = temperature;
          if (!metric) {
            //temperature = dht.toFahrenheit(temperature);
            temperature = dht.getTemperature()*9/5 + 32;
          }
          delay(100);
          gw.send(msgTemp.set(temperature, 1));
          Serial.print("T: ");
          Serial.println(temperature);
        }
      
        float humidity = dht.getHumidity();
        if (isnan(humidity)) {
          Serial.println("Failed reading humidity from DHT");
        } 
        else if (humidity != lastHum) {
          lastHum = humidity;
          delay(100);
          gw.send(msgHum.set(humidity, 1));
          gw.send(msgHum.setDestination(11).set(static_cast<int>(humidity)));
          Serial.print("H: ");
          Serial.println(humidity);
        }
      
        gw.sleep(SLEEP_TIME); //sleep a bit
      }
      
      posted in Development
      cleight
      cleight
    • RE: Node to Node Communication

      @Chaotic Thank you, I knew it had to be something simple.

      posted in Development
      cleight
      cleight
    • RE: Node to Node Communication

      @Chaotic I missed your code earlier, thank you for this, although while compiling is it saying I am missing a colon before knhum for some reason, need to dig deeper.

      posted in Development
      cleight
      cleight
    • RE: Node to Node Communication

      @hek said:

      declare the variable you're sending as int or convert it by casting

      gw.send (msgHum.set(static_cast<int>(humidity)));

      http://www.learncpp.com/cpp-tutorial/44-type-conversion-and-casting/

      @hek Converting my sensor to send the data as an Integer worked and it is now parsing correctly, however I also have a humidity child sensor on that node I would like to send to node 11 as well, how would I capture that in the case statement?

      posted in Development
      cleight
      cleight
    • RE: Node to Node Communication

      @hek How do I send it as an integer?

      posted in Development
      cleight
      cleight
    • RE: Node to Node Communication

      @hek said:

      @cleight said:

      gw.begin();

      You forgot to initialize begin like you were told above.

      I have this in my gateway.begin

      gw.begin(getVariables, RADIO_ID);
      

      I seem to need to have it this way or Vera doesn't get Node ID 11 anymore and it gets a random generated ID. So then I put the Case statement at the bottom of my getVariables Function.

      posted in Development
      cleight
      cleight
    • RE: Node to Node Communication

      @hek This is the code I am using on the sensor side to send to LCD Node (Node 11)

      gw.send(msgHTTemp.setDestination(11).setSensor(i).set(temperature,1));
      

      And in serial monitor on node 11 I see the data being captured correctly, so I believe my issue still lies in my code on the LCD Screen side.

      read: 1-0-11 s=0,c=1,t=0,pt=7,l=5:66.2

      Here is my latest Sketch after I made changes again per Hek's suggestion, only thing is I couldn't use float as I am out of room in my sketch to hard to use INT instead for testTemp

      #define STATES 9
      #define HUMIDITY_SENSOR_DIGITAL_PIN 4
      #define DEBUG
      
      #ifdef DEBUG
      #define DEBUG_SERIAL(x) Serial.begin(x)
      #define DEBUG_PRINT(x) Serial.print(x)
      #define DEBUG_PRINTLN(x) Serial.println(x)
      #else
      #define DEBUG_SERIAL(x)
      #define DEBUG_PRINT(x) 
      #define DEBUG_PRINTLN(x) 
      #endif
      
      #include <avr/pgmspace.h>
      #include <Wire.h>
      #include <Time.h>
      #include <SPI.h>
      #include <MySensor.h>
      #include <LiquidCrystal_I2C.h>
      #include <DS3232RTC.h> 
      //
      #define RADIO_ID 11
      #define CHILD_ID_SCENE 3
      #define CHILD_ID_LED 4
      #define BACKLIGHT 6 //available PWM capable pin
      //Define Additional Nodes that I would like to pull data from
      #define HOTTUB_NODE_ID 1
      //
      LiquidCrystal_I2C lcd(0x27, 2, 1, 0, 4, 5, 6, 7, 3, POSITIVE);  // set the LCD address to 0x27 for a 16 chars and 2 line display
      //
      void (*lcdDisplay[STATES])();
      //
      byte state = 0;
      byte lastState;
      byte timeCounter = 0;
      int ledStatus = 1;// to toggle LCD backlight led
      int ledLevel = 254;
      unsigned long lastTime;
      unsigned long refreshInterval = 3000UL;
      unsigned long lastClockSet;
      boolean isMessage = false;
      float insideTemperature;
      float humidity;
      int OutdoorTemp = -99;
      int OutdoorHumidity = -99;
      int todayHigh = -99; 
      int todayLow = -99;
      int HotTubTemp = -99;
      int KWH = -99;
      int testTemp = -99;
      String conditions = "Not yet Reported";
      String tomorrowWeather = "Not yet Reported";
      String messageOfTheDay = "**Hello There!**";
      String AlarmStatus = "No Data";
      unsigned long motdTimer;
      boolean buttonPushed = false;
      //
      MySensor gw;
      //
      MyMessage msgOn(CHILD_ID_SCENE, V_SCENE_ON);
      MyMessage msgOff(CHILD_ID_SCENE, V_SCENE_OFF);
      MyMessage msgVAR1(CHILD_ID_SCENE, V_VAR1);// outdoor temperature
      MyMessage msgVAR2(CHILD_ID_SCENE, V_VAR2);// outdoor humidity
      MyMessage msgVAR3(CHILD_ID_SCENE, V_VAR3);//today's low
      MyMessage msgVAR4(CHILD_ID_SCENE, V_VAR4);// today's high
      MyMessage msgVAR5(CHILD_ID_SCENE, V_VAR5);//conditions
      //
      MyMessage lightMsg(CHILD_ID_LED, V_DIMMER);
      MyMessage msgMOTD(CHILD_ID_LED, V_VAR1); // Hot Tub KWH
      MyMessage msgAlarm(CHILD_ID_LED, V_VAR2); // Tomorrow Forecast
      MyMessage msgBrite(CHILD_ID_LED, V_VAR3); 
      MyMessage msgHTTemp(CHILD_ID_LED, V_VAR4); // Hot Tub Temp
      MyMessage msgALARMSTATUS (CHILD_ID_LED, V_VAR5);// Alarm System Status
      void setup()  
      { 
        DEBUG_SERIAL(115200);
        DEBUG_PRINTLN(F("Serial started"));
        //
        lcdDisplay[0] = lcdDisplay0;
        lcdDisplay[1] = lcdDisplay1;
        lcdDisplay[2] = lcdDisplay2;
        lcdDisplay[3] = lcdDisplay3;
        lcdDisplay[4] = lcdDisplay4;
        lcdDisplay[5] = lcdDisplay5;
        lcdDisplay[6] = lcdDisplay6;
        lcdDisplay[7] = lcdDisplay7;
        lcdDisplay[8] = lcdDisplay8;
        //
        pinMode(BACKLIGHT, OUTPUT);
        gw.begin(getVariables, RADIO_ID);
        //gw.begin(NULL, AUTO, true);
        gw.sendSketchInfo("Home Status Panel", "2.1");
        setSyncProvider (RTC.get);
        gw.present(CHILD_ID_SCENE, S_SCENE_CONTROLLER);
        gw.present( CHILD_ID_LED, S_DIMMER);
        //
        analogWrite(BACKLIGHT, 200); //LCD Backlight
        //
        lcd.begin(20,4);
        lcd.clear();
        lcd.backlight();
        lcd.setCursor(0, 0);
        lcd.print("Syncing Time");
        lcd.setCursor(0, 1);
        int clockCounter = 0;
        while(timeStatus() == timeNotSet && clockCounter < 60)
        {
          gw.process();
          gw.requestTime(receiveTime);
          Serial.println("getting Time");
          delay(1000);
          lcd.print(".");
          clockCounter++;
          if (clockCounter > 16)
          {
            lcd.clear();
            lcd.print(F("**Failed Clock**"));
            lcd.setCursor(0,1);
            lcd.print(F("*Syncronization*"));
            delay(2000);
            break;
          }
        }
        lcd.clear();
        lastTime = millis();
      }
      void loop()      
      {
        gw.process();
        if (millis() - lastClockSet >= 60000UL)
        {
          gw.requestTime(receiveTime);
          lastClockSet = millis();
        }
        if (millis() - lastTime >= refreshInterval)
        {
          state++;
          if (state > STATES - 1) state = 0;
          DEBUG_PRINTLN(F("State:")); 
          DEBUG_PRINTLN(state);
          lastTime += refreshInterval;
          getTempHumidity();
        }
        if (state != lastState) 
        {
          fastClear();
          lcdDisplay[state]();
        }
        lastState = state;
        if (isMessage)
        {
          if (millis() - motdTimer > 86400 * 1000UL)
          {
            isMessage = false;
          }
        }
      }
      void fastClear() //Clear LCD Screen
      {
        lcd.setCursor(0,0);
        lcd.clear();
        lcd.setCursor(0,1);
        lcd.clear();
        lcd.setCursor(0,2);
        lcd.clear();
        lcd.setCursor(0,3);
        lcd.clear();
      }
      //
      void lcdDisplay0()
      {
        lcd.setCursor(0,0);
        lcd.print(F("Time: "));
        if (hourFormat12() < 10) lcd.print("0");
        lcd.print(hourFormat12());
        lcd.print(":");
        if (minute() < 10) lcd.print("0");
        lcd.print(minute());
        if (isAM()) lcd.print(F("am"));
        else lcd.print(F("pm"));
        DEBUG_PRINT(F("Time:"));
        DEBUG_PRINTLN(hourFormat12());
        lcd.setCursor(0,1);
        lcd.print(F("Date: "));
        if (month() < 10) lcd.print("0");
        lcd.print(month());
        lcd.print("/");
        if (day() < 10) lcd.print("0");
        lcd.print(day());
        lcd.print("/");
        lcd.print(year());
        DEBUG_PRINTLN(F("Date: ")); 
        DEBUG_PRINT(month()); 
        DEBUG_PRINT("/"); 
        DEBUG_PRINT(day()); 
        DEBUG_PRINT("/"); 
        DEBUG_PRINTLN(year());
      }
      void lcdDisplay1()
      {
        lcd.setCursor(0,0);
        lcd.print(F(" Indoor Temp:"));
        lcd.print(int(round(insideTemperature)));
        lcd.print(char(223));
        DEBUG_PRINT(F("Indoor Temp:")); 
        DEBUG_PRINT(int(round(insideTemperature))); 
        DEBUG_PRINTLN(F("F"));
       }
      void lcdDisplay2()
      {
        lcd.setCursor(0,0);
        lcd.print("Outdoor Temp:"); 
        lcd.print(OutdoorTemp); 
        lcd.print(char(223));
        DEBUG_PRINT(F("Outdoor Temp:"));
        DEBUG_PRINTLN(OutdoorTemp);
        lcd.setCursor(0,1);
        lcd.print(F("    Humidity:")); 
        lcd.print(OutdoorHumidity); 
        lcd.print(F("%"));
        DEBUG_PRINT(F("    Humidity:"));
        DEBUG_PRINTLN(OutdoorHumidity);
      }
      void lcdDisplay3()
      {
        lcd.setCursor(0,0);
        lcd.print(F("Today's High:"));
        lcd.print(todayHigh); 
        lcd.print(char(223));
        DEBUG_PRINT(F("Today's High: "));
        DEBUG_PRINTLN(todayHigh);
        lcd.setCursor(0,1);
        lcd.print(F("         Low:"));
        lcd.print(todayLow); 
        lcd.print(char(223));
        DEBUG_PRINT(F("Today's Low: "));
        DEBUG_PRINTLN(todayLow);
      }
      void lcdDisplay4()
      {
        lcd.setCursor(0,0);
        lcd.print(F("Today's Weather"));
        DEBUG_PRINTLN(F("Today's Weather: "));
        lcd.setCursor(0,1);
        lcd.print(conditions);
        DEBUG_PRINTLN(conditions);
      }
      void lcdDisplay5()
      {
        lcd.setCursor(0,0);
        lcd.print(F("Forcast Tomorrow"));
        DEBUG_PRINTLN(F("Tomorrow's Forecast: "));
        lcd.setCursor(0,1);
        lcd.print(tomorrowWeather);
        DEBUG_PRINTLN(tomorrowWeather);
      }
      void lcdDisplay6()
      {
        if (isMessage)
        {
          lcd.setCursor(0,0);
          lcd.print(F("**NEW  MESSAGE**"));
          DEBUG_PRINTLN(F("****Message****"));
          lcd.setCursor(0,1);
          lcd.print(messageOfTheDay);
          DEBUG_PRINTLN(messageOfTheDay);
          motdTimer = millis();
        }
        else
        {
          lcd.setCursor(0,0);
          lcd.print(F("****Welcome!****"));
          DEBUG_PRINTLN(F("****Message****"));
          lcd.setCursor(0,1);
          lcd.print(F("Have a Nice Day!"));
          DEBUG_PRINTLN(F("Have a Nice Day"));
        }
      }
      void lcdDisplay7()
      {
        lcd.setCursor(0,1);
        lcd.print("Alarm Status:");  
        DEBUG_PRINT("Alarm Status:");
        DEBUG_PRINTLN(AlarmStatus);
        lcd.setCursor(0,2);
        lcd.print(AlarmStatus);
      }
      void lcdDisplay8()
      {
        lcd.setCursor(0,0);
        lcd.print("Hot Tub KWH:");
        lcd.print(KWH);
        DEBUG_PRINT("Hot Tub KWH:");
        DEBUG_PRINTLN(KWH);
        lcd.setCursor(0,1);
        lcd.print(F(" Hot Tub:"));
        lcd.print(HotTubTemp);
        lcd.print(char(223));
        DEBUG_PRINT(F("Hot Tub:"));
        DEBUG_PRINT(HotTubTemp);
        DEBUG_PRINT(F("F"));
        lcd.setCursor(3,0);
        lcd.print("Test Temp:");
        lcd.print(testTemp);
        lcd.print(char(223));
        DEBUG_PRINT(F("Test Temp:"));
        DEBUG_PRINTLN(testTemp);
      }
      //
      void getTempHumidity()
      {
        insideTemperature = ((RTC.temperature()/4*9/5 + 32));
        if (isnan(insideTemperature)) 
        {
          DEBUG_PRINTLN(F("Failed reading temperature from RTC"));
        } 
      }
      //
      void receiveTime(unsigned long controllerTime)
      {
        // Ok, set imcoming time
        DEBUG_PRINTLN(F("Time value received: "));
        DEBUG_PRINTLN(controllerTime);
        RTC.set(controllerTime);
        controllerTime = true;
      }
      //
      void getVariables(const MyMessage &message)
      {
        if (message.sensor == CHILD_ID_SCENE)
        { 
          if (message.type == V_VAR1) //Outdoor temp pulled from Weather Underground Vera Plugin
          {
            OutdoorTemp = atoi(message.data);
            DEBUG_PRINTLN(F("OutdoorTemp recieved:"));
            DEBUG_PRINTLN(OutdoorTemp);
          }
          if (message.type == V_VAR2) //Outdoor Humidity pulled from Weather Underground Vera Plugin
          {
            OutdoorHumidity = atoi(message.data);
            DEBUG_PRINT(F("OutdoorHumidity recieved:"));
            DEBUG_PRINTLN(OutdoorHumidity);
          }
          if (message.type == V_VAR3) //pulled from Weather Underground Vera Plugin
          {
            todayLow = atoi(message.data);
            DEBUG_PRINT(F("Received Today's LOW:"));
            DEBUG_PRINTLN(todayLow);
          }
      
          if (message.type == V_VAR4) //pulled from Weather Underground Vera Plugin
          {
            todayHigh = atoi(message.data);
            DEBUG_PRINT(F("Received Today's HIGH:"));
            DEBUG_PRINTLN(todayHigh);
          }
          if (message.type == V_VAR5) //pulled from Weather Underground Vera Plugin
          {
            String newMessage = String(message.data);
            int locator = newMessage.indexOf("@");
            newMessage = newMessage.substring(0, locator);
            conditions = newMessage;
            DEBUG_PRINT(F("Received today's Conditions:"));
            DEBUG_PRINTLN(conditions);
          }
        }
          if (message.sensor == CHILD_ID_LED)
        {
          if (message.type == V_DIMMER) //Set LCD Brightness from Dimmer Device in Vera
          {
            ledLevel = message.getByte();
            		lcd.setBacklight(ledLevel);
      		Serial.print("Brightness Level recieved:");
      		Serial.println(ledLevel);
                      analogWrite(BACKLIGHT, (int)(ledLevel / 100. * 255) );                
          }
          if (message.type == V_VAR1) //Hot Tub KWN Hours
          {
            KWH = atoi(message.data);
            DEBUG_PRINT("Hot Tub KWH recieved:");
            DEBUG_PRINTLN(KWH);
          }
          if (message.type == V_VAR2) //pulled from Weather Underground Vera Plugin
          {
            // Extended Forecast
            String newMessage = String(message.data);
            int locator = newMessage.indexOf("@");
            newMessage = newMessage.substring(0, locator);
            tomorrowWeather = newMessage;
            DEBUG_PRINT(F("Received Two Day Forecast:"));
            DEBUG_PRINTLN(tomorrowWeather);
          }
          if (message.type == V_VAR3) //Not sure what this will be used for just yet
          {
            // message of the day
            String newMessage = String(message.data);
            int locator = newMessage.indexOf("@");
            newMessage = newMessage.substring(0, locator);
            messageOfTheDay = newMessage;
            DEBUG_PRINT(F("Received Message of the Day:"));
            DEBUG_PRINTLN(messageOfTheDay);
            isMessage = true;
          }
          if (message.type == V_VAR4) //Hot Tub Temp from Vera which comes from an Arduino
          {
            HotTubTemp = atoi(message.data);
            DEBUG_PRINT(F("Received HotTubTemp:"));
            DEBUG_PRINTLN(HotTubTemp);
          }
          if (message.type == V_VAR5) //Check on Alarm status
          {
          String newMessage = String(message.data);
            int locator = newMessage.indexOf("@");
            newMessage = newMessage.substring(0, locator);
            AlarmStatus = newMessage;
            DEBUG_PRINT(F("Received Alarm Status:"));
            DEBUG_PRINTLN(AlarmStatus); 
          } 
        }
         switch (message.sender) {
              case HOTTUB_NODE_ID:
                   testTemp = atoi(message.data);
                   break;
            }
      }
      

      Node ID 1 - Temperature Sensor that is sending to Node 11 (LCD Screen)

      #include <SPI.h>
      #include <MySensor.h>  
      #include <DHT.h>
      #include <DallasTemperature.h>
      #include <OneWire.h>
      
      #define CHILD_ID_HUM 1
      #define CHILD_ID_TEMP 2
      #define CHILD_ID_HTTEMP 3
      #define HUMIDITY_SENSOR_DIGITAL_PIN 3
      //Waterproof Sensor addition
      #define ONE_WIRE_BUS 4 //Pin where waterproof temp sensor is connected
      #define MAX_ATTACHED_DS18B20 16
      unsigned long SLEEP_TIME = 30000; // Sleep time between reads (in milliseconds)
      OneWire oneWire(ONE_WIRE_BUS);
      DallasTemperature sensors(&oneWire);
      
      MySensor gw;
      DHT dht;
      float lastTemperature[MAX_ATTACHED_DS18B20];
      int numSensors=0;
      boolean receivedConfig = false;
      float lastTemp;
      float lastHum;
      boolean metric = false; 
      MyMessage msgHum(CHILD_ID_HUM, V_HUM);
      MyMessage msgTemp(CHILD_ID_TEMP, V_TEMP);
      MyMessage msgHTTemp(CHILD_ID_HTTEMP, V_TEMP);
      
      void setup()  
      { 
        // Startup OneWire
        sensors.begin();
      
        gw.begin();
        dht.setup(HUMIDITY_SENSOR_DIGITAL_PIN); 
      
        // Send the Sketch Version Information to the Gateway
        gw.sendSketchInfo("Hot Tub Monitor", "2.0");
      
        // Fetch the number of attached temperature sensors
        numSensors = sensors.getDeviceCount();
      
        // Present all sensors to controller
        for (int i=0; i<numSensors && i<MAX_ATTACHED_DS18B20; i++) {
          gw.present(i, S_TEMP);
        }
      
        // Register all sensors to gw (they will be created as child devices)
        gw.present(CHILD_ID_HUM, S_HUM);
        gw.present(CHILD_ID_TEMP, S_TEMP);
      
        metric = gw.getConfig().isMetric;
      }
      
      void loop()      
      {  
        // Process incoming messages (like config from server)
        gw.process();
      
        //Fetch temperatures from Dallas sensors
        sensors.requestTemperatures();
      
        // Red temperatures and send them to the controller
        for (int i=0; i<numSensors && i<MAX_ATTACHED_DS18B20; i++) {
      
          // Fetch and round temperature to one decimal
          float temperature = static_cast<float>(static_cast<int>((sensors.getTempFByIndex(i)) * 10.)) / 10.;
      
          //Only send data if temperature has changed and no error
          if (lastTemperature[i] != temperature && temperature != -127.00) {
      
            // Send in the new temperature
            delay(100);
            gw.send(msgHTTemp.setSensor(i).set(temperature,1));
            gw.send(msgHTTemp.setDestination(11).setSensor(i).set(temperature,1));
            Serial.print("T2: ");
            Serial.println(temperature);
            lastTemperature[i]=temperature;
          }
        }
      
        delay(dht.getMinimumSamplingPeriod());
      
        //float temperature = dht.getTemperature();
        float temperature = dht.getTemperature()*9/5 + 32;
        if (isnan(temperature)) {
          Serial.println("Failed reading temperature from DHT");
        } 
        else if (temperature != lastTemp) {
          lastTemp = temperature;
          if (!metric) {
            //temperature = dht.toFahrenheit(temperature);
            temperature = dht.getTemperature()*9/5 + 32;
          }
          delay(100);
          gw.send(msgTemp.set(temperature, 1));
          Serial.print("T: ");
          Serial.println(temperature);
        }
      
        float humidity = dht.getHumidity();
        if (isnan(humidity)) {
          Serial.println("Failed reading humidity from DHT");
        } 
        else if (humidity != lastHum) {
          lastHum = humidity;
          delay(100);
          gw.send(msgHum.set(humidity, 1));
          Serial.print("H: ");
          Serial.println(humidity);
        }
      
        gw.sleep(SLEEP_TIME); //sleep a bit
      }
      
      posted in Development
      cleight
      cleight
    • RE: Node to Node Communication

      @Chaotic I understand what you are saying and have the concept down of the message being sent to the gateway. What I don't understand is the code that Hek provided and how I seperate Node ID 1 Child Sensor 0 (temp Sensor) from Node ID 1 Child Sensor 1 (Humidity Sensor)

      Also I tried the code Hek provided but I cannot use Float to store the variable as I am out of room in my sketch, I tried changing to message.getInt(); without luck.

      posted in Development
      cleight
      cleight
    • RE: Node to Node Communication

      @hek Thank you for the example, one thing I am still confused on though is if all my nodes have child ID's of 0 and 1 that the code you presented above doesn't care about the Child sensor only the Node ID correct?

      @Chaotic: I have read the API documentation about 100 times and I don't correlate it to what I want, I unfortunately do not have a programming background and what I have learned so far is by other users examples or trial and error.

      posted in Development
      cleight
      cleight
    • RE: Node to Node Communication

      @Chaotic I understand what your saying as well as what @AWI is saying but I don't think everyone understands what I am trying to do. I would like to capture several node's child sensors data and use it on my LCD Screen to show me instant status of sensors. If I use code like the relay example how do I tell it which node and child sensor I want to capture the data from?

      void incomingMessage(const MyMessage &message) {
            if (message.type == V_TEMP)
            {
              testTemp = atoi(message.data);
            DEBUG_PRINTLN(F("Test Temp recieved:"));
            DEBUG_PRINTLN(testTemp);
            }
        }
      

      ^That code, per the relay sketch example doesn't allow me to specify I want data from Node 1, Child Sensor 0.

      Here is my full sketch I am currently working on:

      #define STATES 9
      #define HUMIDITY_SENSOR_DIGITAL_PIN 4
      #define DEBUG
      
      #ifdef DEBUG
      #define DEBUG_SERIAL(x) Serial.begin(x)
      #define DEBUG_PRINT(x) Serial.print(x)
      #define DEBUG_PRINTLN(x) Serial.println(x)
      #else
      #define DEBUG_SERIAL(x)
      #define DEBUG_PRINT(x) 
      #define DEBUG_PRINTLN(x) 
      #endif
      
      #include <avr/pgmspace.h>
      #include <Wire.h>
      #include <Time.h>
      #include <SPI.h>
      #include <MySensor.h>
      #include <LiquidCrystal_I2C.h>
      #include <DS3232RTC.h> 
      //
      #define RADIO_ID 11
      #define CHILD_ID_SCENE 3
      #define CHILD_ID_LED 4
      #define BACKLIGHT 6 //available PWM capable pin
      
      //
      LiquidCrystal_I2C lcd(0x27, 2, 1, 0, 4, 5, 6, 7, 3, POSITIVE);  // set the LCD address to 0x27 for a 16 chars and 2 line display
      //
      void (*lcdDisplay[STATES])();
      //
      byte state = 0;
      byte lastState;
      byte timeCounter = 0;
      int ledStatus = 1;// to toggle LCD backlight led
      int ledLevel = 254;
      unsigned long lastTime;
      unsigned long refreshInterval = 3000UL;
      unsigned long lastClockSet;
      boolean isMessage = false;
      float insideTemperature;
      float humidity;
      int OutdoorTemp = -99;
      int OutdoorHumidity = -99;
      int todayHigh = -99; 
      int todayLow = -99;
      int HotTubTemp = -99;
      int KWH = -99;
      int testTemp = -99;
      String conditions = "Not yet Reported";
      String tomorrowWeather = "Not yet Reported";
      String messageOfTheDay = "**Hello There!**";
      String AlarmStatus = "No Data";
      unsigned long motdTimer;
      boolean buttonPushed = false;
      //
      MySensor gw;
      //
      MyMessage msgOn(CHILD_ID_SCENE, V_SCENE_ON);
      MyMessage msgOff(CHILD_ID_SCENE, V_SCENE_OFF);
      MyMessage msgVAR1(CHILD_ID_SCENE, V_VAR1);// outdoor temperature
      MyMessage msgVAR2(CHILD_ID_SCENE, V_VAR2);// outdoor humidity
      MyMessage msgVAR3(CHILD_ID_SCENE, V_VAR3);//today's low
      MyMessage msgVAR4(CHILD_ID_SCENE, V_VAR4);// today's high
      MyMessage msgVAR5(CHILD_ID_SCENE, V_VAR5);//conditions
      //
      MyMessage lightMsg(CHILD_ID_LED, V_DIMMER);
      MyMessage msgMOTD(CHILD_ID_LED, V_VAR1); // Hot Tub KWH
      MyMessage msgAlarm(CHILD_ID_LED, V_VAR2); // Tomorrow Forecast
      MyMessage msgBrite(CHILD_ID_LED, V_VAR3); 
      MyMessage msgHTTemp(CHILD_ID_LED, V_VAR4); // Hot Tub Temp
      MyMessage msgALARMSTATUS (CHILD_ID_LED, V_VAR5);// Alarm System Status
      void setup()  
      { 
        DEBUG_SERIAL(115200);
        DEBUG_PRINTLN(F("Serial started"));
        //
        lcdDisplay[0] = lcdDisplay0;
        lcdDisplay[1] = lcdDisplay1;
        lcdDisplay[2] = lcdDisplay2;
        lcdDisplay[3] = lcdDisplay3;
        lcdDisplay[4] = lcdDisplay4;
        lcdDisplay[5] = lcdDisplay5;
        lcdDisplay[6] = lcdDisplay6;
        lcdDisplay[7] = lcdDisplay7;
        lcdDisplay[8] = lcdDisplay8;
        //
        pinMode(BACKLIGHT, OUTPUT);
        gw.begin(getVariables, RADIO_ID);
        //gw.begin(NULL, AUTO, true);
        gw.sendSketchInfo("Home Status Panel", "2.1");
        setSyncProvider (RTC.get);
        gw.present(CHILD_ID_SCENE, S_SCENE_CONTROLLER);
        gw.present( CHILD_ID_LED, S_DIMMER);
        //
        analogWrite(BACKLIGHT, 200); //LCD Backlight
        //
        lcd.begin(20,4);
        lcd.clear();
        lcd.backlight();
        lcd.setCursor(0, 0);
        lcd.print("Syncing Time");
        lcd.setCursor(0, 1);
        int clockCounter = 0;
        while(timeStatus() == timeNotSet && clockCounter < 60)
        {
          gw.process();
          gw.requestTime(receiveTime);
          Serial.println("getting Time");
          delay(1000);
          lcd.print(".");
          clockCounter++;
          if (clockCounter > 16)
          {
            lcd.clear();
            lcd.print(F("**Failed Clock**"));
            lcd.setCursor(0,1);
            lcd.print(F("*Syncronization*"));
            delay(2000);
            break;
          }
        }
        lcd.clear();
        lastTime = millis();
      }
      void loop()      
      {
        gw.process();
        if (millis() - lastClockSet >= 60000UL)
        {
          gw.requestTime(receiveTime);
          lastClockSet = millis();
        }
        if (millis() - lastTime >= refreshInterval)
        {
          state++;
          if (state > STATES - 1) state = 0;
          DEBUG_PRINTLN(F("State:")); 
          DEBUG_PRINTLN(state);
          lastTime += refreshInterval;
          getTempHumidity();
        }
        if (state != lastState) 
        {
          fastClear();
          lcdDisplay[state]();
        }
        lastState = state;
        if (isMessage)
        {
          if (millis() - motdTimer > 86400 * 1000UL)
          {
            isMessage = false;
          }
        }
      }
      void fastClear() //Clear LCD Screen
      {
        lcd.setCursor(0,0);
        lcd.clear();
        lcd.setCursor(0,1);
        lcd.clear();
        lcd.setCursor(0,2);
        lcd.clear();
        lcd.setCursor(0,3);
        lcd.clear();
      }
      //
      void lcdDisplay0()
      {
        lcd.setCursor(0,0);
        lcd.print(F("Time: "));
        if (hourFormat12() < 10) lcd.print("0");
        lcd.print(hourFormat12());
        lcd.print(":");
        if (minute() < 10) lcd.print("0");
        lcd.print(minute());
        if (isAM()) lcd.print(F("am"));
        else lcd.print(F("pm"));
        DEBUG_PRINT(F("Time:"));
        DEBUG_PRINTLN(hourFormat12());
        lcd.setCursor(0,1);
        lcd.print(F("Date: "));
        if (month() < 10) lcd.print("0");
        lcd.print(month());
        lcd.print("/");
        if (day() < 10) lcd.print("0");
        lcd.print(day());
        lcd.print("/");
        lcd.print(year());
        DEBUG_PRINTLN(F("Date: ")); 
        DEBUG_PRINT(month()); 
        DEBUG_PRINT("/"); 
        DEBUG_PRINT(day()); 
        DEBUG_PRINT("/"); 
        DEBUG_PRINTLN(year());
      }
      void lcdDisplay1()
      {
        lcd.setCursor(0,0);
        lcd.print(F(" Indoor Temp:"));
        lcd.print(int(round(insideTemperature)));
        lcd.print(char(223));
        DEBUG_PRINT(F("Indoor Temp:")); 
        DEBUG_PRINT(int(round(insideTemperature))); 
        DEBUG_PRINTLN(F("F"));
       }
      void lcdDisplay2()
      {
        lcd.setCursor(0,0);
        lcd.print("Outdoor Temp:"); 
        lcd.print(OutdoorTemp); 
        lcd.print(char(223));
        DEBUG_PRINT(F("Outdoor Temp:"));
        DEBUG_PRINTLN(OutdoorTemp);
        lcd.setCursor(0,1);
        lcd.print(F("    Humidity:")); 
        lcd.print(OutdoorHumidity); 
        lcd.print(F("%"));
        DEBUG_PRINT(F("    Humidity:"));
        DEBUG_PRINTLN(OutdoorHumidity);
      }
      void lcdDisplay3()
      {
        lcd.setCursor(0,0);
        lcd.print(F("Today's High:"));
        lcd.print(todayHigh); 
        lcd.print(char(223));
        DEBUG_PRINT(F("Today's High: "));
        DEBUG_PRINTLN(todayHigh);
        lcd.setCursor(0,1);
        lcd.print(F("         Low:"));
        lcd.print(todayLow); 
        lcd.print(char(223));
        DEBUG_PRINT(F("Today's Low: "));
        DEBUG_PRINTLN(todayLow);
      }
      void lcdDisplay4()
      {
        lcd.setCursor(0,0);
        lcd.print(F("Today's Weather"));
        DEBUG_PRINTLN(F("Today's Weather: "));
        lcd.setCursor(0,1);
        lcd.print(conditions);
        DEBUG_PRINTLN(conditions);
      }
      void lcdDisplay5()
      {
        lcd.setCursor(0,0);
        lcd.print(F("Forcast Tomorrow"));
        DEBUG_PRINTLN(F("Tomorrow's Forecast: "));
        lcd.setCursor(0,1);
        lcd.print(tomorrowWeather);
        DEBUG_PRINTLN(tomorrowWeather);
      }
      void lcdDisplay6()
      {
        if (isMessage)
        {
          lcd.setCursor(0,0);
          lcd.print(F("**NEW  MESSAGE**"));
          DEBUG_PRINTLN(F("****Message****"));
          lcd.setCursor(0,1);
          lcd.print(messageOfTheDay);
          DEBUG_PRINTLN(messageOfTheDay);
          motdTimer = millis();
        }
        else
        {
          lcd.setCursor(0,0);
          lcd.print(F("****Welcome!****"));
          DEBUG_PRINTLN(F("****Message****"));
          lcd.setCursor(0,1);
          lcd.print(F("Have a Nice Day!"));
          DEBUG_PRINTLN(F("Have a Nice Day"));
        }
      }
      void lcdDisplay7()
      {
        lcd.setCursor(0,1);
        lcd.print("Alarm Status:");  
        DEBUG_PRINT("Alarm Status:");
        DEBUG_PRINTLN(AlarmStatus);
        lcd.setCursor(0,2);
        lcd.print(AlarmStatus);
      }
      void lcdDisplay8()
      {
        lcd.setCursor(0,0);
        lcd.print("Hot Tub KWH:");
        lcd.print(KWH);
        DEBUG_PRINT("Hot Tub KWH:");
        DEBUG_PRINTLN(KWH);
        lcd.setCursor(0,1);
        lcd.print(F(" Hot Tub:"));
        lcd.print(HotTubTemp);
        lcd.print(char(223));
        DEBUG_PRINT(F("Hot Tub:"));
        DEBUG_PRINT(HotTubTemp);
        DEBUG_PRINT(F("F"));
        lcd.setCursor(3,0);
        lcd.print("Test Temp:");
        lcd.print(testTemp);
        lcd.print(char(223));
        DEBUG_PRINT(F("Test Temp:"));
        DEBUG_PRINTLN(testTemp);
      }
      //
      void getTempHumidity()
      {
        insideTemperature = ((RTC.temperature()/4*9/5 + 32));
        if (isnan(insideTemperature)) 
        {
          DEBUG_PRINTLN(F("Failed reading temperature from RTC"));
        } 
      }
      //
      void receiveTime(unsigned long controllerTime)
      {
        // Ok, set imcoming time
        DEBUG_PRINTLN(F("Time value received: "));
        DEBUG_PRINTLN(controllerTime);
        RTC.set(controllerTime);
        controllerTime = true;
      }
      //
      void incomingMessage(const MyMessage &message) {
            if (message.type == V_TEMP)
            {
              testTemp = atoi(message.data);
            DEBUG_PRINTLN(F("Test Temp recieved:"));
            DEBUG_PRINTLN(testTemp);
            }
        }
      
      void getVariables(const MyMessage &message)
      {
        if (message.sensor == CHILD_ID_SCENE)
        { 
          if (message.type == V_VAR1) //Outdoor temp pulled from Weather Underground Vera Plugin
          {
            OutdoorTemp = atoi(message.data);
            DEBUG_PRINTLN(F("OutdoorTemp recieved:"));
            DEBUG_PRINTLN(OutdoorTemp);
          }
          if (message.type == V_VAR2) //Outdoor Humidity pulled from Weather Underground Vera Plugin
          {
            OutdoorHumidity = atoi(message.data);
            DEBUG_PRINT(F("OutdoorHumidity recieved:"));
            DEBUG_PRINTLN(OutdoorHumidity);
          }
          if (message.type == V_VAR3) //pulled from Weather Underground Vera Plugin
          {
            todayLow = atoi(message.data);
            DEBUG_PRINT(F("Received Today's LOW:"));
            DEBUG_PRINTLN(todayLow);
          }
      
          if (message.type == V_VAR4) //pulled from Weather Underground Vera Plugin
          {
            todayHigh = atoi(message.data);
            DEBUG_PRINT(F("Received Today's HIGH:"));
            DEBUG_PRINTLN(todayHigh);
          }
          if (message.type == V_VAR5) //pulled from Weather Underground Vera Plugin
          {
            String newMessage = String(message.data);
            int locator = newMessage.indexOf("@");
            newMessage = newMessage.substring(0, locator);
            conditions = newMessage;
            DEBUG_PRINT(F("Received today's Conditions:"));
            DEBUG_PRINTLN(conditions);
          }
        }
          if (message.sensor == CHILD_ID_LED)
        {
          if (message.type == V_DIMMER) //Set LCD Brightness from Dimmer Device in Vera
          {
            ledLevel = message.getByte();
            		lcd.setBacklight(ledLevel);
      		Serial.print("Brightness Level recieved:");
      		Serial.println(ledLevel);
                      analogWrite(BACKLIGHT, (int)(ledLevel / 100. * 255) );                
          }
          if (message.type == V_VAR1) //Hot Tub KWN Hours
          {
            KWH = atoi(message.data);
            DEBUG_PRINT("Hot Tub KWH recieved:");
            DEBUG_PRINTLN(KWH);
          }
          if (message.type == V_VAR2) //pulled from Weather Underground Vera Plugin
          {
            // Extended Forecast
            String newMessage = String(message.data);
            int locator = newMessage.indexOf("@");
            newMessage = newMessage.substring(0, locator);
            tomorrowWeather = newMessage;
            DEBUG_PRINT(F("Received Two Day Forecast:"));
            DEBUG_PRINTLN(tomorrowWeather);
          }
          if (message.type == V_VAR3) //Not sure what this will be used for just yet
          {
            // message of the day
            String newMessage = String(message.data);
            int locator = newMessage.indexOf("@");
            newMessage = newMessage.substring(0, locator);
            messageOfTheDay = newMessage;
            DEBUG_PRINT(F("Received Message of the Day:"));
            DEBUG_PRINTLN(messageOfTheDay);
            isMessage = true;
          }
          if (message.type == V_VAR4) //Hot Tub Temp from Vera which comes from an Arduino
          {
            HotTubTemp = atoi(message.data);
            DEBUG_PRINT(F("Received HotTubTemp:"));
            DEBUG_PRINTLN(HotTubTemp);
          }
          if (message.type == V_VAR5) //Check on Alarm status
          {
          String newMessage = String(message.data);
            int locator = newMessage.indexOf("@");
            newMessage = newMessage.substring(0, locator);
            AlarmStatus = newMessage;
            DEBUG_PRINT(F("Received Alarm Status:"));
            DEBUG_PRINTLN(AlarmStatus); 
          } 
        }
      }
      
      posted in Development
      cleight
      cleight
    • RE: Node to Node Communication

      @cleight said:

      I tried the following code but doesn't appear to be working

      void getVariables(const MyMessage &message)
      {
      if (message.sensor == 1)
        {
            if (message.type == V_TEMP)
            {
              testTemp = atoi(message.data);
            DEBUG_PRINTLN(F("Test Temp recieved:"));
            DEBUG_PRINTLN(testTemp);
            }
        }
      }
      

      Can anyone assist with this issue? I cannot figure out what I am missing to capture this data into an integer so I can parse it to my LCD Screen.

      Message.sensor -- 1 is what I am defining right now as I was the data from Node ID1, Sensor ID0, I believe this is where my issue is but I cannot figure out the syntax needed to define Node 1 Child Sensor 0 and Variable type V_TEMP.

      posted in Development
      cleight
      cleight
    • RE: Node to Node Communication

      I tried the following code but doesn't appear to be working

      void getVariables(const MyMessage &message)
      {
      if (message.sensor == 1)
        {
            if (message.type == V_TEMP)
            {
              testTemp = atoi(message.data);
            DEBUG_PRINTLN(F("Test Temp recieved:"));
            DEBUG_PRINTLN(testTemp);
            }
        }
      }
      
      posted in Development
      cleight
      cleight
    • RE: Node to Node Communication

      @Chaotic I'm not following at all with what you said. I don't believe I need to change my gw.begin as I am receiving messages from the other node, I am now struggling with capturing that data to a variable that I can use to output the data to an attached LCD Screen.

      posted in Development
      cleight
      cleight
    • RE: Node to Node Communication

      @cleight said:

      So it looks like the code below did work:
      gw.send(msgHTTemp.setDestination(11).setSensor(i).set(temperature,1));

      How ever in the serial monitor I am getting a bunch of ST=fail trying to send to node 11:
      T2: 71.90
      send: 1-1-0-11 s=0,c=1,t=0,pt=7,l=5,st=ok:71.4
      send: 1-1-0-11 s=0,c=1,t=0,pt=7,l=5,st=fail:71.4

      Here is the code I have in my Node 11 sketch to receive the messages:
      gw.begin(NULL, AUTO, true);
      gw.process();

      I also don't fully understand how I capture the data coming into node 11 and present it to the LCD screen so any help with that as well would be great.

      Figured out the issue was in the repeater code on node 11. So now I am getting variable from Node1 being presented to Node11 but I am not sure how to capture this information and display it on the LCD Screen attached.

      read: 1-0-11 s=0,c=1,t=0,pt=7,l=5:84.2

      posted in Development
      cleight
      cleight
    • RE: Node to Node Communication

      So it looks like the code below did work:
      gw.send(msgHTTemp.setDestination(11).setSensor(i).set(temperature,1));

      How ever in the serial monitor I am getting a bunch of ST=fail trying to send to node 11:
      T2: 71.90
      send: 1-1-0-11 s=0,c=1,t=0,pt=7,l=5,st=ok:71.4
      send: 1-1-0-11 s=0,c=1,t=0,pt=7,l=5,st=fail:71.4

      Here is the code I have in my Node 11 sketch to receive the messages:
      gw.begin(NULL, AUTO, true);
      gw.process();

      I also don't fully understand how I capture the data coming into node 11 and present it to the LCD screen so any help with that as well would be great.

      posted in Development
      cleight
      cleight
    • RE: Node to Node Communication

      @hek I tried your suggestion above and got the following error message; "no matching function call" I used the following code in my sketch: Mymessage setDestination(11);

      Does anyone have a working example of node - node communication that we could all reference?

      So been playing arround a bit more and got this, does it look right?

      gw.send(msgHTTemp.setDestination(11).setSensor(i).set(temperature,1));
      

      and if this looks correct will it send to both node 11 and the gateway?

      posted in Development
      cleight
      cleight
    • Node to Node Communication

      Hello, I am building a LCD information panel to interface with my several Arduino sensors and am looking for some help in setting up the Node to Node communication. I have searched these forums extensively and either the information I find is not relevant to 1.4 or is beyond my comprehension.

      Also I believe it would be a good idea to have an example on the build page for Node to Node communication.

      posted in Development
      cleight
      cleight
    • RE: Weather Station with Scene Activator!!!

      @BulldogLowell I agree I think it would benefit the community to have a node to node example on the site.

      posted in My Project
      cleight
      cleight
    • RE: Weather Station with Scene Activator!!!

      @BulldogLowell I finally am getting somewhere with my project, however after some time working with it I have found that I would rather send data from other Arduino sensors to the LCD project directly rather than send it to Vera and then run a piece of Luup code every 15 minutes to then populate the variables the screen uses. I have looked all over the forums and cannot seem to find the right bit on information on MySensors 1.4 and how to send data from one node to the other, any assistance would be great.

      posted in My Project
      cleight
      cleight
    • RE: Weather Station with Scene Activator!!!

      @BulldogLowell yes like that example, I posted on you other thread a week or so ago. I will see if I can put my current sketch and parts of that one together to get it how I want.

      posted in My Project
      cleight
      cleight
    • RE: Weather Station with Scene Activator!!!

      @BulldogLowell Thanks for this information this helped me to get the variables I needed to pull the alarm status, I also fixed the above issue with not being able to pull the Temperature from the device I was trying to. Once I tweak my code and adjust the display the way I like I will post the final sketch and a video.

      One more thing how easy would it be to have semi-static data, like the temp or time in one corner of the screen while it is cycling through all the screens?

      posted in My Project
      cleight
      cleight
    • RE: Weather Station with Scene Activator!!!

      @korttoma said:

      local HTTemp = luup.variable_get("urn:upnp-micasaverde-com:serviceId:TemperatureSensor1","CurrentTemperature", 98)
      luup.call_action("urn:upnp-arduino-cc:serviceId:arduino1", "SendCommand", {radioId="11;4", variableId="VAR_4", value=HTTemp}, 105)

      I tried this luup code and get the same results, at this point I have to believe it is an issue in my sketch as I have pushed a known working device to 105, VAR_4 and it isn't working either.

      posted in My Project
      cleight
      cleight
    • RE: Weather Station with Scene Activator!!!

      @korttoma Can you elaborate on HTTemp not getting any value? I am not following what HTTemp should be either changed to or how to give it value.

      Here is a snippet of the debug window:
      Indoor Temp:20F
      Hot Tub:0Fsend: 11-11-0-0 s=255,c=3,t=1,pt=0,l=0,st=ok:
      read: 0-0-11 s=255,c=3,t=1,pt=0,l=10:1423665003
      Time value received:
      1423665003

      posted in My Project
      cleight
      cleight
    • RE: Weather Station with Scene Activator!!!

      @BulldogLowell Thanks for pointing that out, I actually need to write VAR4 to device 105. I have made the necessary changes but still isn't working.

       local temp = luup.variable_get("urn:upnp-   org:serviceId:TemperatureSensor1","CurrentTemperature", 7)
       luup.call_action("urn:upnp-arduino-cc:serviceId:arduino1",  "SendCommand", {radioId="11;3", variableId="VAR_1", value=temp}, 103)
      luup.sleep(750)
      local humid = luup.variable_get("urn:micasaverde-com:serviceId:HumiditySensor1","CurrentLevel", 10)
      luup.call_action("urn:upnp-arduino-cc:serviceId:arduino1", "SendCommand", {radioId="11;3", variableId="VAR_2", value=humid}, 103)
       luup.sleep(750)
       local low = luup.variable_get("urn:upnp-org:serviceId:TemperatureSensor1","CurrentTemperature", 8)
       luup.call_action("urn:upnp-arduino-cc:serviceId:arduino1", "SendCommand", {radioId="11;3", variableId="VAR_3", value=low}, 103)
       luup.sleep(750)
       local high = luup.variable_get("urn:upnp-org:serviceId:TemperatureSensor1","CurrentTemperature", 9)
       luup.call_action("urn:upnp-arduino-cc:serviceId:arduino1", "SendCommand", {radioId="11;3", variableId="VAR_4", value=high}, 103)
       luup.sleep(750)
       local conditions = luup.variable_get("urn:upnp-micasaverde-com:serviceId:Weather1","Condition", 6)
       luup.call_action("urn:upnp-arduino-cc:serviceId:arduino1", "SendCommand", {radioId="11;3", variableId="VAR_5", value=conditions}, 103)
       luup.sleep(750)  
       local conditions = luup.variable_get("urn:upnp-micasaverde-com:serviceId:Weather1","Forecast.1.Condition", 6)
       luup.call_action("urn:upnp-arduino-cc:serviceId:arduino1", "SendCommand", {radioId="11;4", variableId="VAR_2", value=conditions}, 105)
        luup.sleep(750)
        local temp = luup.variable_get("urn:upnp-micasaverde-com:serviceId:TemperatureSensor1","CurrentTemperature", 98)
        luup.call_action("urn:upnp-arduino-cc:serviceId:arduino1", "SendCommand", {radioId="11;4", variableId="VAR_4", value=HTTemp}, 105)
        luup.sleep(750)
      posted in My Project
      cleight
      cleight
    • RE: Weather Station with Scene Activator!!!

      @BulldogLowell I was under the impression that the value could be named what ever you want, is that not the case? changing the value to temp should fix the issue you think?

      posted in My Project
      cleight
      cleight
    • RE: Weather Station with Scene Activator!!!

      Hello, I am building this same thing and have used the sketch and luup code above thanks to @BulldogLowell & @korttoma!

      I am having issues though pulling a variable to send to the lcd screen via luup. I put this device under the Light Variable 4 code is at the bottom of the Lua below. This device is another mysensor that is visible in Vera so I am not sure what is wrong, any help someone could provide would be great.

      Luup code:

      local temp = luup.variable_get("urn:upnp-org:serviceId:TemperatureSensor1","CurrentTemperature", 7)
      luup.call_action("urn:upnp-arduino-cc:serviceId:arduino1", "SendCommand", {radioId="11;3", variableId="VAR_1", value=temp}, 103)
      luup.sleep(750)
      local humid = luup.variable_get("urn:micasaverde-com:serviceId:HumiditySensor1","CurrentLevel", 10)
      luup.call_action("urn:upnp-arduino-cc:serviceId:arduino1", "SendCommand", {radioId="11;3", variableId="VAR_2", value=humid}, 103)
      luup.sleep(750)
      local low = luup.variable_get("urn:upnp-org:serviceId:TemperatureSensor1","CurrentTemperature", 61)
          luup.call_action("urn:upnp-arduino-cc:serviceId:arduino1", "SendCommand", {radioId="11;3", variableId="VAR_3", value=low}, 103)
       luup.sleep(750)
      local high = luup.variable_get("urn:upnp-org:serviceId:TemperatureSensor1","CurrentTemperature", 62)
      luup.call_action("urn:upnp-arduino-cc:serviceId:arduino1", "SendCommand", {radioId="11;3", variableId="VAR_4", value=high}, 103)
      luup.sleep(750)
      local conditions = luup.variable_get("urn:upnp-micasaverde-com:serviceId:Weather1","Condition", 6)
      luup.call_action("urn:upnp-arduino-cc:serviceId:arduino1", "SendCommand", {radioId="11;3", variableId="VAR_5", value=conditions}, 103)
      luup.sleep(750)  
      local conditions = luup.variable_get("urn:upnp-micasaverde-com:serviceId:Weather1","Forecast.1.Condition", 59)
      luup.call_action("urn:upnp-arduino-cc:serviceId:arduino1", "SendCommand", {radioId="11;4", variableId="VAR_2", value=conditions}, 103)
       luup.sleep(750)
        local conditions = luup.variable_get("urn:upnp-micasaverde-com:serviceId:TemperatureSensor1","CurrentTemperature", 98)
       luup.call_action("urn:upnp-arduino-cc:serviceId:arduino1", "SendCommand", {radioId="11;4", variableId="VAR_4", value=HTTemp}, 103)
        luup.sleep(750)
      

      Sketch: weather_station.ino

      posted in My Project
      cleight
      cleight
    • RE: Vera Helper with Arduino

      @BulldogLowell Would it be possible to use your example without the webserver portion on a Nano and still pull information from Vera?

      posted in My Project
      cleight
      cleight
    • RE: Temp sensors showing as Celsius, looking for Fahrenheit

      @pete1450 said:

      Just starting with the basics: Assuming you used the example temp sketch, did you set the metric boolean to false?

      I used a combination of the Humidity sensor sketch and the Temperature Sketch. Metric Boolean was set to true, I just changed it to false but doesn't appear to have made a difference.

      posted in Troubleshooting
      cleight
      cleight
    • Temp sensors showing as Celsius, looking for Fahrenheit

      Hello,

      New to MySensors and finally got my sensor working correctly with my iBoard Ethernet gateway with the exception of my temperatures showing up in Celsius instead of Fahrenheit? I did some research on the issue on the forums and have tried changing my controller (vera) from Imperial to Metric and back again and it didn't fix the issue.

      Controller: Vera Lite
      Gateway: Ethernet - iBoard
      Library Version: 1.4.1
      Plugin Version: 1.4.1
      Sensor Board: Arduino Nano

      Further information to the problem can be found in this thread: Hot Tub Temp Monitor

      posted in Troubleshooting
      cleight
      cleight
    • RE: Waterproof Temp Sensor with dht humidty/temp sensor

      Ok so I finally got it working and showing all 3 devices in the Vera Controller. I am not sure if the code is the cleanest, but it is working. The only outstanding issue I am having at this point is my temperatures are showing up in Celsius and I would like them to show in Fahrenheit? I did some research on the forums and have tried changed the Vera controller from Imperial to Metric and vise-versa with no luck.

      Here is the latest sketch for reference: sketch_HotTubTemp2.ino

      posted in My Project
      cleight
      cleight
    • RE: Waterproof Temp Sensor with dht humidty/temp sensor

      I finally got my iBoard Gateway working and Vera can see the temperature sensor node. However the 2 temperature probes are showing up but the humidity sensor is not. Can someone please look at my sketch to see what I missed?

      posted in My Project
      cleight
      cleight
    • RE: Waterproof Temp Sensor with dht humidty/temp sensor

      @daulagari said:

      Hi @cleight

      To help you further it would be good if you can post the errors you are getting and add a link to the Dallas temperature sensor you are trying to use.

      I am using this temperature sensor, I should also note that when I compiled it compiled fine. waterproof temp sensor Found it on the Mysensors Store Page.

      @ericvdb said:

      How are yu powering the Dallas temperature sensor an ddid you add the pull-up resistor of 4k7 ?

      I am powering the Dallas Temp Sensor from the Nano with 5.5V and have a 4k7 resistor between the VCC and Signal wire.

      @BulldogLowell said:

      @ericvdb

      how many dallas sensors on the 1 Wire bus?

      it looks like you are presenting device number 0 (and possibly 1) twice...

      void setup()  
      { 
        // Startup OneWire
        sensors.begin();
        
        gw.begin();
        dht.setup(HUMIDITY_SENSOR_DIGITAL_PIN); 
      
        // Send the Sketch Version Information to the Gateway
        gw.sendSketchInfo("Humidity", "1.0");
        gw.sendSketchInfo("Temperature Sensor", "1.0");
        
        // Fetch the number of attached temperature sensors
        numSensors = sensors.getDeviceCount();
        
        // Present all sensors to controller
        for (int i=0; i<numSensors && i<MAX_ATTACHED_DS18B20; i++) {
          gw.present(i, S_TEMP); // <<<<<<<<<<<<< First Here, device O and 1 will be create
        }
      
        // Register all sensors to gw (they will be created as child devices)
        gw.present(CHILD_ID_HUM, S_HUM);  //<<<<<<<<<<< Then you create device 0 again...
        gw.present(CHILD_ID_TEMP, S_TEMP); //<<<<<<<<<<< Then you create device 1 again...
        
        metric = gw.getConfig().isMetric;
      }
      

      I have one sensor on the One Wire bus, the other temp/humidity sensor you see listed is a DHTII Humidity/Temp Sensor which I believe does not use the OneWire bus.

      The code compiled fine and appears to be working, I am not sure it is 100% correct though.

      Latest copy of the sketch: sketch_HotTubTemp2.ino

      posted in My Project
      cleight
      cleight
    • Waterproof Temp Sensor with dht humidty/temp sensor

      Hello,

      I am new to mysensors and am trying to work on a waterproof temperature sensor now with an additional DHTII for outdoor temp/humidity for around my Hot tub. I got the DHTII example working and am now trying to add in the code for the Dallas Temperature waterproof sensor and getting lots of errors. hoping someone can look at my code and point out my mistakes so I can learn.

      sketch_HotTubTemp.ino

      posted in My Project
      cleight
      cleight