Skip to content

Commit

Permalink
Merge pull request #54 from mcrossley/master
Browse files Browse the repository at this point in the history
b3067
  • Loading branch information
mcrossley authored Mar 6, 2020
2 parents 6ac72b4 + 0c05fb8 commit 685b7b1
Show file tree
Hide file tree
Showing 5 changed files with 42 additions and 11 deletions.
11 changes: 8 additions & 3 deletions CumulusMX/Cumulus.cs
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,8 @@ namespace CumulusMX
public class Cumulus
{
/////////////////////////////////
public string Version = "3.4.2";
public string Build = "3066";
public string Version = "3.4.3";
public string Build = "3067";
/////////////////////////////////

private const string appGuid = "57190d2e-7e45-4efb-8c09-06a176cef3f3";
Expand Down Expand Up @@ -3160,7 +3160,7 @@ private void ReadIniFile()
WllApiSecret = ini.GetValue("WLL", "WLv2ApiSecret", "");
WllStationId = ini.GetValue("WLL", "WLStationId", "");
if (WllStationId == "-1") WllStationId = "";
WLLAutoUpdateIpAddress = ini.GetValue("WLL", "AutoUpdateIpAddress", true); // Readonly setting, default to True
WLLAutoUpdateIpAddress = ini.GetValue("WLL", "AutoUpdateIpAddress", true);
WllBroadcastDuration = ini.GetValue("WLL", "BroadcastDuration", 300); // Readonly setting, default 5 minutes
WllBroadcastPort = ini.GetValue("WLL", "BroadcastPort", 22222); // Readonly setting, default 22222
WllPrimaryRain = ini.GetValue("WLL", "PrimaryRainTxId", 1);
Expand Down Expand Up @@ -3197,6 +3197,7 @@ private void ReadIniFile()

// GW1000 setiings
Gw1000IpAddress = ini.GetValue("GW1000", "IPAddress", "0.0.0.0");
Gw1000AutoUpdateIpAddress = ini.GetValue("GW1000", "AutoUpdateIpAddress", true);

ftp_host = ini.GetValue("FTP site", "Host", "");
ftp_port = ini.GetValue("FTP site", "Port", 21);
Expand Down Expand Up @@ -3723,6 +3724,7 @@ internal void WriteIniFile()
ini.SetValue("Station", "RG11DTRmode2", RG11DTRmode2);

// WeatherLink Live device settings
ini.SetValue("WLL", "AutoUpdateIpAddress", WLLAutoUpdateIpAddress);
ini.SetValue("WLL", "WLv2ApiKey", WllApiKey);
ini.SetValue("WLL", "WLv2ApiSecret", WllApiSecret);
ini.SetValue("WLL", "WLStationId", WllStationId);
Expand Down Expand Up @@ -3758,7 +3760,9 @@ internal void WriteIniFile()
ini.SetValue("WLL", "ExtraHumOnTxId" + i, WllExtraHumTx[i - 1]);
}

// GW1000 settings
ini.SetValue("GW1000", "IPAddress", Gw1000IpAddress);
ini.SetValue("GW1000", "AutoUpdateIpAddress", Gw1000AutoUpdateIpAddress);

ini.SetValue("Web Site", "ForumURL", ForumURL);
ini.SetValue("Web Site", "WebcamURL", WebcamURL);
Expand Down Expand Up @@ -4831,6 +4835,7 @@ private WeatherStation Station
public bool[] WllExtraHumTx = { false, false, false, false, false, false, false, false };

public string Gw1000IpAddress;
public bool Gw1000AutoUpdateIpAddress = true;

public Timer WundTimer = new Timer();
public Timer WindyTimer = new Timer();
Expand Down
7 changes: 3 additions & 4 deletions CumulusMX/GW1000Station.cs
Original file line number Diff line number Diff line change
Expand Up @@ -212,16 +212,15 @@ public GW1000Station(Cumulus cumulus) : base(cumulus)

var discoveredIP = DiscoverGW1000();

if (discoveredIP != "0" && discoveredIP != ipaddr)
if (cumulus.Gw1000AutoUpdateIpAddress && discoveredIP != "0" && discoveredIP != ipaddr)
{
cumulus.LogMessage($"Discovered a new IP address for the GW1000: {discoveredIP}");
cumulus.LogMessage("Discovered a new IP address for the GW1000 that does not match our current one");
cumulus.LogMessage($"Changing previous IP address: {ipaddr} to {discoveredIP}");
ipaddr = discoveredIP;
cumulus.Gw1000IpAddress = ipaddr;
cumulus.WriteIniFile();
}


cumulus.LogMessage("Using IP address = " + ipaddr + " Port = " + AT_port);
socket = OpenTcpPort();

