Skip to content

Commit bc848cd

Browse files
committed
- Implemented: AccuWeather Support
- Changed: Wind Direction for o.a. Netatmo
1 parent 5b20c5b commit bc848cd

16 files changed

+46
-15
lines changed

CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -221,6 +221,7 @@ hardware/1Wire/1WireByOWFS.cpp
221221
hardware/1Wire/1WireByKernel.cpp
222222
hardware/1Wire/1WireCommon.cpp
223223
hardware/1Wire/1WireForWindows.cpp
224+
hardware/AccuWeather.cpp
224225
hardware/AnnaThermostat.cpp
225226
hardware/ASyncSerial.cpp
226227
hardware/ASyncTCP.cpp

History.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
Version 3.xxxx (June xx 2016)
2+
- Implemented: AccuWeather support
23
- Implemented: Atag One Thermostat support
34
- Implemented: Blockly/Lua Camera device, to send camera snapshots with subject after xx seconds
45
- Implemented: Blockly upgraded to latest version (fixed and cleaned some code as well), this fixes problem with long sensor lists

hardware/DomoticzHardware.cpp

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -711,7 +711,7 @@ void CDomoticzHardwareBase::SendCustomSensor(const int NodeID, const int ChildID
711711
}
712712

713713
//wind direction is in steps of 22.5 degrees (360/16)
714-
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)
714+
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)
715715
{
716716
RBUF tsen;
717717
memset(&tsen, 0, sizeof(RBUF));
@@ -726,8 +726,7 @@ void CDomoticzHardwareBase::SendWind(const int NodeID, const int BatteryLevel, c
726726
tsen.WIND.id1 = (NodeID & 0xFF00) >> 8;
727727
tsen.WIND.id2 = NodeID & 0xFF;
728728

729-
float winddir = WindDir*22.5f;
730-
int aw = round(winddir);
729+
int aw = WindDir;
731730
tsen.WIND.directionh = (BYTE)(aw / 256);
732731
aw -= (tsen.WIND.directionh * 256);
733732
tsen.WIND.directionl = (BYTE)(aw);

hardware/DomoticzHardware.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ class CDomoticzHardwareBase
7272
void SendWaterflowSensor(const int NodeID, const int ChildID, const int BatteryLevel, const float LPM, const std::string &defaultname);
7373
void SendRainSensor(const int NodeID, const int BatteryLevel, const float RainCounter, const std::string &defaultname);
7474
float GetRainSensorValue(const int NodeID, bool &bExists);
75-
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);
75+
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);
7676
void SendPressureSensor(const int NodeID, const int ChildID, const int BatteryLevel, const float pressure, const std::string &defaultname);
7777
void SendSolarRadiationSensor(const unsigned char NodeID, const int BatteryLevel, const float radiation, const std::string &defaultname);
7878
void SendDistanceSensor(const int NodeID, const int ChildID, const int BatteryLevel, const float distance, const std::string &defaultname);

hardware/MySensorsBase.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -525,7 +525,7 @@ void MySensorsBase::MakeAndSendWindSensor(const int nodeID, const std::string &s
525525
}
526526
}
527527
int cNode = (nodeID << 8) | ChildID;
528-
SendWind(cNode, iBatteryLevel, float(iDirection), fWind, fGust, fTemp, fChill, bHaveTemp, sname);
528+
SendWind(cNode, iBatteryLevel, iDirection, fWind, fGust, fTemp, fChill, bHaveTemp, sname);
529529
}
530530

531531
void MySensorsBase::SendSensor2Domoticz(_tMySensorNode *pNode, _tMySensorChild *pChild, const _eSetType vType)

hardware/Netatmo.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -448,7 +448,7 @@ bool CNetatmo::ParseDashboard(const Json::Value &root, const int DevIdx, const i
448448
float rain;
449449
int sound;
450450

451-
float wind_angle = 0;
451+
int wind_angle = 0;
452452
int wind_gust_angle = 0;
453453
float wind_strength = 0;
454454
float wind_gust = 0;
@@ -516,7 +516,7 @@ bool CNetatmo::ParseDashboard(const Json::Value &root, const int DevIdx, const i
516516
)
517517
{
518518
bHaveWind = true;
519-
wind_angle = float(root["WindAngle"].asInt())/16.0f;
519+
wind_angle = root["WindAngle"].asInt();
520520
wind_gust_angle = root["GustAngle"].asInt();
521521
wind_strength = root["WindStrength"].asFloat()/ 3.6f;
522522
wind_gust = root["GustStrength"].asFloat() / 3.6f;

hardware/RFLinkBase.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -855,15 +855,15 @@ bool CRFLinkBase::ParseLine(const std::string &sLine)
855855

856856
if (bHaveWindDir && bHaveWindSpeed && bHaveWindGust && bHaveWindChill)
857857
{
858-
SendWind(ID, BatteryLevel, float(windir), windspeed, windgust, windtemp, windchill, bHaveWindTemp, tmp_Name);
858+
SendWind(ID, BatteryLevel, round(float(windir)*22.5f), windspeed, windgust, windtemp, windchill, bHaveWindTemp, tmp_Name);
859859
}
860860
else if (bHaveWindDir && bHaveWindGust)
861861
{
862-
SendWind(ID, BatteryLevel, float(windir), windspeed, windgust, windtemp, windchill, bHaveWindTemp, tmp_Name);
862+
SendWind(ID, BatteryLevel, round(float(windir)*22.5f), windspeed, windgust, windtemp, windchill, bHaveWindTemp, tmp_Name);
863863
}
864864
else if (bHaveWindSpeed)
865865
{
866-
SendWind(ID, BatteryLevel, float(windir), windspeed, windgust, windtemp, windchill, bHaveWindTemp, tmp_Name);
866+
SendWind(ID, BatteryLevel, round(float(windir)*22.5f), windspeed, windgust, windtemp, windchill, bHaveWindTemp, tmp_Name);
867867
}
868868

869869
if (bHaveCO2)

main/RFXNames.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -226,6 +226,7 @@ const char *Hardware_Type_Desc(int hType)
226226
{ HTYPE_RAVEn, "Rainforest RAVEn USB" },
227227
{ HTYPE_S0SmartMeterTCP, "S0 Meter with LAN interface" },
228228
{ HTYPE_DenkoviSmartdenLan, "Denkovi Smartden with LAN interface" },
229+
{ HTYPE_AccuWeather, "AccuWeather (Weather Lookup)" },
229230
{ 0, NULL, NULL }
230231
};
231232
return findTableIDSingle1 (Table, hType);

main/RFXNames.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -158,6 +158,7 @@ enum _eHardwareTypes {
158158
HTYPE_RAVEn, //76
159159
HTYPE_S0SmartMeterTCP, //77
160160
HTYPE_DenkoviSmartdenLan, //78
161+
HTYPE_AccuWeather, //79
161162
HTYPE_END
162163
};
163164

main/SQLHelper.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1913,6 +1913,7 @@ bool CSQLHelper::OpenDatabase()
19131913
<< "([Type] = " << HTYPE_TOONTHERMOSTAT << ") OR "
19141914
<< "([Type] = " << HTYPE_Wunderground << ") OR "
19151915
<< "([Type] = " << HTYPE_ForecastIO << ") OR "
1916+
<< "([Type] = " << HTYPE_AccuWeather << ") OR "
19161917
<< "([Type] = " << HTYPE_RazberryZWave << ") OR "
19171918
<< "([Type] = " << HTYPE_OpenZWave << ")"
19181919
<< ")";

0 commit comments

Comments
 (0)