Skip to content

Commit b05d6ee

Browse files
committed
Fixed Netatmo wind sensor values
1 parent 94d6cde commit b05d6ee

13 files changed

+157
-439
lines changed

History.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ Version 2.xxx (xxxx 2015)
1111
- Implemented: Rain Report
1212
- Implemented: Temperature Report
1313
- Fixed: 1-Wire negative values
14-
- Implemented: Initial support for the Netatmo Weather Station (Big thanks to S�bastien!)
14+
- Implemented: Netatmo Weather Station (Big thanks to S�bastien!)
1515
- Changed: json "udevice" Perecentage sensor, you might get new ID's, now also creates an event for blockly/lua
1616
- Implemented: Text/Alert Sensor logging (when called from json api)
1717
- Implemented: Support for browsers that do not support gzip compression (thanks to ash77)

hardware/DomoticzHardware.cpp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -839,7 +839,8 @@ bool CDomoticzHardwareBase::CheckPercentageSensorExists(const int NodeID, const
839839
return (!result.empty());
840840
}
841841

842-
void CDomoticzHardwareBase::SendWind(const int NodeID, const int BatteryLevel, const int WindDir, const float WindSpeed, const float WindGust, const float WindTemp, const float WindChill, const bool bHaveWindTemp, const std::string &defaultname)
842+
//wind direction is in steps of 22.5 degrees (360/16)
843+
void CDomoticzHardwareBase::SendWind(const int NodeID, const int BatteryLevel, const float WindDir, const float WindSpeed, const float WindGust, const float WindTemp, const float WindChill, const bool bHaveWindTemp, const std::string &defaultname)
843844
{
844845
bool bDeviceExits = true;
845846
std::stringstream szQuery;
@@ -870,7 +871,7 @@ void CDomoticzHardwareBase::SendWind(const int NodeID, const int BatteryLevel, c
870871
tsen.WIND.id1 = (NodeID & 0xFF00) >> 8;
871872
tsen.WIND.id2 = NodeID & 0xFF;
872873

873-
float winddir = float(WindDir)*22.5f;
874+
float winddir = WindDir*22.5f;
874875
int aw = round(winddir);
875876
tsen.WIND.directionh = (BYTE)(aw / 256);
876877
aw -= (tsen.WIND.directionh * 256);

hardware/DomoticzHardware.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,7 @@ class CDomoticzHardwareBase
122122
void SendCurrentSensor(const int NodeID, const int BatteryLevel, const float Current1, const float Current2, const float Current3, const std::string &defaultname);
123123
void SendPercentageSensor(const int NodeID, const int ChildID, const int BatteryLevel, const float Percentage, const std::string &defaultname);
124124
void SendRainSensor(const int NodeID, const int BatteryLevel, const int RainCounter, const std::string &defaultname);
125-
void SendWind(const int NodeID, const int BatteryLevel, const int WindDir, const float WindSpeed, const float WindGust, const float WindTemp, const float WindChill, const bool bHaveWindTemp, const std::string &defaultname);
125+
void SendWind(const int NodeID, const int BatteryLevel, const float WindDir, const float WindSpeed, const float WindGust, const float WindTemp, const float WindChill, const bool bHaveWindTemp, const std::string &defaultname);
126126
void SendPressureSensor(const int NodeID, const int ChildID, const int BatteryLevel, const float pressure);
127127
void SendDistanceSensor(const int NodeID, const int ChildID, const int BatteryLevel, const float distance);
128128
void SendMeterSensor(const int NodeID, const int ChildID, const int BatteryLevel, const float metervalue);

hardware/MySensorsBase.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -353,7 +353,7 @@ void MySensorsBase::MakeAndSendWindSensor(const int nodeID)
353353
}
354354
}
355355
int cNode = (nodeID << 8) | ChildID;
356-
SendWind(cNode, iBatteryLevel, iDirection, fWind, fGust, fTemp, fChill, bHaveTemp, "Wind");
356+
SendWind(cNode, iBatteryLevel, float(iDirection), fWind, fGust, fTemp, fChill, bHaveTemp, "Wind");
357357
}
358358

359359
void MySensorsBase::SendSensor2Domoticz(const _tMySensorNode *pNode, const _tMySensorSensor *pSensor)

0 commit comments

Comments
 (0)