Skip to content

Troubleshooting

Help! Everything just falls apart
2.7k Topics 21.5k Posts
  • Dallas Temp failure to compile

    23
    0 Votes
    23 Posts
    8k Views
    R
    It's my code :scream: I changed this method from private to public, this function is used to determine wait time needed for right non-blocking wait call. Seems like I should make PR to original library instead of modifying MYS copy.
  • NRF24-Autoack

    6
    0 Votes
    6 Posts
    2k Views
    cimba007C
    I stripped down my example and tried to capsulate it in its own wrapper class. This is by no means complete or ready to use .. it is just there to give interested people some kind of input on how to work with the wait/autoack stuff if you can't use your radios autoretry feature like me. If you need some comments to understand parts of the code feel free to ask. LightSensorSoftwareAckNRF24_class.ino #define MY_NODE_ID 10 #define MY_BAUD_RATE 57600 // Enable debug prints to serial monitor //#define MY_DEBUG // Enable and select radio type attached #define MY_RADIO_NRF24 //#define MY_RADIO_RFM69 #include <SPI.h> #include <MySensors.h> #define LIGHT_SENSOR_ANALOG_PIN A3 #define MINUTES 60000UL #define CHILD_ID_LIGHT 0 #include "helper.cpp" void before() { // LightSensor // http://akizukidenshi.com/download/ds/senba/GL55%20Series%20Photoresistor.pdf // GL5549 pinMode(A3,INPUT_PULLUP); // 20-50 kOhm pinMode(A2,OUTPUT); digitalWrite(A2,LOW); } MySensorChild photoSensor = MySensorChild(CHILD_ID_LIGHT,S_LIGHT_LEVEL,"Photoresistor GL5549"); void setup() { } void presentation() { // Send the sketch version information to the gateway and Controller sendSketchInfo("LightClass_Test", "0.1"); photoSensor.do_present(); } void loop() { // Set Message photoSensor.message()->set(random(0,100)); // Print Result photoSensor.print(photoSensor.waitsend(250)); delay(1000); } helper.cpp #include "core/MySensorsCore.h" #include "core/MyTransport.h" #include "drivers/RF24/RF24.h" #include <stdarg.h> class MySensorChild { public: typedef struct { uint8_t rpd; unsigned long long elapsedtime; uint8_t success; uint8_t retrycount; } return_struct; void print(return_struct r) { Serial.print(r.success == 1 ? "success" : "fail "); Serial.print(" | "); Serial.print("time: "); p(F("%8d"),r.elapsedtime); Serial.print("uS | "); Serial.print("retr.: "); p(F("%2d"),r.retrycount); Serial.print(" | "); Serial.print("rpd: "); Serial.print(r.rpd); Serial.print(" | "); Serial.println(); } public: MySensorChild(uint8_t childid, uint8_t valuetype, char * description) { // Base Values that define a Message this->description = description; this->childid = childid; this->valuetype = valuetype; this->message_internal = MyMessage(childid, valuetype); } MyMessage * MySensorChild::message() { return &this->message_internal; } void do_present() { present(this->childid, this->valuetype, this->description); } return_struct MySensorChild::waitsend(unsigned long ms) { bool ok = false; const uint8_t retrycountlimit = 10; unsigned long long starttime = micros(); return_struct r; send(message_internal,true); uint8_t c = retrycountlimit; while(!ok && c) { // Ack?! if(wait(ms,message_internal.getCommand(),message_internal.type)) { r.rpd = RF24_readByteRegister(RPD); r.elapsedtime = micros()-starttime; r.success = true; r.retrycount = retrycountlimit-c; return r; //Serial.print(" | rpd: "); Serial.print(RF24_readByteRegister(RPD)); // Return! //return true; } else { if(!isTransportOK()) { Serial.print(" | Transport broken! "); wait(100); } //Serial.print("~"); send(message_internal,true); } c--; } if(c == 0) { r.elapsedtime = micros()-starttime; r.success = false; r.retrycount = retrycountlimit-c; return r; //return false; } } private: // Base Values that define a Message MyMessage message_internal; char * description; uint8_t childid; uint8_t valuetype; unsigned long lastSend; void p(const __FlashStringHelper *fmt, ... ){ char buf[128]; // resulting string limited to 128 chars va_list args; va_start (args, fmt); #ifdef __AVR__ vsnprintf_P(buf, sizeof(buf), (const char *)fmt, args); // progmem for AVR #else vsnprintf(buf, sizeof(buf), (const char *)fmt, args); // for the rest of the world #endif va_end(args); Serial.print(buf); }; }; Example output (mydebug enabled @ gateway) success | time: 16mS | retr.: 0 | rpd: 1 | <\r><\n> success | time: 17mS | retr.: 0 | rpd: 1 | <\r><\n> success | time: 13mS | retr.: 0 | rpd: 1 | <\r><\n> success | time: 10mS | retr.: 0 | rpd: 1 | <\r><\n> success | time: 12mS | retr.: 0 | rpd: 1 | <\r><\n> success | time: 11mS | retr.: 0 | rpd: 1 | <\r><\n> success | time: 12mS | retr.: 0 | rpd: 1 | <\r><\n> success | time: 12mS | retr.: 0 | rpd: 1 | <\r><\n> success | time: 10mS | retr.: 0 | rpd: 1 | <\r><\n> success | time: 13mS | retr.: 0 | rpd: 1 | <\r><\n> success | time: 12mS | retr.: 0 | rpd: 1 | <\r><\n> success | time: 10mS | retr.: 0 | rpd: 1 | <\r><\n> success | time: 12mS | retr.: 0 | rpd: 1 | <\r><\n> success | time: 11mS | retr.: 0 | rpd: 1 | <\r><\n> success | time: 12mS | retr.: 0 | rpd: 1 | <\r><\n> success | time: 12mS | retr.: 0 | rpd: 1 | <\r><\n> fail | time: 2504mS | retr.: 10 | rpd: 0 | <\r><\n> fail | time: 2505mS | retr.: 10 | rpd: 0 | <\r><\n> Always a good idea to disable debugging if you are happy with the performance. Debugging output on serial on the mqtt-gateway (esp8266) takes quite a while. success | time: 4mS | retr.: 0 | rpd: 1 | <\r><\n> success | time: 2mS | retr.: 0 | rpd: 1 | <\r><\n> success | time: 4mS | retr.: 0 | rpd: 1 | <\r><\n> success | time: 4mS | retr.: 0 | rpd: 1 | <\r><\n> success | time: 4mS | retr.: 0 | rpd: 1 | <\r><\n> success | time: 2mS | retr.: 0 | rpd: 1 | <\r><\n> success | time: 4mS | retr.: 0 | rpd: 1 | <\r><\n> success | time: 5mS | retr.: 0 | rpd: 1 | <\r><\n>
  • Library 1.6 devel - How query the parent node?

    6
    0 Votes
    6 Posts
    1k Views
    X
    @hek I can retrive the parent node by requesting it, that's ok. I have no idea how to do that (if you can point me to an example...) BTW, if I would like to inform the Controller (OpenHAB) on which parent is used by a node (I'm using MQTTClient as GW) I need to present and register this information as written by me before or there is another way as well? Thanks! simon
  • Problems with first sensors

    62
    0 Votes
    62 Posts
    27k Views
    blebbensB
    There is no device listed in APPS/DEV APPS/Serial Port Config. There is only a save button. That´s the big problem. Vera does not recognize the to USB connected gateway.
  • [Closed][Unresolved]gateway DHCP Fail

    5
    0 Votes
    5 Posts
    2k Views
    markjgabbM
    worked around the issue but making it a serial gateway instead as long as my nas is happy i dont mind how it plugs in....
  • Does ESP8266 WIFI only node require IP gateway?

    4
    0 Votes
    4 Posts
    1k Views
    mfalkviddM
    @stephenmhall it needs a controller with an ip address, not a gateway. https://www.mysensors.org/about/network describes the difference between a controller and a gateway. Are you using the mqtt gateway or the ethernet gateway? According to the Vera page, Vera supports ethernet gateway, but not mqtt. Therefore you should probably use the ethernet gateway and leave MY_CONTROLLER_IP_ADDRESS disabled/commented (the way it is by default). You then add the ethernet gateway to Vera according to the instructions here. I don't use Vera though so I have not tried this myself.
  • [Solved] Node not reconnecting

    Locked
    17
    1 Votes
    17 Posts
    5k Views
    corbinC
    @tekka said: if(isTransportOK()){ sleep(30000); // transport is OK, node can sleep } else { wait(5000); // transport is not operational, allow the transport layer to fix this } I've only just found this post, and these lines of code have me excited! fixes my problem, thank you!
  • [Solved] Node not resetting itself

    Locked
    8
    0 Votes
    8 Posts
    2k Views
    tekkaT
    @kenci Not yet :smile:
  • Question about wait() and program logic

    9
    0 Votes
    9 Posts
    2k Views
    X
    @hek ok, thank you! I'll adopt your example as starting point. Many thanks! Simon
  • [SOLVED] Domoticz find just one of two flow sensors!

    5
    0 Votes
    5 Posts
    2k Views
    vichoV
    @mfalkvidd yes, it is very strange. Before to write here I try to change the child id - first the sensors have id 50 and 51. After I try with 30, 31 and 31,32 but the same result - domoticz see just one of the flow meters. I try to reprogram GW and new node (clear both EEPROM) - note get new ID and the rusult are the same. Clear Domoticz database - same. Very strange for me. All other work well - have attached RFXTRX433 with energy monitor and some switches at 433Mhz, some nodes with light sensors and ds18b20 for testing.
  • [Solved] Function repeater not working

    Locked
    16
    0 Votes
    16 Posts
    4k Views
    D
    @tekka said: @Daemon-D Can you explain how you solved the issue - I'm sure other user could also profit if they face a similar problem. Thanks. The problem was solved by moving to the top of the sketch exactly like the to test the sketch before #include // Enable debug prints to serial monitor #define MY_DEBUG // Enable and select radio type attached #define MY_RADIO_NRF24 //#define MY_RADIO_RFM69 // Enabled repeater feature for this node #define MY_REPEATER_FEATURE #include <SPI.h> #include <MySensors.h>
  • 0 Votes
    12 Posts
    8k Views
    wahidW
    hello, i know it is late, but others could see it too. i had the same problem running small (LOW POWER) modules on power banks, because the battery or power bank has a built in power meter, while it is charging and consuming power, there will be power on the USB port, but the arduino's consumption is very tiny regarding charging a phone. you need to disable this feature somehow.
  • [SOLVED] Just started, but already stuck

    Locked
    7
    0 Votes
    7 Posts
    2k Views
    nick van alstN
    Thank you guys, its all working now!
  • The Light Sensor can't be discoverd

    2
    0 Votes
    2 Posts
    602 Views
    mfalkviddM
    @Magic-W the light sensor sleeps most of the time, so it is not likely to see incoming messages. Try replacing sleep() with wait().
  • Battery powering

    27
    0 Votes
    27 Posts
    6k Views
    Nca78N
    Hello I gave you some tips for button cell on your other thread. In addition: if you are using interrupts only then your power consumption should be extremely low, I don't think it's necessary to wake up regularly to send battery level. If you don't do it then then you have even lower consumption because the watchdog timer is turned off, my CR2032 door/windows nodes using the sleep method from MySensors draws less than 2uA, there can be no visible change in battery level except if you leave your node in a closet for one year ;)
  • first tries with MySensors v2.0: problem staring up.

    9
    0 Votes
    9 Posts
    3k Views
    vgaV
    ok, thank you Yveaux for your help! to understand the mechanism, when the sensor node starts to search for parent again, why doesn´t it find the parent node, which used before?
  • [Solved] API 2.0 void receive(const MyMessage& message) Problem

    8
    0 Votes
    8 Posts
    2k Views
    paqorP
    @TheoL said: @paqor That's great. I looked at the Sketch you posted on your site and noticed you're still using a delay. Which as short as it may be can cause messages to be missed. void loop(){ //----------------------------------------------------------------------------- //TEMP_FEUCHTE delay(dht.getMinimumSamplingPeriod()); My advice is to do this with a wait as well. void loop(){ //----------------------------------------------------------------------------- //TEMP_FEUCHTE wait(dht.getMinimumSamplingPeriod()); // Changed ByTheo That way you don't block incoming messages. Generally, if you want your sketch to wait use a wait. genial, works perfectly....
  • Radio stop emitting after a few hours...

    8
    0 Votes
    8 Posts
    3k Views
    TheoLT
    @ybycode could be. I once had a MySensors project which used a speaker. The speaker was very close to the radio and that Node behaved just like yours. When I move the speaker away from the node it became stable. Not sure if an inductive speak could be the cause, when you use the break-out relays. But that's a good question for someone with more electronics knowledge. I've found a tutorial about watch dogs. It is a last resort, but adding a watchdog will reset your arduino if it stalls. It doesn't resolve the cause though. But I'm thinking about adding a watchdog to all of my sensors. Just to make sure they can't stall in case hardware related issues.
  • ESP8266 Gateway motion sensor only working when "serial monitor" open

    3
    0 Votes
    3 Posts
    2k Views
    O
    I started out with just the basics, but i get spammed out put of motion triggered and disregards if there is motion or not with the following code * 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> * Contribution by Ivo Pullens (ESP8266 support) * * DESCRIPTION * The EthernetGateway sends data received from sensors to the WiFi link. * The gateway also accepts input on ethernet interface, which is then sent out to the radio network. * * 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/esp8266_gateway for wiring instructions. * nRF24L01+ ESP8266 * VCC VCC * CE GPIO4 * CSN/CS GPIO15 * SCK GPIO14 * MISO GPIO12 * MOSI GPIO13 * GND GND * * Not all ESP8266 modules have all pins available on their external interface. * This code has been tested on an ESP-12 module. * The ESP8266 requires a certain pin configuration to download code, and another one to run code: * - Connect REST (reset) via 10K pullup resistor to VCC, and via switch to GND ('reset switch') * - Connect GPIO15 via 10K pulldown resistor to GND * - Connect CH_PD via 10K resistor to VCC * - Connect GPIO2 via 10K resistor to VCC * - Connect GPIO0 via 10K resistor to VCC, and via switch to GND ('bootload switch') * * Inclusion mode button: * - Connect GPIO5 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. */ #include <EEPROM.h> #include <SPI.h> // 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 9600 // Enables and select radio type (if attached) //#define MY_RADIO_NRF24 //#define MY_RADIO_RFM69 #define MY_GATEWAY_ESP8266 #define MY_ESP8266_SSID "home" #define MY_ESP8266_PASSWORD "********" // Enable UDP communication //#define MY_USE_UDP // Set the hostname for the WiFi Client. This is the hostname // it will pass to the DHCP server if not static. // #define MY_ESP8266_HOSTNAME "sensor-gateway" // 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 need to define Gateway and Subnet address as well #define MY_IP_GATEWAY_ADDRESS 192,168,1,254 #define MY_IP_SUBNET_ADDRESS 255,255,255,0 // The port to keep open on node server mode #define MY_PORT 5003 // How many clients should be able to connect to this gateway (default 1) #define MY_GATEWAY_MAX_CLIENTS 2 // Controller ip address. Enables client mode (default is "server" mode). // Also enable this if MY_USE_UDP is used and you want sensor data sent somewhere. //#define MY_CONTROLLER_IP_ADDRESS 192, 168, 178, 68 // 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 3 // Flash leds on rx/tx/err // #define MY_LEDS_BLINKING_FEATURE // Set blinking period // #define MY_DEFAULT_LED_BLINK_PERIOD 300 // Led pins used if blinking feature is enabled above #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 #if defined(MY_USE_UDP) #include <WiFiUDP.h> #else #include <ESP8266WiFi.h> #endif #include <SPI.h> #include <MySensors.h> #define DIGITAL_INPUT_SENSOR 3 // The digital input you attached your motion sensor. (Only 2 and 3 generates interrupt!) #define CHILD_ID 1 // Id of the sensor child // Initialize motion message MyMessage msg(CHILD_ID, V_TRIPPED); void setup() { pinMode(DIGITAL_INPUT_SENSOR, INPUT); // sets the motion sensor digital pin as input } void presentation() { // Present locally attached sensors here // Send the sketch version information to the gateway and Controller sendSketchInfo("Motion Sensor", "1.0"); // Register all sensors to gw (they will be created as child devices) present(CHILD_ID, S_MOTION); } void loop() { // Send locally attached sensors data here // Read digital motion value boolean tripped = digitalRead(DIGITAL_INPUT_SENSOR) == HIGH; Serial.println(tripped); send(msg.set(tripped?"1":"0")); // Send tripped value to gw } Thank you for the reply if i comment out all the debounce and re upload it then doesn't read the motion sensor and just out puts motion dectected at power up.
  • Livolo Wall Switch, 433.92mhz?

    1
    0 Votes
    1 Posts
    831 Views
    No one has replied

25

Online

11.7k

Users

11.2k

Topics

113.1k

Posts