Skip to content

Troubleshooting

Help! Everything just falls apart
2.7k Topics 21.5k Posts
  • High current

    13
    0 Votes
    13 Posts
    3k Views
    AWIA
    @pansen What i meant is that the MySensors API only specifies the (hw) INT0/INT1 RISING/ FALLING/ CHANGE. All of these work as expected.
  • This topic is deleted!

    1
    0 Votes
    1 Posts
    6 Views
    No one has replied
  • Create relay free potential free switch.

    14
    0 Votes
    14 Posts
    3k Views
    gohanG
    The wait is specific for keeping the communications going while pausing the loop
  • [SPAM] The system halted between MSP430 and TPS3823

    1
    0 Votes
    1 Posts
    409 Views
    No one has replied
  • Multiple Sensors on Gateway

    5
    0 Votes
    5 Posts
    2k Views
    numanxN
    @gohan I understand what you are saying but if I am doing in that way I will spam the controller with the interrupts(flaps) right now it works like this if pin=0 send the state of the pin(the next update is when pin state changes), if pin=1 send the state and wait for 10 seconds for the next update. For the moment I have found a solution with millis[if(time%frequency==0)]: time=millis()/1000; if(time%10 ==0) Any suggestion for improving this part?
  • Openhab2 + mqtt: PIR working, switch does not

    2
    0 Votes
    2 Posts
    1k Views
    AstrofotografA
    Omg.. Topic can be closed. After hours and hours of search, try and error, I noticed I called the switch SW2 in the items file and SW1 in the sitemap..
  • Pro Mini + RFM node and ESP8266 + RFM gateway not working

    5
    0 Votes
    5 Posts
    1k Views
    mfalkviddM
    @mpp the esp stores (in a special area of the eeprom) ssid and key for the accesspoint it last connected to, and automatically connects back next time unless wifi is turned off in the sketch.
  • W5100 Gateway not getting an IP

    7
    0 Votes
    7 Posts
    1k Views
    gohanG
    Actually you can comment out the define of the gateway and use it as a simple gateway with sensors.
  • Troubleshoot Nano temp/humidity to ESP8266-MQTT gateway issue

    10
    0 Votes
    10 Posts
    3k Views
    mfalkviddM
    @mpp I've added a note to the MQTT gateway page, thanks for suggesting.
  • ESP8266 and RFM69 send issue

    13
    1 Votes
    13 Posts
    3k Views
    U
    @mpp it just started working at a certain point so I assumed my issue was just due to bad wiring. But I must say I stopped testing this configuration after a few days so there could be something else that I missed
  • delay different functions in loop

    2
    0 Votes
    2 Posts
    1k Views
    N
    After some hours of sleep and refactoring everything, now I think I've managed to get everything working. I have some problem wrapping my head around "forceTransmit" command and how it works. Also, millis() is also something I have to learn :) Here is the code if anyone finds it interesting. What it does is measure soil moisture every hour and sends info (normal forkthingie). Also reading every 30 seconds for temperature and humidity (si7021) If humidity changes by 1 or temperature by 0.2 it will send info. If no info has been sent it will force send info every 20 minutes. 3 Relays are there to power water pumps and a LED strip. i have now semi-learned the use of functions, which is fun :) cheers! /** * 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 * * DESCRIPTION * Example sketch showing how to control physical relays. * This example will remember relay state after power failure. * http://www.mysensors.org/build/relay */ // Enable debug prints to serial monitor #define MY_DEBUG //Network #define MY_NODE_ID 62 #define MY_PARENT_NODE_ID 0 #define MY_PARENT_NODE_IS_STATIC #define MY_RADIO_NRF24 //Includes #include <SPI.h> #include <MySensors.h> #include <SI7021.h> #include <RunningAverage.h> //Define Relay #define RELAY_1 3 // Arduino Digital I/O pin number for first relay (second on pin+1 etc) #define RELAY_2 4 // Arduino Digital I/O pin number for first relay (second on pin+1 etc) #define RELAY_3 5 // Arduino Digital I/O pin number for first relay (second on pin+1 etc) #define NUMBER_OF_RELAYS 3 // Total number of attached relays #define RELAY_ON 1 // GPIO value to write to turn on attached relay #define RELAY_OFF 0 // GPIO value to write to turn off attached relay #define RELEASE "1.4" //Define Moisture things #define AVERAGES 2 // Child sensor ID's #define CHILD_ID_TEMP 5 #define CHILD_ID_HUM 6 #define CHILD_ID_MOISTURE 7 // How many milli seconds between each measurement of temp and humidity #define MEASURE_INTERVAL 30000 // FORCE_TRANSMIT_INTERVAL, this number of times of wakeup, the sensor is forced to report all values to the controller #define FORCE_TRANSMIT_INTERVAL 2000 // 20minutes // HUMI_TRANSMIT_THRESHOLD tells how much the humidity should have changed since last time it was transmitted. Likewise with // TEMP_TRANSMIT_THRESHOLD for temperature threshold. #define HUMI_TRANSMIT_THRESHOLD 1.0 #define TEMP_TRANSMIT_THRESHOLD 0.2 #define round(x) ((x)>=0?(long)((x)+0.5):(long)((x)-0.5)) #define N_ELEMENTS(array) (sizeof(array)/sizeof((array)[0])) #define STABILIZATION_TIME 1000 // Let the sensor stabilize before reading SI7021 humiditySensor; // Sensor messages MyMessage msgHum(CHILD_ID_HUM, V_HUM); MyMessage msgTemp(CHILD_ID_TEMP, V_TEMP); MyMessage msgMoist(CHILD_ID_MOISTURE, V_HUM); MyMessage msgR1(RELAY_1, V_STATUS); MyMessage msgR2(RELAY_2, V_STATUS); // Global settings const unsigned long tUpdateTemp = 5000; // update interval unsigned long t0; const unsigned long tUpdateMoist = 360000; // update interval unsigned long t1; int measureCount = 0; boolean isMetric = true; boolean highfreq = true; boolean transmission_occured = false; // Storage of old measurements float lastTemperature = -100; int lastHumidity = -100; int oldMoistureLevel = -1; //Change direction on moisture byte direction = 0; //Moisture sensor pins RunningAverage raHum(AVERAGES); const int SENSOR_ANALOG_PINS[] = {A0, A1}; // Sensor is connected to these two pins. Avoid A3 if using ATSHA204. A6 and A7 cannot be used because they don't have pullups. void before() { for (int sensor=1, pin=RELAY_1; sensor<=NUMBER_OF_RELAYS; sensor++, pin++) { // Then set relay pins in output mode pinMode(pin, OUTPUT); // Set relay to last known state (using eeprom storage) digitalWrite(pin, loadState(sensor)?RELAY_ON:RELAY_OFF); } } void setup() { Serial.begin(115200); humiditySensor.begin(); isMetric = getControllerConfig().isMetric; Serial.print(F("isMetric: ")); Serial.println(isMetric); raHum.clear(); t0=millis(); t1=millis(); //sendTempHumidityMeasurements(true); //sendMoistureMeasurements(); delay(250); for (int i = 0; i < N_ELEMENTS(SENSOR_ANALOG_PINS); i++) { pinMode(SENSOR_ANALOG_PINS[i], OUTPUT); digitalWrite(SENSOR_ANALOG_PINS[i], LOW); } } void presentation() { // Send the sketch version information to the gateway and Controller sendSketchInfo("RelayTempHumMoist", "1.0"); for (int sensor=1, pin=RELAY_1; sensor<=NUMBER_OF_RELAYS; sensor++, pin++) { // Register all sensors to gw (they will be created as child devices) present(sensor, S_BINARY,"Relays"); } present(CHILD_ID_TEMP,S_TEMP,"Temperature"); present(CHILD_ID_HUM,S_HUM,"Humidity"); present(CHILD_ID_MOISTURE, S_HUM,"Moisture"); } void loop() { measureCount ++; bool forceTransmit = false; transmission_occured = false; if (measureCount > FORCE_TRANSMIT_INTERVAL) { forceTransmit = true; measureCount = 0; Serial.print(F("inne i loopen :")); } if ((millis() - t1) > tUpdateMoist) sendMoistureMeasurements(); sendTempHumidityMeasurements(forceTransmit); } void sendTempHumidityMeasurements(bool force) { wait(MEASURE_INTERVAL); bool tx = force; si7021_env data = humiditySensor.getHumidityAndTemperature(); raHum.addValue(data.humidityPercent); float diffTemp = abs(lastTemperature - (isMetric ? data.celsiusHundredths : data.fahrenheitHundredths)/100.0); float diffHum = abs(lastHumidity - raHum.getAverage()); Serial.print(F("TempDiff :"));Serial.println(diffTemp); Serial.print(F("HumDiff :"));Serial.println(diffHum); t0 = millis(); if (isnan(diffHum)) tx = true; if (diffTemp > TEMP_TRANSMIT_THRESHOLD) tx = true; if (diffHum > HUMI_TRANSMIT_THRESHOLD) tx = true; if (tx) { measureCount = 0; float temperature = (isMetric ? data.celsiusHundredths : data.fahrenheitHundredths) / 100.0; int humidity = data.humidityPercent; Serial.print("T: ");Serial.println(temperature); Serial.print("H: ");Serial.println(humidity); send(msgTemp.set(temperature,1)); send(msgHum.set(humidity)); lastTemperature = temperature; lastHumidity = humidity; transmission_occured = true; } } void sendMoistureMeasurements() { pinMode(SENSOR_ANALOG_PINS[direction], INPUT_PULLUP); // Power on the sensor analogRead(SENSOR_ANALOG_PINS[direction]);// Read once to let the ADC capacitor start charging sleep(STABILIZATION_TIME); int moistureLevel = (1023 - analogRead(SENSOR_ANALOG_PINS[direction])); // Turn off the sensor to conserve battery and minimize corrosion pinMode(SENSOR_ANALOG_PINS[direction], OUTPUT); digitalWrite(SENSOR_ANALOG_PINS[direction], LOW); direction = (direction + 1) % 2; // Make direction alternate between 0 and 1 to reverse polarity which reduces corrosion // Always send moisture information so the controller sees that the node is alive // Send rolling average of 2 samples to get rid of the "ripple" produced by different resistance in the internal pull-up resistors // See http://forum.mysensors.org/topic/2147/office-plant-monitoring/55 for more information if (oldMoistureLevel == -1) { // First reading, save value oldMoistureLevel = moistureLevel; } send(msgMoist.set((moistureLevel + oldMoistureLevel + 0.5) / 2 / 10.23, 1)); oldMoistureLevel = moistureLevel; t1 = millis(); } void receive(const MyMessage &message) { // We only expect one type of message from controller. But we better check anyway. if (message.type==V_STATUS) { // Change relay state digitalWrite(message.sensor-1+RELAY_1, message.getBool()?RELAY_ON:RELAY_OFF); // Store state in eeprom saveState(message.sensor, message.getBool()); // Write some debug info Serial.print("Incoming change for sensor:"); Serial.print(message.sensor); Serial.print(", New status: "); Serial.println(message.getBool()); } }```
  • Sensor dht+relay won't send data or present

    12
    0 Votes
    12 Posts
    2k Views
    MasMatM
    To follow up. It was hardware: broken vcc pin on the dht11 corrupted the whole sensor code badly. Resolder and added wait-code, inverted the on-off 0-vs-1 and I have a good working sensor. The duplicate is also installed and working reliably. A 6-relay board is also working nicely and Domoticz is great. My old system is nearly replaced and I couldnt be happier. Respect and thanks all around!
  • Presentation fails for one sensor but works for another

    6
    0 Votes
    6 Posts
    1k Views
    maghacM
    @Yveaux That's possible. When I apply the workaround above, it works on the second try, which is after a 1000ms delay. I'll try your suggestion and see if it helps.
  • N00b + MQTT gw + openHAB2

    26
    0 Votes
    26 Posts
    7k Views
    MasMatM
    @gohan gonna examine that too before actually hooking it up. Thanks
  • 0 Votes
    3 Posts
    2k Views
    T
    @user2684 Yes, that is the solution. Thanks a lot!
  • Is it possible to add a Sensor to a Gateway directly?

    5
    0 Votes
    5 Posts
    2k Views
    F
    Thanks for the answer. I tried this and it didn't work. I've started a thread in pimatic forum as well. Maybe they know how to do this. Thanks
  • W5100 Gateway hangs /freezes after some time.

    23
    0 Votes
    23 Posts
    5k Views
    FraidF
    Hi guys, I may found the issue. GW was powered from the NAS (for month) and I switched for a wall adapter. Now I'm able to ping GW without timeout...sorry (I see you guys coming....obviously it's a power issue :D !). GW has been running for one days now. Note: I'm using AVR 1.6.16 now, but i'm pretty sure, power was the real issue.
  • Signing fails with V2.1

    10
    0 Votes
    10 Posts
    3k Views
    G
    I am using MySensors 2.1.1 and see a lot of these messages 0;255;3;0;9;!TSF:MSG:SIGN VERIFY FAIL As a test I use 2 nodes with this same sketch: #include "arduino.h" #include <OneWire.h> #include <DallasTemperature.h> #define ONE_WIRE_BUS 5 OneWire oneWire(ONE_WIRE_BUS); DallasTemperature sensors(&oneWire); #define MY_DEBUG #define MY_RADIO_RFM69 #define MY_IS_RFM69HW #define MY_NODE_ID 11 // node 1 //#define MY_NODE_ID 12 // node 2 #define MY_DEFAULT_ERR_LED_PIN 9 #define MY_DEFAULT_RX_LED_PIN 8 #define MY_DEFAULT_TX_LED_PIN 7 #define MY_DEFAULT_LED_BLINK_PERIOD 20 #define MY_SIGNING_SOFT #define MY_SIGNING_SOFT_RANDOMSEED_PIN 3 #define MY_SIGNING_REQUEST_SIGNATURES #include <MySensors.h> MyMessage msg(MY_NODE_ID, V_TEMP); void presentation() { sendSketchInfo("Test temperature node", "1.0"); present(MY_NODE_ID, S_TEMP); } void setup() { sensors.begin(); } void loop() { sensors.requestTemperatures(); send(msg.set(sensors.getTempCByIndex(0), 2)); sleep(1000); } I use this serial gateway: #define MY_DEBUG #define MY_SIGNING_SOFT #define MY_SIGNING_SOFT_RANDOMSEED_PIN 3 #define MY_SIGNING_REQUEST_SIGNATURES #define MY_RADIO_RFM69 #define MY_IS_RFM69HW #define MY_GATEWAY_SERIAL #define MY_DEFAULT_LED_BLINK_PERIOD 10 #define MY_DEFAULT_ERR_LED_PIN 5 #define MY_DEFAULT_RX_LED_PIN 6 #define MY_DEFAULT_TX_LED_PIN 7 #include <SPI.h> #include <MySensors.h> void setup() {} void presentation() {} void loop() {} If I comment this line in the gateway everything works fine: //#define MY_SIGNING_REQUEST_SIGNATURES I only see these error messages when I turn on both nodes. If I use either Node 1 or Node 2 and turn the other off, I don't see any of these error messages. The nodes and gateway are on my workbench close next to each other. For each I use a bare ATMEGA328P burned with bootloader Pro Mini 3.3v 8 mhz
  • This topic is deleted!

    1
    0 Votes
    1 Posts
    13 Views
    No one has replied
  • ESP8266 + RFM69HW MQTT Gateway program persists

    1
    0 Votes
    1 Posts
    590 Views
    No one has replied

11

Online

11.7k

Users

11.2k

Topics

113.1k

Posts