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
DickD

Dick

@Dick
About
Posts
144
Topics
28
Shares
0
Groups
0
Followers
1
Following
2

Posts

Recent Best Controversial

  • gw send, how to do in my combination of sensors
    DickD Dick

    @TheoL My Domoticz works again, I have to give it a fix ip because the IP was change and for your info, Your solution worked very well. It is now visible in Domoticz. Thanks for the support now I have to wait for other parts, I wait for my last parts for this project, an IR receiver so I can use a remote controle. After that I can use this project as a universal project, a default design in basic.
    Again thanks!

    General Discussion

  • temp sensor keep on loging status switch
    DickD Dick

    that was easy, I do it right away. Thanks for the support and this stopped me for changing other parts of the event of the code of the sensor.
    Have a nice day!

    General Discussion

  • Cobine working DHT22 and LDR with a RelayWithButtonActuator
    DickD Dick

    @alexsh1
    That could I do, thanks for the tip and will do that today. Any idea is welcome :smiley:

    Development dht22 ldr relay

  • 💬 Temperature Sensor
    DickD Dick

    @mfalkvidd I ony can tell "thanksfo the support ad you time" . Have a nice wekend!!!

    Announcements

  • pir combination with working 4-relay and 4 buttons
    DickD Dick

    thats logic, I hoped that I learned something in the last cople of days but trouble shooting is something else. Thank you for your advise and go on with testing and adding other devises.

    General Discussion

  • No matching function for call 'DHT::DHT()'
    DickD Dick

    @mfalkvidd You are right. This was the problem. I forgot to check that. thanks for the Direction!

    Development

  • Multiple DHT22 in one sensor for greenhouse (newbee question)
    DickD Dick

    At least I was able to test it. The solution worked perfect. Thanks for the support and I continue to finsh my project by implementing it at home. have a nice day. Bests
    Dick

    Troubleshooting multiple dht22

  • pir combination with working 4-relay and 4 buttons
    DickD Dick

    I finaly made it 4 buttons, 4 relay and a pir and here the script for sharing

    #include <MySensor.h>
    #include <SPI.h>
    #include "Bounce2.h"
    #define USE_MOTION_SENSOR
    #define MOTION_SENSOR_PIN    3
    #define RELAY_ON 0                      // switch around for realy HIGH/LOW state
    #define RELAY_OFF 1
    
    Bounce motionsDebouncer = Bounce();
    //
    MySensor gw;
    
    #define RADIO_ID 11                    // radio Id, whatever channel you assigned to
    #define noRelays 4
    const int relayPin[] = {A1, A2, A3, A4}; //  switch around pins to your desire
    const int buttonPin[] = {A5, 6, 7, 8}; //  switch around pins to your desire
    
    class Relay             // relay class, store all relevant data (equivalent to struct)
    {
    public: 
      int buttonPin;                    // physical pin number of button
      int relayPin;                     // physical pin number of relay
      byte oldValue;                    // last Values for key (debounce)
      boolean relayState;               // relay status (also stored in EEPROM)
    };
    
    Relay Relays[noRelays];
    Bounce debouncer[noRelays];
    MyMessage msg[noRelays];
    
    void setup()
    {
      gw.begin(incomingMessage, RADIO_ID, true);
      delay(250);
      gw.sendSketchInfo("Multy-Relay&Pulsanti", "0.2");
      delay(250);
    
      pinMode( MOTION_SENSOR_PIN, INPUT_PULLUP );
      motionsDebouncer.attach(MOTION_SENSOR_PIN);
      motionsDebouncer.interval(50);
    
      // Initialize Relays with corresponding buttons
      for (int i = 0; i < noRelays; i++)
      {
        Relays[i].buttonPin = buttonPin[i];              // assign physical pins
        Relays[i].relayPin = relayPin[i];
        msg[i].sensor = i;                                   // initialize messages
        msg[i].type = V_LIGHT;
        debouncer[i] = Bounce();                        // initialize debouncer
        debouncer[i].attach(buttonPin[i]);
        debouncer[i].interval(5);
        pinMode(Relays[i].buttonPin, INPUT_PULLUP);
        pinMode(Relays[i].relayPin, OUTPUT);
        Relays[i].relayState = gw.loadState(i);                               // retrieve last values from EEPROM
        digitalWrite(Relays[i].relayPin, Relays[i].relayState ? RELAY_ON : RELAY_OFF); // and set relays accordingly
        gw.send(msg[i].set(Relays[i].relayState ? true : false));                 // make controller aware of last status
        gw.present(i, S_LIGHT);                               // present sensor to gateway
        delay(250);
    
      }
    }
    
    void loop()
    {
      if ( motionsDebouncer.update()) {
        int value = motionsDebouncer.read();
        Serial.println( "Motion sensor is " + (String)value );
      }
    {
      gw.process();
      for (byte i = 0; i < noRelays; i++)
      {
        debouncer[i].update();
        byte value = debouncer[i].read();
        if (value != Relays[i].oldValue && value == 0)
        {
          Relays[i].relayState = !Relays[i].relayState;
          digitalWrite(Relays[i].relayPin, Relays[i].relayState ? RELAY_ON : RELAY_OFF);
          gw.send(msg[i].set(Relays[i].relayState ? true : false));
          gw.saveState( i, Relays[i].relayState );
        }                 // save sensor state in EEPROM (location == sensor number)
    
        Relays[i].oldValue = value;
      }
      }
    }
    
    // process incoming message
    void incomingMessage(const MyMessage &message)
    {
    
      if (message.type == V_LIGHT)
      {
        if (message.sensor < noRelays)            // check if message is valid for relays..... previous line  [[[ if (message.sensor <=noRelays){ ]]]
        {
          Relays[message.sensor].relayState = message.getBool();
          digitalWrite(Relays[message.sensor].relayPin, Relays[message.sensor].relayState ? RELAY_ON : RELAY_OFF); // and set relays accordingly
          gw.saveState( message.sensor, Relays[message.sensor].relayState ); // save sensor state in EEPROM (location == sensor number)
        }
      }
      delay( 50 ); // give the input pins some rest. Incomming messages are still being processed.
    }
    
    General Discussion

  • error auto restart pi
    DickD Dick

    @mfalkvidd I did not noticed that, I changed it to disabled and will monitor it during the upcomming days. Thanks for the tip!

    Domoticz

  • Not all Relais visible in Domoticz
    DickD Dick

    @mfalkvidd thanks for your support and no errors anymore. Unfortunately it did not work forme. probably I split my sensors in to, one with the relais switches and 1 with the binary buttons. I think that is the only way to continue right now.

    Development

  • delay for LDR sensor
    DickD Dick

    YES yes yes, I did not see that one. Your solution is working perfect also with the difference in light (5%).

    Thank you for the support and have a nice weekend

    General Discussion

  • one button code lock
    DickD Dick

    @mfalkvidd , I added the change you advised and no erroros in the compilation anymore.
    I will post the result after my testing of the project. Thanks for the support.

    General Discussion

  • pir trigger must start delay
    DickD Dick

    @m26872
    thanks for the short lesson. I change the code it test it.

    General Discussion

  • Upgraded to 2.11 and Domoticz 3.513. On/Off will not switch
    DickD Dick

    @sundberg84 Yes that is right but I just finished testing. I use 4 relays in a script but physicaly there are only 2 relays attached and from the other two I only us the " 0" to open or clos my curtains and thiose channels are not working. Clicking on the nano itself (on the button pin) than then curtains open/close.
    Finaly I dir " clear Eeprom" and that did the job. It is working (for now).

    General Discussion
  • Login

  • Don't have an account? Register

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