Skip to content
  • MySensors
  • OpenHardware.io
  • Categories
  • Recent
  • Tags
  • Popular
Skins
  • Light
  • Brite
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Brand Logo
mimaretM

mimaret

@mimaret
About
Posts
17
Topics
5
Shares
0
Groups
0
Followers
0
Following
0

Posts

Recent Best Controversial

  • gateway MQTT
    mimaretM mimaret

    Hello,
    I'm trying to rebuild my Mysensors MQTT Gateway on an RPI and I'm getting compilation errors. I've searched the forums and found nothing. I've tried --branch master and --branch development without success. I don't know how to resolve this. Thanks.

    mm@gatewayx:~/MySensors $ sudo ./configure --my-controller-ip-address=192.168.0.30 --my-transport=rf24 --my-rf24-irq-pin=15 --my-gateway=mqtt --my-mqtt-publish-topic-prefix=mysensors-out --my-mqtt-subscribe-topic-prefix=mysensors-in --my-mqtt-client-id=gwmysensors --my-mqtt-user=mqtt --my-mqtt-password=x
    [SECTION] Detecting target machine.
      [OK] machine detected: SoC=BCM2835, Type=rpi1, CPU=armv6l.
    [SECTION] Detecting SPI driver.
      [OK] SPI driver detected:BCM.
    [SECTION] Gateway configuration.
      [OK] Type: mqtt.
      [OK] Transport: rf24.
      [OK] Signing: Disabled.
      [OK] Encryption: Disabled.
      [OK] CPPFLAGS: -march=armv6zk -mtune=arm1176jzf-s -mfpu=vfp -mfloat-abi=hard -DMY_RADIO_RF24 -DMY_GATEWAY_LINUX -DMY_GATEWAY_MQTT_CLIENT -DMY_DEBUG -DLINUX_SPI_BCM -DLINUX_ARCH_RASPBERRYPI -DMY_MQTT_PASSWORD="x" -DMY_MQTT_USER="mqtt" -DMY_MQTT_CLIENT_ID="gwmysensors" -DMY_MQTT_SUBSCRIBE_TOPIC_PREFIX="mysensors-in" -DMY_MQTT_PUBLISH_TOPIC_PREFIX="mysensors-out" -DMY_RX_MESSAGE_BUFFER_FEATURE -DMY_RF24_IRQ_PIN=15 -DMY_CONTROLLER_IP_ADDRESS=192,168,0,30
      [OK] CXXFLAGS:  -std=c++11
    [SECTION] Detecting init system.
      [OK] Init system detected: systemd.
    [SECTION] Saving configuration.
      [OK] Saved.
    [SECTION] Cleaning previous builds.
      [OK] Finished.
    mm@gatewayx:~/MySensors $ make
    gcc -MT build/hal/architecture/Linux/drivers/core/config.o -MMD -MP -march=armv6zk -mtune=arm1176jzf-s -mfpu=vfp -mfloat-abi=hard -DMY_RADIO_RF24 -DMY_GATEWAY_LINUX -DMY_GATEWAY_MQTT_CLIENT -DMY_DEBUG -DLINUX_SPI_BCM -DLINUX_ARCH_RASPBERRYPI -DMY_MQTT_PASSWORD=\"x\" -DMY_MQTT_USER=\"mqtt\" -DMY_MQTT_CLIENT_ID=\"gwmysensors\" -DMY_MQTT_SUBSCRIBE_TOPIC_PREFIX=\"mysensors-in\" -DMY_MQTT_PUBLISH_TOPIC_PREFIX=\"mysensors-out\" -DMY_RX_MESSAGE_BUFFER_FEATURE -DMY_RF24_IRQ_PIN=15 -DMY_CONTROLLER_IP_ADDRESS=192,168,0,30  -Ofast -g -Wall -Wextra  -I. -I./core -I./hal/architecture/Linux/drivers/core -I./hal/architecture/Linux/drivers/BCM -c hal/architecture/Linux/drivers/core/config.c -o build/hal/architecture/Linux/drivers/core/config.o
    gcc: internal compiler error: Illegal instruction signal terminated program cc1
    Please submit a full bug report,
    with preprocessed source if appropriate.
    See <file:///usr/share/doc/gcc-10/README.Bugs> for instructions.
    make: *** [Makefile:103: build/hal/architecture/Linux/drivers/core/config.o] Error 4
    mm@gatewayx:~/MySensors $ uname -a
    Linux gatewayx 6.1.21+ #1642 Mon Apr  3 17:19:14 BST 2023 armv6l GNU/Linux
    mm@gatewayx:~/MySensors $ uname -r
    6.1.21+
    mm@gatewayx:~/MySensors $ lsb_release -a
    No LSB modules are available.
    Distributor ID: Raspbian
    Description:    Raspbian GNU/Linux 11 (bullseye)
    Release:        11
    Codename:       bullseye
    
    General Discussion

  • Gateway on Raspberry pi 1
    mimaretM mimaret

    @eiten
    This is actually what I read while searching the docs. I will modify the sketches. In fact I have to modify 2 modules with DHT22 + 3 1-wire probes + 2 relays + 2 door contacts + pusher on an arduino nano RF. No problem and thanks again for your help.

    General Discussion

  • Gateway on Raspberry pi 1
    mimaretM mimaret

    Good morning,

    @eiten Thanks for your help .
    The Mysensors MQTT gateway works well with Home Assistant. I still have a little problem with the relays that I don't see in HA.
    I'll dig some more and I'll find it.
    Thank you again and see you soon.

    @OldSurferDude Thank you for your information.
    I just had a problem with the user-password

    General Discussion

  • Gateway on Raspberry pi 1
    mimaretM mimaret

    Good morning,

    I'm back. Thank you for your reply.
    I recompiled with branch development. I have warnings and when launching I have connection refused errors. I use home Assistant which cannot connect (port 5003 not open). I think the gateway cannot connect to HA (port 8123).
    What solution do you see to resolve this problem. I thought about MQTT, but in the options I don't see User and Password for MQTT.

    Thank you in advance and see you soon.

    General Discussion

  • Gateway on Raspberry pi 1
    mimaretM mimaret

    Good morning,

    I have a Raspberry 1 on which Domoticz and the Gayteway MySensors have been running for 4 years.
    I installed a new version of Linux (Raspberry Pi OS (Legacy) Lite Debian version: 11 (bullseye) and I redo a gateway config without Domoticz (I change controller). I find myself with a lot of errors when make. I tested both versions (--branch master and development)
    Do you think the Rpi is too old?

    Thank you for your answers

    mm@gateway:~/MySensors $ sudo ./configure --my-controller-ip-address=192.168.1.99 --my-transport=rf24 --my-rf24-irq-pin=15
    [SECTION] Detecting target machine.
      [OK] machine detected: SoC=BCM2835, Type=rpi1, CPU=armv6l.
    [SECTION] Detecting SPI driver.
      [OK] SPI driver detected:BCM.
    [SECTION] Gateway configuration.
      [OK] Type: ethernet.
      [OK] Transport: rf24.
      [OK] Signing: Disabled.
      [OK] Encryption: Disabled.
      [OK] CPPFLAGS: -march=armv6zk -mtune=arm1176jzf-s -mfpu=vfp -mfloat-abi=hard -DMY_RADIO_RF24 -DMY_GATEWAY_LINUX -DMY_DEBUG -DLINUX_SPI_BCM -DLINUX_ARCH_RASPBERRYPI -DMY_RX_MESSAGE_BUFFER_FEATURE -DMY_RF24_IRQ_PIN=15 -DMY_CONTROLLER_IP_ADDRESS=192,168,1,99
      [OK] CXXFLAGS:  -std=c++11
    [SECTION] Detecting init system.
      [OK] Init system detected: systemd.
    [SECTION] Saving configuration.
      [OK] Saved.
    [SECTION] Cleaning previous builds.
      [OK] Finished.
    mm@gateway:~/MySensors $ make
    gcc -MT build/hal/architecture/Linux/drivers/core/config.o -MMD -MP -march=armv6zk -mtune=arm1176jzf-s -mfpu=vfp -mfloat-abi=hard -DMY_RADIO_RF24 -DMY_GATEWAY_LINUX -DMY_DEBUG -DLINUX_SPI_BCM -DLINUX_ARCH_RASPBERRYPI -DMY_RX_MESSAGE_BUFFER_FEATURE -DMY_RF24_IRQ_PIN=15 -DMY_CONTROLLER_IP_ADDRESS=192,168,1,99  -Ofast -g -Wall -Wextra  -I. -I./core -I./hal/architecture/Linux/drivers/core -I./hal/architecture/Linux/drivers/BCM -c hal/architecture/Linux/drivers/core/config.c -o build/hal/architecture/Linux/drivers/core/config.o
    gcc -MT build/hal/architecture/Linux/drivers/core/log.o -MMD -MP -march=armv6zk -mtune=arm1176jzf-s -mfpu=vfp -mfloat-abi=hard -DMY_RADIO_RF24 -DMY_GATEWAY_LINUX -DMY_DEBUG -DLINUX_SPI_BCM -DLINUX_ARCH_RASPBERRYPI -DMY_RX_MESSAGE_BUFFER_FEATURE -DMY_RF24_IRQ_PIN=15 -DMY_CONTROLLER_IP_ADDRESS=192,168,1,99  -Ofast -g -Wall -Wextra  -I. -I./core -I./hal/architecture/Linux/drivers/core -I./hal/architecture/Linux/drivers/BCM -c hal/architecture/Linux/drivers/core/log.c -o build/hal/architecture/Linux/drivers/core/log.o
    g++ -MT build/hal/architecture/Linux/drivers/core/compatibility.o -MMD -MP -march=armv6zk -mtune=arm1176jzf-s -mfpu=vfp -mfloat-abi=hard -DMY_RADIO_RF24 -DMY_GATEWAY_LINUX -DMY_DEBUG -DLINUX_SPI_BCM -DLINUX_ARCH_RASPBERRYPI -DMY_RX_MESSAGE_BUFFER_FEATURE -DMY_RF24_IRQ_PIN=15 -DMY_CONTROLLER_IP_ADDRESS=192,168,1,99  -Ofast -g -Wall -Wextra -std=c++11 -I. -I./core -I./hal/architecture/Linux/drivers/core -I./hal/architecture/Linux/drivers/BCM -c hal/architecture/Linux/drivers/core/compatibility.cpp -o build/hal/architecture/Linux/drivers/core/compatibility.o
    g++ -MT build/hal/architecture/Linux/drivers/core/EthernetClient.o -MMD -MP -march=armv6zk -mtune=arm1176jzf-s -mfpu=vfp -mfloat-abi=hard -DMY_RADIO_RF24 -DMY_GATEWAY_LINUX -DMY_DEBUG -DLINUX_SPI_BCM -DLINUX_ARCH_RASPBERRYPI -DMY_RX_MESSAGE_BUFFER_FEATURE -DMY_RF24_IRQ_PIN=15 -DMY_CONTROLLER_IP_ADDRESS=192,168,1,99  -Ofast -g -Wall -Wextra -std=c++11 -I. -I./core -I./hal/architecture/Linux/drivers/core -I./hal/architecture/Linux/drivers/BCM -c hal/architecture/Linux/drivers/core/EthernetClient.cpp -o build/hal/architecture/Linux/drivers/core/EthernetClient.o
    g++ -MT build/hal/architecture/Linux/drivers/core/EthernetServer.o -MMD -MP -march=armv6zk -mtune=arm1176jzf-s -mfpu=vfp -mfloat-abi=hard -DMY_RADIO_RF24 -DMY_GATEWAY_LINUX -DMY_DEBUG -DLINUX_SPI_BCM -DLINUX_ARCH_RASPBERRYPI -DMY_RX_MESSAGE_BUFFER_FEATURE -DMY_RF24_IRQ_PIN=15 -DMY_CONTROLLER_IP_ADDRESS=192,168,1,99  -Ofast -g -Wall -Wextra -std=c++11 -I. -I./core -I./hal/architecture/Linux/drivers/core -I./hal/architecture/Linux/drivers/BCM -c hal/architecture/Linux/drivers/core/EthernetServer.cpp -o build/hal/architecture/Linux/drivers/core/EthernetServer.o
    g++ -MT build/hal/architecture/Linux/drivers/core/GPIO.o -MMD -MP -march=armv6zk -mtune=arm1176jzf-s -mfpu=vfp -mfloat-abi=hard -DMY_RADIO_RF24 -DMY_GATEWAY_LINUX -DMY_DEBUG -DLINUX_SPI_BCM -DLINUX_ARCH_RASPBERRYPI -DMY_RX_MESSAGE_BUFFER_FEATURE -DMY_RF24_IRQ_PIN=15 -DMY_CONTROLLER_IP_ADDRESS=192,168,1,99  -Ofast -g -Wall -Wextra -std=c++11 -I. -I./core -I./hal/architecture/Linux/drivers/core -I./hal/architecture/Linux/drivers/BCM -c hal/architecture/Linux/drivers/core/GPIO.cpp -o build/hal/architecture/Linux/drivers/core/GPIO.o
    hal/architecture/Linux/drivers/core/GPIO.cpp: In constructor ‘GPIOClass::GPIOClass()’:
    hal/architecture/Linux/drivers/core/GPIO.cpp:53:50: warning: ‘%s’ directive output may be truncated writing up to 255 bytes into a region of size 48 [-Wformat-truncation=]
       53 |    snprintf(file, sizeof(file), "/sys/class/gpio/%s/base", de->d_name);
          |                                                  ^~
    hal/architecture/Linux/drivers/core/GPIO.cpp:53:12: note: ‘snprintf’ output between 22 and 277 bytes into a destination of size 64
       53 |    snprintf(file, sizeof(file), "/sys/class/gpio/%s/base", de->d_name);
          |    ~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    hal/architecture/Linux/drivers/core/GPIO.cpp:62:50: warning: ‘%s’ directive output may be truncated writing up to 255 bytes into a region of size 48 [-Wformat-truncation=]
       62 |    snprintf(file, sizeof(file), "/sys/class/gpio/%s/ngpio", de->d_name);
          |                                                  ^~
    hal/architecture/Linux/drivers/core/GPIO.cpp:62:12: note: ‘snprintf’ output between 23 and 278 bytes into a destination of size 64
       62 |    snprintf(file, sizeof(file), "/sys/class/gpio/%s/ngpio", de->d_name);
          |    ~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    g++ -MT build/hal/architecture/Linux/drivers/core/interrupt.o -MMD -MP -march=armv6zk -mtune=arm1176jzf-s -mfpu=vfp -mfloat-abi=hard -DMY_RADIO_RF24 -DMY_GATEWAY_LINUX -DMY_DEBUG -DLINUX_SPI_BCM -DLINUX_ARCH_RASPBERRYPI -DMY_RX_MESSAGE_BUFFER_FEATURE -DMY_RF24_IRQ_PIN=15 -DMY_CONTROLLER_IP_ADDRESS=192,168,1,99  -Ofast -g -Wall -Wextra -std=c++11 -I. -I./core -I./hal/architecture/Linux/drivers/core -I./hal/architecture/Linux/drivers/BCM -c hal/architecture/Linux/drivers/core/interrupt.cpp -o build/hal/architecture/Linux/drivers/core/interrupt.o
    hal/architecture/Linux/drivers/core/interrupt.cpp:33:10: fatal error: stropts.h: No such file or directory
       33 | #include <stropts.h>
          |          ^~~~~~~~~~~
    compilation terminated.
    make: *** [Makefile:99: build/hal/architecture/Linux/drivers/core/interrupt.o] Error 1
    mm@gateway:~/MySensors $
    
    
    General Discussion

  • Repeater node crashes
    mimaretM mimaret

    A big thank you for your contribution. I modified the program according to your proposals. Everything is working. I am attaching you the pieces of code relating to the door contact.
    My problem is solved.

    .
    .
    .
      attachInterrupt(digitalPinToInterrupt(DOOR_PIN), DoorMoving, CHANGE);
      DoorChange = 1;
      LastDoor = 0;
    }
    void DoorMoving() {
        DoorChange = 1;
    }
    
    void readDoor() {
      if (DoorChange) {
        boolean Door = (digitalRead(DOOR_PIN));
        if (Door != LastDoor) {
          send(msgDoor.set((Door) == HIGH ? 1 : 0));
          LastDoor = Door;
          DoorChange = 0;
        }
      }
    }
    .
    .
    .
    void loop() {
      unsigned long currentMillis = millis();
      readDoor();
      if (currentMillis - previousMillis >= UPDATE_INTERVAL) {
        previousMillis = currentMillis;
        readDHT();
        read1Wire();
      }
    }
    Troubleshooting

  • Repeater node crashes
    mimaretM mimaret

    There is no restart. Only the interrupt executes when I open the door contact. The Loop () does not continue. I did not cut anything, I just added the crash line as soon as the program stopped.

    Troubleshooting

  • Repeater node crashes
    mimaretM mimaret

    In fact, the node no longer executes the program and the only solution is to restart it with a reset or switch off the power supply.

    Troubleshooting

  • Repeater node crashes
    mimaretM mimaret

    OOPS :

    19820560 TSF:MSG:SEND,111-111-0-0,s=2,c=1,t=16,pt=2,l=2,sg=0,ft=0,st=OK:0
    ------> Door
    19820560 TSF:MSG:SEND,111-111-0-0,s=2,c=1,t=16,pt=2,l=2,sg=0,ft=0,st=OK:0
    ------> Door
    19825700 TSF:MSG:SEND,111-111-0-0,s=2,c=1,t=16,pt=2,l=2,sg=0,ft=0,st=OK:1
    ------> Door
    19826745 !TSF:MSG:SEND,111-111-0-0,s=2,c=1,t=16,pt=2,l=2,sg=0,ft=0,st=NACK:0
    ------> Door
    19826745 TSF:MSG:SEND,111-111-0-0,s=2,c=1,t=16,pt=2,l=2,sg=0,ft=1,st=OK:0
    19826747 TSF:MSG:READ,255-255-255,s=255,c=7,t=255,pt=7,l=25,sg=1: 0
    19826755 !TSF:MSG:LEN,7!=32
    ------> readDHT
    20105310 TSF:MSG:SEND,111-111-0-0,s=0,c=1,t=1,pt=7,l=5,sg=0,ft=0,st=OK:42.4
    H: 42.40
    ------> read1Wire
    20105426
    ------> readDHT
    20405309 TSF:MSG:SEND,111-111-0-0,s=1,c=1,t=0,pt=7,l=5,sg=0,ft=0,st=OK:21.8
    T: 21.80
    20405323 TSF:MSG:SEND,111-111-0-0,s=0,c=1,t=1,pt=7,l=5,sg=0,ft=0,st=OK:42.1
    H: 42.10
    ------> read1Wire
    20405440
    20700045 TSF:SAN:OK
    ------> readDHT
    20705310 TSF:MSG:SEND,111-111-0-0,s=0,c=1,t=1,pt=7,l=5,sg=0,ft=0,st=OK:41.9
    H: 41.90
    ------> read1Wire
    20705427
    ------> Door
    20707352 !TSF:MSG:SEND,111-111-0-0,s=2,c=1,t=16,pt=2,l=2,sg=0,ft=0,st=NACK:1
    ------> Door
    20707352 TSF:MSG:SEND,111-111-0-0,s=2,c=1,t=16,pt=2,l=2,sg=0,ft=1,st=OK:0
    ------> Door
    20723965 TSF:MSG:SEND,111-111-0-0,s=2,c=1,t=16,pt=2,l=2,sg=0,ft=0,st=OK:1
    ------> Door
    20725862 TSF:MSG:SEND,111-111-0-0,s=2,c=1,t=16,pt=2,l=2,sg=0,ft=0,st=OK:0
    ------> Door
    20725862 TSF:MSG:SEND,111-111-0-0,s=2,c=1,t=16,pt=2,l=2,sg=0,ft=0,st=OK:0
    <------------------------------------CRASH-----------------
    ------> Door
    20729143 TSF:MSG:SEND,111-111-0-0,s=2,c=1,t=16,pt=2,l=2,sg=0,ft=0,st=OK:1
    ------> Door
    20730232 TSF:MSG:SEND,111-111-0-0,s=2,c=1,t=16,pt=2,l=2,sg=0,ft=0,st=OK:0
    ------> Door
    20730232 TSF:MSG:SEND,111-111-0-0,s=2,c=1,t=16,pt=2,l=2,sg=0,ft=0,st=OK:0
    
    Troubleshooting

  • Repeater node crashes
    mimaretM mimaret

    @mfalkvidd Thank you for your reply.
    I do not think about power problem. The power supply can deliver 1A and I mounted a capacitor of 470 uF on the 3.3v and a 47 uF close to the radio module. I had doubts about hardware and I set up a second repeater.
    On the first repeater, radio module nrf24L01 + PA + LNA. On the second repeater, radio module nrf24L01 +. Same problem.
    When the repeater crashes, the interrupt is executed again. The led pin 13 that I do not manage is ON during normal operation and goes OFF when the repeater crashes.
    I noticed that by disabling the interrupt (// attachInterrupt (....), the repeater does not crash.
    I will look how to check the state of memory, stack, etc.
    I also include the debug output and I do not see anything particular.

    Troubleshooting

  • Repeater node crashes
    mimaretM mimaret

    @rejoe2 Thank you for your reply.
    I seemed to have read that for a repeater it was necessary to replace delay () by wait (). . .
    I will adapt my program according to your recommendations and keep you informed.

    Troubleshooting

  • Repeater node crashes
    mimaretM mimaret

    The code is inspired by MySensors sketchs :

    /******************
      MM Octobre 2017
    *******************
     1.5 remplacé Delay() par Wait()
         Update intervalle 5 min
         readDHT() : wait(1100)
    */
    #define MY_REPEATER_FEATURE
    // Enable debug prints
    //#define MY_DEBUG
    
    // Enable and select radio type attached
    #define MY_RADIO_NRF24
    
    #define MY_RF24_PA_LEVEL RF24_PA_MAX
    
    #define MY_NODE_ID 111
    #define SketchName "Buanderie"
    #define SketchVer "1.5"
    
    #include <SPI.h>
    #include <MyConfig.h>
    #include <MySensors.h>
    #include <DHT.h>
    #include <OneWire.h>
    #include <DallasTemperature.h>
    
    #define ONE_WIRE_BUS 5
    #define DHT_DATA_PIN 3
    #define DOOR_PIN 2
    #define DHTTYPE DHT22
    
    // Set this offset if the sensor has a permanent small offset to the real temperatures
    #define SENSOR_TEMP_OFFSET 0
    
    // Sleep time between sensor updates (in milliseconds)
    // Must be >1000ms for DHT22 and >2000ms for DHT11
    static const uint64_t UPDATE_INTERVAL = 5 * 60000;
    
    // Force sending an update of the temperature after n sensor reads, so a controller showing the
    // timestamp of the last update doesn't show something like 3 hours in the unlikely case, that
    // the value didn't change since;
    // i.e. the sensor would force sending an update every UPDATE_INTERVAL*FORCE_UPDATE_N_READS [ms]
    static const uint8_t FORCE_UPDATE_N_READS = 10;
    
    #define CHILD_ID_HUM 0
    #define CHILD_ID_TEMP 1
    #define CHILD_ID_DOOR 2
    #define CHILD_ID_1WIRE 3
    
    float lastTemp;
    float lastHum;
    float lastTemp1W;
    uint8_t nNoUpdatesTemp;
    uint8_t nNoUpdatesHum;
    uint8_t nNoUpdatesTemp1W;
    
    MyMessage msgHum(CHILD_ID_HUM, V_HUM);
    MyMessage msgTemp(CHILD_ID_TEMP, V_TEMP);
    MyMessage msgDoor(CHILD_ID_DOOR, V_TRIPPED);
    MyMessage msg1W(CHILD_ID_1WIRE, V_TEMP);
    
    DHT dht;
    OneWire oneWire(ONE_WIRE_BUS); // Setup a oneWire instance to communicate with any OneWire devices (not just Maxim/Dallas temperature ICs)
    DallasTemperature sensors(&oneWire); // Pass our oneWire reference to Dallas Temperature.
    DeviceAddress insideThermometer;
    
    void presentation() {
      sendSketchInfo(SketchName, SketchVer);
    
      // Register all sensors to gw (they will be created as child devices)
      present(CHILD_ID_HUM, S_HUM);
      present(CHILD_ID_TEMP, S_TEMP);
      present(CHILD_ID_DOOR, S_DOOR);
      present(CHILD_ID_1WIRE, S_TEMP);
    }
    
    void setup() {
      analogReference(INTERNAL);
      wait(500);
      pinMode(DOOR_PIN, INPUT_PULLUP);
      digitalWrite(DOOR_PIN, HIGH);
    
      oneWire.reset_search();
      // assigns the first address found to insideThermometer
      if (!oneWire.search(insideThermometer)) {
      }
      sensors.setResolution(insideThermometer, 9);
    
      dht.setup(DHT_DATA_PIN); // set data pin of DHT sensor
      sleep(dht.getMinimumSamplingPeriod());
      attachInterrupt(digitalPinToInterrupt(DOOR_PIN), DoorMoving, CHANGE);
    }
    
    void DoorMoving() {
        Serial.println("------> Door");
        send(msgDoor.set(digitalRead(DOOR_PIN) == HIGH ? 1 : 0));
    }
    
    void read1Wire() {
      sensors.requestTemperatures(); // Send the command to get temperatures
      float tempC = sensors.getTempC(insideThermometer);
      if (tempC != lastTemp1W  && tempC > -50.00 && tempC != 85.00 || nNoUpdatesTemp1W == FORCE_UPDATE_N_READS) {
        send(msg1W.set(tempC, 1));
        lastTemp1W = tempC;
        nNoUpdatesTemp1W = 0;
    #ifdef MY_DEBUG
        Serial.print("Temp 1Wire C: "); Serial.println(tempC);
    #endif
      } else
        nNoUpdatesTemp1W++;
    }
    
    void readDHT() {
      // Force reading sensor, so it works also after sleep()
      dht.readSensor(true);
      wait(1100);
      // Get temperature from DHT library
      float temperature = dht.getTemperature();
      if (isnan(temperature)) {
        Serial.println("T DHT!");
      } else if (temperature != lastTemp || nNoUpdatesTemp == FORCE_UPDATE_N_READS) {
        // Only send temperature if it changed since the last measurement or if we didn't send an update for n times
        lastTemp = temperature;
        // Reset no updates counter
        nNoUpdatesTemp = 0;
        temperature += SENSOR_TEMP_OFFSET;
        send(msgTemp.set(temperature, 1));
    
    #ifdef MY_DEBUG
        Serial.print("T: "); Serial.println(temperature);
    #endif
      } else {
        // Increase no update counter if the temperature stayed the same
        nNoUpdatesTemp++;
      }
    
      // Get humidity from DHT library
      float humidity = dht.getHumidity();
      if (isnan(humidity)) {
        Serial.println("H DHT");
      } else if (humidity != lastHum || nNoUpdatesHum == FORCE_UPDATE_N_READS) {
        // Only send humidity if it changed since the last measurement or if we didn't send an update for n times
        lastHum = humidity;
        // Reset no updates counter
        nNoUpdatesHum = 0;
        send(msgHum.set(humidity, 1));
    
    #ifdef MY_DEBUG
        Serial.print("H: "); Serial.println(humidity);
    #endif
      } else {
        // Increase no update counter if the humidity stayed the same
        nNoUpdatesHum++;
      }
    }
    
    void loop() {
      Serial.println("------> readDHT");
      readDHT();
      Serial.println("------> read1Wire");
      read1Wire();
      Serial.println("------> wait");
      wait(UPDATE_INTERVAL);
    }
    
    Troubleshooting

  • Repeater node crashes
    mimaretM mimaret

    In addition to my previous post:
    I use the MySensors 2.1.1 library and I tested with 2.2.0 rc2. same result.
    IDE 1.8.0
    I also noticed that the led pin 13 is off on the sensors and adding (#define MY_REPEATER_FEATURE), the led remains on.

    Troubleshooting

  • Repeater node crashes
    mimaretM mimaret

    Hello,

    I mounted sensors on an Arduino pro mini 3.3v, radio nrf24 managing a DHT22, a 1Wire 18b20 and a door contact under interruption. Everything is working very well.
    On this basis, I created a repeater (#define MY_REPEATER_FEATURE) by replacing the Delay () statement with Wait (). The repeater crashes during the Wait () statement, but interrupts still work. I turned off the interrupt and the repeater does not crash anymore.
    Do you have an idea

    Thank you for your answers.

    Troubleshooting

  • Gateway ethernet Raspberry + sensors
    mimaretM mimaret

    Thank you for your answers. I wanted to avoid an Arduino. I think I will install the gateway on the OpenHabianpi Raspi and use an arduino as a sensor.

    Development

  • Gateway ethernet Raspberry + sensors
    mimaretM mimaret

    Hello,

    I have developed a sensor based on Arduino pro mini 3.3v with a DHT 22, an 18b20, a door contact and a battery check. Apart from the battery check which is not satisfactory, everything works very well. This sensor communicates (nrf24 ...) with a gateway ethernet (Mysgw) based on a raspberry. The Gateway communicates with the Openhab 2.0 controller (Openhabianpi). I also have an older generation TellStick module on the controller that works well.
    My questions are: Is it possible to add a DHT22 on the gateway? Is it possible to use the Arduino code on mysgw.cpp? How to communicate between the probe part and the gateway part on the gateway?
    Thank you for your answers and especially for your work.

    Development

  • openHAB 1.8.3 binding
    mimaretM mimaret

    Hi
    I OpenHAB 1.8.3 installed on raspberry. What binding .jar use?
    I also installed an Ethernet gateway to another Raspberry.
    Thank you for your reply.

    OpenHAB
  • Login

  • Don't have an account? Register

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