Digoo DG-R8H Temperature Sensor

I have gotten the Digo DG-R8H working on OMG.
I have made a plug-in (that still needs patching up) based on:

Here is what I cobbled together for my Domoticz setup:

/*
OpenMQTTGateway - ESP8266 or Arduino program for home automation

Act as a wifi or ethernet gateway between your 433mhz/infrared IR signal and a MQTT broker
Send and receiving command by MQTT

This gateway enables to:

  • receive MQTT data from a topic and send RF 433Mhz signal corresponding to the received MQTT data

  • publish MQTT data to a different topic related to received 433Mhz signal

    Copyright: (c)Florian ROBERT

    This file is part of OpenMQTTGateway.

    OpenMQTTGateway is free software: you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
    the Free Software Foundation, either version 3 of the License, or
    (at your option) any later version.

    OpenMQTTGateway is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
    GNU General Public License for more details.

    You should have received a copy of the GNU General Public License
    along with this program. If not, see http://www.gnu.org/licenses/.

    this module uses the homeGW library for processing Digoo DG-R8H sensors
    GitHub - dgomes/homeGW: RF433Mhz decoding library

*/
#ifdef ZgatewayRF3

#include <homeGW.h>
#include <digoo.h>

HomeGW gw(1); //the number of plugins to be registered
digoo station;
String msg =“”;
String old_msg =“”;

uint64_t prev_p = 0;
uint64_t p = 0;

#define RF_RECEIVER_PIN D5

void setupRF3(){
// pull-down RF pin (less noise)
Serial.println(“Ready to go”);
pinMode(RF_RECEIVER_PIN, OUTPUT);
digitalWrite(RF_RECEIVER_PIN, LOW);
pinMode(RF_RECEIVER_PIN, INPUT);
digitalWrite(RF_RECEIVER_PIN, LOW);
gw.setup(RF_RECEIVER_PIN);
gw.registerPlugin(&station);
}

void RF3toMQTT(){
String idx =“”;
if(station.available()) {
if((p = station.getPacket())) {
if(p != prev_p) {
if (station.getId(p) == 8) { // modify the IDs to match your Gigoo
idx = “122”;
}

    if (idx !="") {
    //{"idx":13,"nvalue":0,"svalue":"26.0;35.0;2"}
      msg = "{\"idx\":";
      msg += idx;
      msg += ",\"nvalue\":0,\"svalue\":\"";
      msg += station.getTemperature(p);
      msg += ";";
      msg += station.getHumidity(p);
      msg += ";2\"}";
       Serial.print("Digoo: ");
       Serial.println(msg);
       pub("domoticz/in",msg);  // shortcut to report to domotoicz. 
    }
   prev_p = p;
  }     
}
}

}
#endif

1 Like