SOLVED - S_WIND - V_Direction does not change value

Moderator: leecollings

Post Reply
EDsteve
Posts: 26
Joined: Thursday 13 October 2016 11:43
Target OS: Linux
Domoticz version:
Contact:

SOLVED - S_WIND - V_Direction does not change value

Post by EDsteve »

Hi,

Right to the point:
It's a "dummy-sketch" to test communication between sensor node and Domoticz. With the following sketch Domoticz updates the values when i change wind speed and gust WITHIN the sketch manually. But i can change the number of the wind direction as much i want. Domoticz always uses 20 NNE. Why?

Code: Select all

#define MY_RADIO_NRF24
#define MY_DEBUG
#include <MySensors.h>
#include <SPI.h>

#define CHILD_ID_WIND 1

unsigned int val_wspeed;
unsigned int val_wgust;
unsigned int val_wdirection;


unsigned int last_wspeed;
unsigned int last_wgust;
unsigned int last_wdirection;

MyMessage msgWSpeed(CHILD_ID_WIND, V_WIND);
MyMessage msgWGust(CHILD_ID_WIND, V_GUST);
MyMessage msgWDirection(CHILD_ID_WIND, V_DIRECTION);


void presentation()
{
    present(CHILD_ID_WIND, S_WIND);
}

void loop()
{    
    unsigned int val_wspeed = 12; 
    if(last_wspeed != val_wspeed)
    { 
       last_wspeed = val_wspeed;
       send(msgWSpeed.set(val_wspeed, 1));
       Serial.print("WS: ");
       Serial.println(val_wspeed);
    }
    
    unsigned int val_wgust = 4; 
    if(last_wgust != val_wgust)
    { 
       last_wgust = val_wgust;
       send(msgWGust.set(val_wgust, 1));
       Serial.print("WG: ");
       Serial.println(val_wgust);
    }
  
    unsigned int val_wdirection = 15; 
    if(last_wdirection != val_wdirection)
    { 
       last_wdirection = val_wdirection;
       send(msgWDirection.set(val_wdirection, 1));
       Serial.print("WD: ");
       Serial.println(val_wdirection);
    }
}
What am i doing wrong?
I am also wondering where the "Temp: 20C" come from...

Purpose:
I am building a wind sensor without moving parts. With only 5 dallas tempeature sensors on a black metal plate i can calculate speed and direction. Everything still experimental and my programming skills are low. But tests without Domoticz show promising results.

I am sure somebody will see my mistake quickly :)
Attachments
Wind Sensor Test
Wind Sensor Test
IMG_20170320_204649 (1).jpg (40.29 KiB) Viewed 1086 times
Always 20NNE
Always 20NNE
wind.JPG (30.97 KiB) Viewed 1086 times
Last edited by EDsteve on Wednesday 22 March 2017 13:50, edited 1 time in total.
EDsteve
Posts: 26
Joined: Thursday 13 October 2016 11:43
Target OS: Linux
Domoticz version:
Contact:

Re: S_WIND - V_Direction does not change value

Post by EDsteve »

After some experimenting i found the source of the problem.

I gave the wind sensor a different NODE_ID in the sketch manually so Domoticz registers the sensor as a new node.
After that it seems to work.

For super noobs:
Add this to your sketch:

#define NODE_ID 3
Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest