Navigation

    • Register
    • Login
    • Search
    • OpenHardware.io
    • Categories
    • Recent
    • Tags
    • Popular
    1. Home
    2. Artur Csepregi
    • Profile
    • Following
    • Followers
    • Topics
    • Posts
    • Best
    • Groups

    Artur Csepregi

    @Artur Csepregi

    0
    Reputation
    1
    Posts
    160
    Profile views
    0
    Followers
    0
    Following
    Joined Last Online

    Artur Csepregi Follow

    Best posts made by Artur Csepregi

    This user hasn't posted anything yet.

    Latest posts made by Artur Csepregi

    • Adding Multiple Relay to Home Assistant

      Hello

      In struggling with adding more relays to Home assistant, till now only this sketch was working.
      but wit it I can add only 1 Relay, pleas help me to add more relays

      /*

      • Documentation: http://www.mysensors.org
      • Support Forum: http://forum.mysensors.org
      • http://www.mysensors.org/build/relay
        */

      #include <MySensor.h>
      #include <SPI.h>

      #define SN "Relay"
      #define SV "1.0"
      #define CHILD_ID 1
      #define RELAY_PIN 3

      MySensor gw;
      MyMessage msgRelay(CHILD_ID, V_STATUS);

      void setup()
      {
      gw.begin(incomingMessage);
      gw.sendSketchInfo(SN, SV);
      // Initialize the digital pin as an output.
      pinMode(RELAY_PIN, OUTPUT);
      gw.present(CHILD_ID, S_BINARY);
      gw.send(msgRelay.set(0));
      }

      void loop()
      {
      gw.process();
      }

      void incomingMessage(const MyMessage &message)
      {
      if (message.type == V_STATUS) {
      // Change relay state.
      digitalWrite(RELAY_PIN, message.getBool() ? 1 : 0);
      gw.send(msgRelay.set(message.getBool() ? 1 : 0));
      }
      }

      posted in Home Assistant
      Artur Csepregi
      Artur Csepregi