Hello, I am a beginner in node red and would like to save the data from the dht22 sensor in mysql and display via chart. I have already tried a lot but unfortunately without success.
@Yveaux @hek in fact it has to be debounced for it vibrates on rising and falling so it is important to see. maybe the bling delay would do it simply but someoone may remove the led...
Also through trial and error here is the way to manage it:
// Setup the reed
pinMode(DIGITAL_INPUT_SENSOR,INPUT);
// Activate internal pull-up
digitalWrite(DIGITAL_INPUT_SENSOR,HIGH);
attachInterrupt(INTERRUPT, onPulse, FALLING);
you have to power the pin to get the signal when both sides are connected.
Hi there, I had a similar problem gw and sensor saw each other but the sensor did not get an id. Later I found that the controller hands out the id's, not the gateway. So when I connected the controller to the gw and configured it to use the gw arduino it worked. Not sure if this is your problem also but just in case
Greets,
Mark
This the code I got so far, which does not work
#define MY_RADIO_NRF24 //MySensor Library auf NRF24 Funkmodul einstellen, muss vor MySensor.h Initialisierung geschehen
// Define Node ID
#define MY_NODE_ID 5
//#define MY_PARENT_NODE_ID 50 //Repeater Node 1!
//#define MY_PARENT_NODE_IS_STATIC
#include <MySensors.h>
#include <SPI.h>
#include <IRremote.h>
#define CHILD_ID 1 // Id of the sensor child
IRsend irsend;
// Initialize motion message
MyMessage msg(CHILD_ID, V_IR_SEND);
void setup()
{
Serial.begin(9600);
}
void presentation()
{
// Send the sketch version information to the gateway and Controller
sendSketchInfo("LED Licht TV Steuerung", "1.0");
// Register all sensors to gw (they will be created as child devices)
present(CHILD_ID, S_IR);
}
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_IR_SEND) {
// Send command to Turn LEDs On
if (message.getString() == "FF02FD") { // ???
for (int i = 0; i < 3; i++) {
irsend.sendNEC(0xFF02FD, 32);
Serial.println(message.getString());
Serial.println("Message sent");
delay(40);
}
}
}
}
edit: from the serial monitor I see that the node receives the "FF02FD" String, but it does not enter this part
if (message.getString() == "FF02FD") { // ???
for (int i = 0; i < 3; i++) {
irsend.sendNEC(0xFF02FD, 32);
Serial.println(message.getString());
Serial.println("Message sent");
delay(40);
}
}
edit2:
This is what I am sending from openhab over MQTT:
mygateway1-in/5/1/1/0/32
edit3:
Ok, now I see where it fails:
message.getString()
contains FF02FD
but when I say
if (message.getString() == "FF02FD")
it does not recognise the FF02FD. But I don´t understand why
edit4:
Ok, I got it, finally...:
message.getString("FF02FD");
@mfalkvidd Thanx for the quick reply and the example. It's exactly what I was I was looking for. I just overlooked the union definition in Message.h.
I'm currently sending the message to the Node itself as a test. But event that that works.
I had the gateway reboot problem since 2.1.1. After initial startup, the gateway would keep rebooting after receiving messages from nodes. After a while it seems to stabilize.
I tried 2.2.0-rc.1 as you suggested and I don't see that problem any more. Thank you!
@C.r.a.z.y. is this confirm? coz i'm having the same problem.
and Yes, i'm using serial for my gateway and usb for my sensor.
Please share if there's possible answer for this problem.
thanks