Hello,
I have a problem with my Gateway and my Node.
I'm using RFM95 module (915Mhz), as I'm in Brazil.
It worked for a while in the afternoon, but then at night it stopped working.
Node is sending something, but my Gateway is not recognizing anyone sent to it.
Code Gateway:
/*
* 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-2019 Sensnology AB
* Full contributor list: https://github.com/mysensors/MySensors/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
*
* DESCRIPTION
* The ESP8266 MQTT gateway sends radio network (or locally attached sensors) data to your MQTT broker.
* The node also listens to MY_MQTT_TOPIC_PREFIX and sends out those messages to the radio network
*
* LED purposes:
* - To use the feature, uncomment any of the MY_DEFAULT_xx_LED_PINs in your sketch
* - RX (green) - blink fast on radio message received. In inclusion mode will blink fast only on presentation received
* - TX (yellow) - blink fast on radio message transmitted. In inclusion mode will blink slowly
* - ERR (red) - fast blink on error during transmission error or receive crc error
*
* See https://www.mysensors.org/build/connect_radio for wiring instructions.
*
* If you are using a "barebone" ESP8266, see
* https://www.mysensors.org/build/esp8266_gateway#wiring-for-barebone-esp8266
*
* Inclusion mode button:
* - Connect GPIO5 (=D1) via switch to GND ('inclusion switch')
*
* Hardware SHA204 signing is currently not supported!
*
* Make sure to fill in your ssid and WiFi password below for ssid & pass.
*/
// Enable debug prints to serial monitor
#define MY_DEBUG
// Use a bit lower baudrate for serial prints on ESP8266 than default in MyConfig.h
#define MY_BAUD_RATE 115200
// Enables and select radio type (if attached)
//#define MY_RADIO_RF24
//#define MY_RADIO_RFM69
#define MY_RADIO_RFM95
#define MY_RFM95_IRQ_PIN D1
#define MY_RFM95_IRQ_NUM digitalPinToInterrupt(MY_RFM95_IRQ_PIN)
#define MY_RFM95_CS_PIN D8
#define MY_RFM95_FREQUENCY (RFM95_915MHZ)
#define MY_RFM95_MODEM_CONFIGRUATION RFM95_BW125CR45SF128
#define MY_TRANSPORT_STATE_TIMEOUT_MS (3*1000ul)
#define RFM95_RETRY_TIMEOUT_MS (5000ul)
#define MY_DEBUG_VERBOSE_RFM95
#define MY_GATEWAY_MQTT_CLIENT
#define MY_GATEWAY_ESP8266
// Set this node's subscribe and publish topic prefix
#define MY_MQTT_PUBLISH_TOPIC_PREFIX "/ragnarok.skyline@gmail.com/Rfm95/mygateway1-out"
#define MY_MQTT_SUBSCRIBE_TOPIC_PREFIX "/ragnarok.skyline@gmail.com/Rfm95/mygateway1-in"
// Set MQTT client id
#define MY_MQTT_CLIENT_ID "RFM95_MQTT_GW"
// Enable these if your MQTT broker requires username/password
#define MY_MQTT_USER "ragnarok.skyline@gmail.com"
#define MY_MQTT_PASSWORD "dec919a9"
// Set WIFI SSID and password
#define MY_WIFI_SSID "Carlos AP2.4ghz"
#define MY_WIFI_PASSWORD "EAEi2t7k3c4"
//#define MY_WIFI_SSID "Quartinho"
//#define MY_WIFI_PASSWORD "i2t7k3c4.."
// Set the hostname for the WiFi Client. This is the hostname
// passed to the DHCP server if not static.
#define MY_HOSTNAME "RFM95_MQTT_GW"
// Enable MY_IP_ADDRESS here if you want a static ip address (no DHCP)
//#define MY_IP_ADDRESS 192,168,178,87
// If using static ip you can define Gateway and Subnet address as well
//#define MY_IP_GATEWAY_ADDRESS 192,168,178,1
//#define MY_IP_SUBNET_ADDRESS 255,255,255,0
// MQTT broker ip address.
//#define MY_CONTROLLER_IP_ADDRESS 192, 168, 0, 103
//MQTT broker if using URL instead of ip address.
#define MY_CONTROLLER_URL_ADDRESS "mqtt.dioty.co"
// The MQTT broker port to to open
#define MY_PORT 1883
// Enable inclusion mode
//#define MY_INCLUSION_MODE_FEATURE
// Enable Inclusion mode button on gateway
//#define MY_INCLUSION_BUTTON_FEATURE
// Set inclusion mode duration (in seconds)
//#define MY_INCLUSION_MODE_DURATION 60
// Digital pin used for inclusion mode button
//#define MY_INCLUSION_MODE_BUTTON_PIN D1
// Set blinking period
//#define MY_DEFAULT_LED_BLINK_PERIOD 300
// Flash leds on rx/tx/err
//#define MY_DEFAULT_ERR_LED_PIN 16 // Error led pin
//#define MY_DEFAULT_RX_LED_PIN 16 // Receive led pin
//#define MY_DEFAULT_TX_LED_PIN 16 // the PCB, on board LED
#include <MySensors.h>
void setup()
{
// Setup locally attached sensors
}
void presentation()
{
// Present locally attached sensors here
}
void loop()
{
// Send locally attached sensors data here
}
Code Node:
/*
* 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-2019 Sensnology AB
* Full contributor list: https://github.com/mysensors/MySensors/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 - tekka
*
* DESCRIPTION
* Passive node example: This is a passive & independent reporting node
*
*/
// Enable debug prints
#define MY_DEBUG
// Enable passive mode
#define MY_PASSIVE_NODE
// Passive mode requires static node ID
#define MY_NODE_ID 100
// Enable and select radio type attached
//#define MY_RADIO_RF24
//#define MY_RADIO_NRF5_ESB
//#define MY_RADIO_RFM69
#define MY_RADIO_RFM95
#define MY_RFM95_FREQUENCY (RFM95_915MHZ)
#define MY_RFM95_MODEM_CONFIGRUATION RFM95_BW125CR45SF128
#define MY_TRANSPORT_STATE_TIMEOUT_MS (3*1000ul)
#define RFM95_RETRY_TIMEOUT_MS (5000ul)
#define MY_DEBUG_VERBOSE_RFM95
#include <MySensors.h>
#define CHILD_ID 0 // Id of the sensor child
// Initialize general message
MyMessage msg(CHILD_ID, V_TEMP);
void setup()
{
}
void presentation()
{
// Send the sketch version information to the gateway and controller
sendSketchInfo("Passive node", "1.0");
// Register all sensors to gw (they will be created as child devices)
present(CHILD_ID, S_TEMP);
}
void loop()
{
// generate some random data
send(msg.set(25.0+random(0,30)/10.0,2));
delay(500);
}
Gateway using NodeMcu1.0
Node: using Uno PCb