Expand Down Expand Up @@ -417,7 +416,7 @@ private string DiscoverGW1000()
IPAddress ipAddr2;
if (IPAddress.TryParse(ipAddr, out ipAddr2))
{
cumulus.LogDebugMessage($"debug: Discovered GW1000 at address {ipaddr}");
cumulus.LogMessage($"Discovered a GW1000 at address {ipaddr}");
return ipAddr;
}
else
Expand Down
6 changes: 3 additions & 3 deletions CumulusMX/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("CumulusMX")]
[assembly: AssemblyDescription("Build 3066")]
[assembly: AssemblyDescription("Build 3067")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("CumulusMX")]
Expand All @@ -32,5 +32,5 @@
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("3.4.2.3066")]
[assembly: AssemblyFileVersion("3.4.2.3066")]
[assembly: AssemblyVersion("3.4.3.3067")]
[assembly: AssemblyFileVersion("3.4.3.3067")]
17 changes: 16 additions & 1 deletion CumulusMX/StationSettings.cs
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ public string GetStationAlpacaFormData()

var davisconn = new JsonStationSettingsDavisConn() {conntype = cumulus.VP2ConnectionType, tcpsettings = tcpsettings};

var gw1000 = new JSonStationSettingsGw1000Conn() {ipaddress = cumulus.Gw1000IpAddress};
var gw1000 = new JSonStationSettingsGw1000Conn() {ipaddress = cumulus.Gw1000IpAddress, autoDiscover = cumulus.Gw1000AutoUpdateIpAddress };

var logrollover = new JsonStationSettingsLogRollover() {time = "midnight",summer10am = cumulus.Use10amInSummer};

Expand Down Expand Up @@ -126,6 +126,11 @@ public string GetStationAlpacaFormData()

var graphs = new JsonStationSettingsGraphs() {graphdays = cumulus.GraphDays, graphhours = cumulus.GraphHours};

var wllNetwork = new JsonStationSettingsWLLNetwork()
{
autoDiscover = cumulus.WLLAutoUpdateIpAddress
};

var wllApi = new JsonStationSettingsWLLApi()
{
apiKey = cumulus.WllApiKey,
Expand Down Expand Up @@ -194,6 +199,7 @@ public string GetStationAlpacaFormData()

var wll = new JsonStationSettingsWLL()
{
network = wllNetwork,
api = wllApi,
primary = wllPrimary,
soilLeaf = wllSoilLeaf,
Expand Down Expand Up @@ -382,6 +388,7 @@ public string UpdateStationConfig(IHttpContext context)
cumulus.Use10amInSummer = settings.logrollover.summer10am;

// WLL
cumulus.WLLAutoUpdateIpAddress = settings.daviswll.network.autoDiscover;
cumulus.WllApiKey = settings.daviswll.api.apiKey;
cumulus.WllApiSecret = settings.daviswll.api.apiSecret;
cumulus.WllStationId = settings.daviswll.api.apiStationId == "-1" ? "" : settings.daviswll.api.apiStationId;
Expand Down Expand Up @@ -447,6 +454,7 @@ public string UpdateStationConfig(IHttpContext context)

// GW1000 connection details
cumulus.Gw1000IpAddress = settings.gw1000.ipaddress;
cumulus.Gw1000AutoUpdateIpAddress = settings.gw1000.autoDiscover;

// Units
cumulus.WindUnit = settings.units.wind;
Expand Down Expand Up @@ -576,6 +584,7 @@ public class JsonStationSettingsDavisConn
public class JSonStationSettingsGw1000Conn
{
public string ipaddress { get; set; }
public bool autoDiscover { get; set; }
}

public class JsonStationSettingsLogRollover
Expand Down Expand Up @@ -624,12 +633,18 @@ public class JsonStationSettingsSolar

public class JsonStationSettingsWLL
{
public JsonStationSettingsWLLNetwork network { get; set; }
public JsonStationSettingsWLLApi api { get; set; }
public JsonStationSettingsWllPrimary primary { get; set; }
public JsonStationSettingsWllSoilLeaf soilLeaf { get; set; }
public JsonStationSettingsWllExtraTemp extraTemp { get; set; }
}

public class JsonStationSettingsWLLNetwork
{
public bool autoDiscover { get; set; }
}

public class JsonStationSettingsWLLApi
{
public string apiKey { get; set; }
Expand Down
12 changes: 12 additions & 0 deletions Updates.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,15 @@
3.4.3 - b3067
=============
- Adds a new option to Davis WLL and Ecowitt GW1000 station settings to disable IP address auto-discovery. Use this option
if you have more than one of these devices on your network, then enter the IP address manually.

- Updated files
\CumulusMX.exe
\interface\json\StationOptions.json
\interface\json\StationSchema.json



3.4.2 - b3066
=============
- Improved error handing for invalid Davis WLL Station Ids
Expand Down

0 comments on commit 685b7b1

Please sign in to comment.