Navigation

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

    Homer

    @Homer

    18
    Reputation
    157
    Posts
    981
    Profile views
    0
    Followers
    1
    Following
    Joined Last Online

    Homer Follow

    Best posts made by Homer

    • RF433 Hub for controlling Watts Clever switches

      Hi everyone!

      I would like to share with you all something that I have been working on for some time. It isn't my first project, but it is the first that I have shared in this way, and I must say that I am a little excited haha

      BACKGROUND

      A couple years ago I was at my local electronics store and they had a sale on some wall switches which were controllable using rf433. Each box had two switches as well as a hub that converted an infrared signal into rf433 which the individual switches were able to learn so they could be turned on and off. At that time I was playing around with Mysensors but had only made a couple relays, temp nodes and the like. I bought these at the time with the intention of using my Harmony Remote Hub to operate the switches. 3 years ago will finally moved into our new home, and while doing so we somehow misplaced the whole Harmony setup, so up until a couple months ago these switches gathered dust in the garage.

      Fast forward to a couple months ago, and with the help of some awesome members here, I was able to build a Mysensors RF433 Hub wot control all 6 of my switches. I had used a little maths to work out the signals, and even though I had only had 3 of the switches enter use, they seemed to be working as they should; that was until a couple days ago when I noticed that my pool pump which was powered through one of my switches was turning on every day at 1pm, despite no scenes in my controller (Vera 3) doing so. Long story short (haha) I worked out that when my fish tank lights turned on at 1pm, that switches frequency must have been too similar to the pool pump!

      So the last couple days I have been doing lots of searching, and hopefully a little learning. I was going to use the Candle Signal Hub, but ended up doing something on my own. I was lucky and found someone else on the internet who also had 6 plugs and had shared the code for each switch, which was very helpful!

      It's probably time for me to stop rambling lol so first here are some pics:

      The Switch
      0_1558261451143_switch.jpg

      The Hub
      0_1558261488775_node.jpg

      Please excuse all the extra wires on the Nano; it stopped being recognised by all my computers so I had to program it using an FTDI adaptor.

      Here is the sketch. I am certain that it could be tidied up a lot.

      // Enable debug prints to serial monitor
      //#define MY_DEBUG
      
      // Enable and select radio type attached
      #define MY_RADIO_NRF24
      //#define MY_RADIO_RFM69
      
      // Enable repeater functionality for this node
      #define MY_REPEATER_FEATURE
      
      #include <SPI.h>
      #include <MySensors.h>
      #include <RCSwitch.h>
      
      #define MY_NODE_ID AUTO
      
      #define NUMBER_OF_PLUGS 6 // Total number of attached plugs
      
      #define SHORTPULSE 316
      #define LONGPULSE 818
      
      #define CODE_1On 4072574
      #define CODE_1Off 4072566
      #define CODE_2On 4072572
      #define CODE_2Off 4072564
      #define CODE_3On 4072570
      #define CODE_3Off 4072562
      #define CODE_4On 1386894
      #define CODE_4Off 1386886
      #define CODE_5On 1386892
      #define CODE_5Off 1386884
      #define CODE_6On 1386890
      #define CODE_6Off 1386882
      
      
      
      RCSwitch mySwitch = RCSwitch();
      
      void setup() {
        mySwitch.enableTransmit(4);
        mySwitch.setRepeatTransmit(15);
      }
      
      void presentation()
      {
        // Send the sketch version information to the gateway and Controller
        sendSketchInfo("433mhz HUB", "2.0");
      
        for (int sensor = 1 ; sensor <= NUMBER_OF_PLUGS; sensor++) {
          // Register all sensors to gw (they will be created as child devices)
          present(sensor, S_LIGHT);
        }
      }
      
      
      void loop()
      {
      
      }
      
      void receive(const MyMessage &message) {
        // We only expect one type of message from controller. But we better check anyway.
        if (message.type == V_LIGHT) {
          int incomingLightState =  message.getBool();
          int incomingOutlet = message.sensor;
      
          Serial.print("Outlet #: ");
          Serial.println(message.sensor);
          Serial.print("Command: ");
          Serial.println(message.getBool());
      
          if (incomingOutlet == 1) {
            if (incomingLightState == 1) {
              // Turn on  socket 1
              Serial.println("Turn on Socket 1");
              mySwitch.send(CODE_1On, 24); // These codes are unique to each outlet
              delay(50);
            }
            if (incomingLightState == 0)  {
              // Turn off socket 1
              Serial.println("Turn off Socket 1");
              mySwitch.send(CODE_1Off, 24);
              delay(50);
            }
          }
          if (incomingOutlet == 2) {
            if (incomingLightState == 1) {
              // Turn on  socket 2
              Serial.println("Turn on Socket 2");
              mySwitch.send(CODE_2On, 24);
              delay(50);
            }
            if (incomingLightState == 0)  {
              // Turn off socket 2
              Serial.println("Turn off Socket 2");
              mySwitch.send(CODE_2Off, 24);
              delay(50);
            }
          }
          if (incomingOutlet == 3) {
            if (incomingLightState == 1) {
              // Turn on  socket 3
              Serial.println("Turn on Socket 3");
              mySwitch.send(CODE_3On, 24);
              delay(50);
            }
            if (incomingLightState == 0)  {
              // Turn off socket 3
              Serial.println("Turn off Socket 3");
              mySwitch.send(CODE_3Off, 24);
              delay(50);
            }
          }
          if (incomingOutlet == 4) {
            if (incomingLightState == 1) {
              // Turn on  socket 4
              Serial.println("Turn on Socket 4");
              mySwitch.send(CODE_4On, 24);
              delay(50);
            }
            if (incomingLightState == 0)  {
              // Turn off socket 4
              Serial.println("Turn off Socket 4");
              mySwitch.send(CODE_4Off, 24);
              delay(50);
            }
          }
          if (incomingOutlet == 5) {
            if (incomingLightState == 1) {
              // Turn on  socket 5
              Serial.println("Turn on Socket 5");
              mySwitch.send(CODE_5On, 24);
              delay(50);
            }
            if (incomingLightState == 0)  {
              // Turn off socket 5
              Serial.println("Turn off Socket 5");
              mySwitch.send(CODE_5Off, 24);
              delay(50);
            }
          }
          if (incomingOutlet == 6) {
            if (incomingLightState == 1) {
              // Turn on  socket 6
              Serial.println("Turn on Socket 6");
              mySwitch.send(CODE_6On, 24);
              delay(50);
            }
            if (incomingLightState == 0)  {
              // Turn off socket 6
              Serial.println("Turn off Socket 6");
              mySwitch.send(CODE_6Off, 24);
              delay(50);
            }
          }
        }
        delay(50);
      }```
      
      I would like to give my sincere thanks to everyone here. I may not post all that much, but I enjoy reading what others are doing and trying to learn from it, although much of it is still way over my head! To @hek I still remember how excited I was when I found MySensors all those years ago, and I thank you and your crew for keeping this great community going!
      
      I am also certain that most of you won't get very much from this technical-wise; I just needed to share this for myself. Thank you all.
      posted in My Project
      Homer
      Homer
    • RE: rboard - Cheap relay/radio/arduino board ~$10

      Ok, looks like I am slowly getting there 🙂

      fyi I tried playing around with the above sketch, but it's a no go as Codebender tells me <Bounce2.h> is missing.

      posted in Hardware
      Homer
      Homer
    • RE: AI: What is the future of Wikis and Forums?

      I have just been using Chat GPT and it has been very careful. Just remember to be nice to it, so that when it takes over it will remember you as being nice and will hopefully give you an easier job when we all are enslaved by it hahaha

      posted in General Discussion
      Homer
      Homer
    • RE: DHT and DOOR sensor

      I can't believe I spotted am error in the code! I guess I'm starting to get a bit better at this! 😁😁

      posted in My Project
      Homer
      Homer
    • RE: rboard - Cheap relay/radio/arduino board ~$10

      @mfalkvidd said in rboard - Cheap relay/radio/arduino board ~$10:

      @homer that sketch was made for MySensors 1.x and needs to be converted to work for MySensors 2.x.
      Followthe guide at https://forum.mysensors.org/topic/4276/converting-a-sketch-from-1-5-x-to-2-0-x to convert it.

      Alternatively, remove MySensors 2 and install MySensors 1 instead.

      Thanks mate! I was thinking something like that might be the case, but I didn't know for sure.

      Thank you so much for pointing me in the right direction!!

      posted in Hardware
      Homer
      Homer
    • RE: Possible problem with sketch?

      Thank you for everyone's replies!

      posted in Troubleshooting
      Homer
      Homer
    • RE: Ethernet gateway

      @terence-faul I'm only new to this myself, so I can't help with anything specific, but I did a search and found another thread where someone was having issues with a similar setup to you. Maybe you might find some info there that helps you. The thread is here :
      https://forum.mysensors.org/topic/5059/ethernet-gateway-with-w5100

      posted in My Project
      Homer
      Homer
    • RE: rboard - Cheap relay/radio/arduino board ~$10

      I just wanted to say that I managed to upload a sketch and I have it working!

      I attempted to change the code so it was compatible but I gave that up and decided to merge two sketches. It was good fun, and I enjoyed learning!

      posted in Hardware
      Homer
      Homer
    • RE: Old user returning to Vera/MySensors

      Thank you for your responses! Exactly what I was after!

      posted in Vera
      Homer
      Homer
    • RE: Node not working

      I'm still keen to know if there is a way to call up any logs to check why things don't work, but at this stage I've been able to get the node to work again as it should. All I needed to do was give it more power.

      posted in Troubleshooting
      Homer
      Homer

    Latest posts made by Homer

    • RE: Some questions on how gateway works

      Thanks mate, I am very pleased! 😄

      posted in Home Assistant
      Homer
      Homer
    • RE: Some questions on how gateway works

      I gave up on this and instead went the TCP Gateway, and now I have sensors in HA!

      posted in Home Assistant
      Homer
      Homer
    • RE: Some questions on how gateway works

      Thanks for the replies!!

      I have some progress, but I still don't see any sensors in Home Assistant.

      Screenshot 2025-08-11 111200.png

      As you can see. topics are being reported, but nothing related to them show up in the HA MQTT integration or the Mysensors integration.I have no idea where to go from here.

      posted in Home Assistant
      Homer
      Homer
    • RE: Some questions on how gateway works

      Screenshot 2025-08-10 200908.png

      Still no topics. I only have the one sensor and I haven't actually attached any sensors to the arduino as I figured the sketch itself would send enough info to create the devices, but I am starting to wonder if the reason they aren;t there is coz of this....

      posted in Home Assistant
      Homer
      Homer
    • RE: AI: What is the future of Wikis and Forums?

      I have just been using Chat GPT and it has been very careful. Just remember to be nice to it, so that when it takes over it will remember you as being nice and will hopefully give you an easier job when we all are enslaved by it hahaha

      posted in General Discussion
      Homer
      Homer
    • RE: Some questions on how gateway works

      Thanks for your reply!

      I have had heaps of help from Chat GPT and I believe every thing is talking to each other, but I don't see any sensors in HA.

      Here is my sketch for the Gateway:

      
      // Enable debug prints to serial monitor
      #define MY_DEBUG
      
      #define MY_MQTT_KEEPALIVE 60
      
      // Use a lower baud rate for ESP8266 serial prints
      #define MY_BAUD_RATE 9600
      
      // Radio type (enable one)
      #define MY_RADIO_RF24
      // #define MY_RADIO_RFM69
      // #define MY_RADIO_RFM95
      
      // nRF24 radio pins
      #define MY_RF24_CE_PIN 4
      #define MY_RF24_CS_PIN 15
      
      // Gateway type
      #define MY_GATEWAY_MQTT_CLIENT
      #define MY_GATEWAY_ESP8266
      
      // MQTT topics
      #define MY_MQTT_PUBLISH_TOPIC_PREFIX "mygateway1-out"
      #define MY_MQTT_SUBSCRIBE_TOPIC_PREFIX "mygateway1-in"
      
      // MQTT client ID
      #define MY_MQTT_CLIENT_ID "mysensors-1"
      
      // Support controller ID allocation
      #define MY_CONTROLLER_ID_ALLOC_SUPPORT
      
      // MQTT broker authentication (optional)
      #define MY_MQTT_USER "homeassistant"
      #define MY_MQTT_PASSWORD "oN3Oe0eile6iVaivaiphooChieNg5wei0kapa9rohJ8au0Teethah6thahsieP7A"
      
      // WiFi credentials
      #define MY_WIFI_SSID "Ext"
      #define MY_WIFI_PASSWORD "lynettekoster"
      
      // Hostname for DHCP (optional)
      // #define MY_HOSTNAME "mqtt-sensor-gateway"
      
      // Static IP configuration (optional)
      #define MY_IP_ADDRESS 192,168,0,100
      #define MY_IP_GATEWAY_ADDRESS 192,168,0,1
      #define MY_IP_SUBNET_ADDRESS 255,255,255,0
      
      // MQTT broker IP address or URL
      #define MY_CONTROLLER_IP_ADDRESS 192,168,0,77
      // #define MY_CONTROLLER_URL_ADDRESS "test.mosquitto.org"
      
      // MQTT broker port
      #define MY_PORT 1883
      
      // Inclusion mode (optional)
      // #define MY_INCLUSION_MODE_FEATURE
      // #define MY_INCLUSION_BUTTON_FEATURE
      // #define MY_INCLUSION_MODE_DURATION 60
      // #define MY_INCLUSION_MODE_BUTTON_PIN D1
      
      // LED blinking period (optional)
      // #define MY_DEFAULT_LED_BLINK_PERIOD 300
      
      // LED pins (optional)
      // #define MY_DEFAULT_ERR_LED_PIN 16
      // #define MY_DEFAULT_RX_LED_PIN 16
      // #define MY_DEFAULT_TX_LED_PIN 16
      
      #include <ESP8266WiFi.h>
      #include <MySensors.h>
      
      void setup()
      {
        // Setup locally attached sensors here (if any)
      }
      
      void presentation()
      {
        // Present gateway node to controller
        sendSketchInfo("MQTT Gateway", "1.0");
      }
      
      void loop()
      {
        // Send locally attached sensors data here (if any)
      }
      
      

      My Sensor I made is using a RF-Nano, and this is the sketch:

      #define MY_DEBUG
      #define MY_RADIO_NRF24
      #define MY_RF24_CE_PIN 10
      #define MY_RF24_CS_PIN 9
      #include <MySensors.h>
      #include <OneWire.h>
      #include <DallasTemperature.h>
      #include <DHT.h>
      
      // MySensors definitions
      #define CHILD_ID_DS18B20_TEMP 0
      #define CHILD_ID_DHT_TEMP 1
      #define CHILD_ID_DHT_HUM 2
      
      #define ONE_WIRE_BUS 3        // DS18B20 data pin connected to Arduino pin 3
      #define DHTPIN 4              // DHT22 data pin connected to Arduino pin 4
      #define DHTTYPE DHT22         // DHT22 sensor type
      
      // Setup NRF24 radio (default CE=9, CSN=10 for RF-Nano)
      #define MY_RADIO_NRF24
      #define MY_RF24_CE_PIN 10
      #define MY_RF24_CS_PIN 9
      
      // Sleep interval in milliseconds
      #define SEND_INTERVAL 30000  // 30 seconds
      
      // Initialize sensors
      OneWire oneWire(ONE_WIRE_BUS);
      DallasTemperature ds18b20(&oneWire);
      DHT dht(DHTPIN, DHTTYPE);
      
      // Child sensor objects
      MyMessage msgDs18b20Temp(CHILD_ID_DS18B20_TEMP, V_TEMP);
      MyMessage msgDhtTemp(CHILD_ID_DHT_TEMP, V_TEMP);
      MyMessage msgDhtHum(CHILD_ID_DHT_HUM, V_HUM);
      
      unsigned long lastSendTime = 0;
      
      void setup() {
        // Initialize sensors
        ds18b20.begin();
        dht.begin();
      }
      
      void presentation() {
        // Present sensors to gateway
        present(CHILD_ID_DS18B20_TEMP, S_TEMP);
        present(CHILD_ID_DHT_TEMP, S_TEMP);
        present(CHILD_ID_DHT_HUM, S_HUM);
      }
      
      void loop() {
        unsigned long now = millis();
        if (now - lastSendTime > SEND_INTERVAL) {
          lastSendTime = now;
      
          // Read DS18B20 temperature
          ds18b20.requestTemperatures();
          float tempDS = ds18b20.getTempCByIndex(0);
      
          // Read DHT22 temp and humidity
          float tempDHT = dht.readTemperature();
          float humDHT = dht.readHumidity();
      
          // Check if reads are valid before sending
          if (tempDS != DEVICE_DISCONNECTED_C) {
            send(msgDs18b20Temp.set(tempDS, 1));
          } else {
            // Optional: send some error value or skip
          }
      
          if (!isnan(tempDHT)) {
            send(msgDhtTemp.set(tempDHT, 1));
          }
      
          if (!isnan(humDHT)) {
            send(msgDhtHum.set(humDHT, 1));
          }
        }
      
        // Sleep to save power (optional, comment out if not needed)
        // sleep(SEND_INTERVAL / 1000);
      }
      
      

      I downloaded and installed MQTT Explorer to see what messages are there. This is what shows in the app:
      mqtt.png

      I setup Mysensors using the GUI. I am running Mosquitto broker for MQTT. The only thing I see here is my Ring cameras as they are setup using MQTT. In the Mysensors integration all there is is the MQTT gateway that I created. I should have 3 new devices, but they aren't there. I do recall reading somewhere that there was something that needed to happen for a device to show up, but I don't recall what that way as at the time I read it, it was still very far from where I was up to at the time. I guess I will start doing some more searching.

      posted in Home Assistant
      Homer
      Homer
    • RE: Some questions on how gateway works

      I think I'm going to move on from the Ethernet route, coz no matter what I can't get it to connect to the network. I have an ESP12F that I found in my box of stuff that I'll wire a radio to and set it up as my gateway.

      posted in Home Assistant
      Homer
      Homer
    • Some questions on how gateway works

      Hi all

      I have resurrected my old Mysensors Ethernet gateway but I can't get Home Assistant to connect to it. I tried using yaml but I get an error saying that it can't be configured this way, so I'm thinking I'll set the gateway up as a MQTT Gateway. I first have a couple questions I need to ask.

      I used to have the Gateway integrated into my Vera 3 controller. To attach sensors I used to press a button in the GUI of Vera to start the process. How is this done with the MQTT Gateway? If I need to add a button to the Gateway to start this process, I'll need to add this as it doesn't have this yet.

      And do I need to write the sketches different when I'm creating sensors so that they work with the MQTT Gateway?

      Once I clear this up I'll be able to get building again!

      Looking forward to hearing back from someone!

      Cheers!

      posted in Home Assistant
      Homer
      Homer
    • RE: Keen to build again

      @OldSurferDude said in Keen to build again:

      I can't speak to the subtle differences between 2.3.2 and 2.3.1. I would advise on proceeding, whether upgrading or not.

      A gateway to Home Assistant can run on an Arduino Nano with an nRF24 radio (or RF Nano found on AliExpress). This gateway can connect to Home Assistant via the serial port of the computer running Home Assistant.

      I see that there is still a Vera integration on Home Assistant. You could probably pick up where you left off.

      Yes, MySensors popularity has waned, but there are a few of us die-hards that check in from time to time. Please continue to share your experience.

      OSD

      Thanks heaps for your reply!!!!

      I still have the gateway up and running and it's still integrated with Vera which in turn is setup in Home Assistant.

      Do you know of a reason why there isn't so much interest in Mysensors? I know I sort of moved away because I ended up getting some Phillips Hue bulbs and then I bought a could of their sensors coz they were cheap and easy to integrate with everything and things just continued from there for me, but I always enjoyed building the sensors myself and learning, which is why I've returned.

      posted in General Discussion
      Homer
      Homer
    • RE: Keen to build again

      It looks like version 2.3.2 is the latest, so not much has changed seeing that my gateway is on 2.3.1.

      Does anyone know if I can just start building new sensors using 2.3.2, or should I keep them the same and use 2.3.1?

      This place used to be a very busy place years ago, it's sad that things have slowed down so much coz this was a great way to make things smart around your home without costing heaps.

      posted in General Discussion
      Homer
      Homer