Пример #1
0
        public string GetExtraSensorAlpacaFormData()
        {
            var indoor = new JsonExtraSensorAirLinkDevice()
            {
                ipAddress = cumulus.AirLinkInIPAddr,
                hostname  = cumulus.AirLinkInHostName,
                stationId = cumulus.AirLinkInStationId
            };

            var outdoor = new JsonExtraSensorAirLinkDevice()
            {
                ipAddress = cumulus.AirLinkOutIPAddr,
                hostname  = cumulus.AirLinkOutHostName,
                stationId = cumulus.AirLinkOutStationId
            };

            var airlink = new JsonExtraSensorAirLinkSettings()
            {
                isNode         = cumulus.AirLinkIsNode,
                apiKey         = cumulus.AirLinkApiKey,
                apiSecret      = cumulus.AirLinkApiSecret,
                autoUpdateIp   = cumulus.AirLinkAutoUpdateIpAddress,
                indoorenabled  = cumulus.AirLinkInEnabled,
                indoor         = indoor,
                outdoorenabled = cumulus.AirLinkOutEnabled,
                outdoor        = outdoor
            };

            var bl = new JsonExtraSensorBlakeLarsen()
            {
                enabled = cumulus.UseBlakeLarsen
            };

            var rg11port1 = new JsonExtraSensorRG11device()
            {
                commPort = cumulus.RG11Port,
                tipMode  = cumulus.RG11TBRmode,
                tipSize  = cumulus.RG11tipsize,
                dtrMode  = cumulus.RG11TBRmode
            };

            var rg11port2 = new JsonExtraSensorRG11device()
            {
                commPort = cumulus.RG11Port2,
                tipMode  = cumulus.RG11TBRmode2,
                tipSize  = cumulus.RG11tipsize2,
                dtrMode  = cumulus.RG11TBRmode2
            };

            var rg11 = new JsonExtraSensorRG11()
            {
                dev1enabled = cumulus.RG11Enabled,
                port1       = rg11port1,
                dev2enabled = cumulus.RG11Enabled2,
                port2       = rg11port2
            };

            var aq = new JsonExtraSensorAirQuality()
            {
                primaryaqsensor = cumulus.StationOptions.PrimaryAqSensor,
                aqi             = cumulus.airQualityIndex,
            };

            var data = new JsonExtraSensorSettings()
            {
                airquality  = aq,
                airLink     = airlink,
                blakeLarsen = bl,
                rg11        = rg11
            };

            return(data.ToJson());
        }
Пример #2
0
        public string GetAlpacaFormData()
        {
            var indoor = new JsonExtraSensorAirLinkDevice()
            {
                enabled   = cumulus.AirLinkInEnabled,
                ipAddress = cumulus.AirLinkInIPAddr,
                hostname  = cumulus.AirLinkInHostName,
                stationId = cumulus.AirLinkInStationId
            };

            var outdoor = new JsonExtraSensorAirLinkDevice()
            {
                enabled   = cumulus.AirLinkOutEnabled,
                ipAddress = cumulus.AirLinkOutIPAddr,
                hostname  = cumulus.AirLinkOutHostName,
                stationId = cumulus.AirLinkOutStationId
            };

            var airlink = new JsonExtraSensorAirLinkSettings()
            {
                isNode       = cumulus.AirLinkIsNode,
                apiKey       = cumulus.AirLinkApiKey,
                apiSecret    = cumulus.AirLinkApiSecret,
                autoUpdateIp = cumulus.AirLinkAutoUpdateIpAddress,
                indoor       = indoor,
                outdoor      = outdoor
            };

            var ecowittwn34map = new JsonStationSettingsEcowittMappings()
            {
                primaryTHsensor = cumulus.Gw1000PrimaryTHSensor,

                wn34chan1 = cumulus.EcowittMapWN34[1],
                wn34chan2 = cumulus.EcowittMapWN34[2],
                wn34chan3 = cumulus.EcowittMapWN34[3],
                wn34chan4 = cumulus.EcowittMapWN34[4],
                wn34chan5 = cumulus.EcowittMapWN34[5],
                wn34chan6 = cumulus.EcowittMapWN34[6],
                wn34chan7 = cumulus.EcowittMapWN34[7],
                wn34chan8 = cumulus.EcowittMapWN34[8]
            };

            var ecowitt = new JsonExtraSensorEcowitt()
            {
                useSolar   = cumulus.EcowittExtraUseSolar,
                useUv      = cumulus.EcowittExtraUseUv,
                useTempHum = cumulus.EcowittExtraUseTempHum,
                //useSoilTemp = cumulus.EcowittExtraUseSoilTemp,
                useSoilMoist = cumulus.EcowittExtraUseSoilMoist,
                useLeafWet   = cumulus.EcowittExtraUseLeafWet,
                useUserTemp  = cumulus.EcowittExtraUseUserTemp,
                useAQI       = cumulus.EcowittExtraUseAQI,
                useCo2       = cumulus.EcowittExtraUseCo2,
                useLightning = cumulus.EcowittExtraUseLightning,
                useLeak      = cumulus.EcowittExtraUseLeak,

                setcustom = cumulus.EcowittExtraSetCustomServer,
                gwaddr    = cumulus.EcowittExtraGatewayAddr,
                localaddr = cumulus.EcowittExtraLocalAddr,
                interval  = cumulus.EcowittExtraCustomInterval,

                mappings = ecowittwn34map
            };

            var ambient = new JsonExtraSensorAmbient()
            {
                useSolar   = cumulus.AmbientExtraUseSolar,
                useUv      = cumulus.AmbientExtraUseUv,
                useTempHum = cumulus.AmbientExtraUseTempHum,
                //useSoilTemp = cumulus.AmbientExtraUseSoilTemp,
                useSoilMoist = cumulus.AmbientExtraUseSoilMoist,
                //useLeafWet = cumulus.AmbientExtraUseLeafWet,
                useAQI       = cumulus.AmbientExtraUseAQI,
                useCo2       = cumulus.AmbientExtraUseCo2,
                useLightning = cumulus.AmbientExtraUseLightning,
                useLeak      = cumulus.AmbientExtraUseLeak
            };

            var httpStation = new JsonExtraSensorHttp()
            {
                ecowitt = ecowitt,
                ambient = ambient
            };

            if (cumulus.EcowittExtraEnabled)
            {
                httpStation.extraStation = 0;
            }
            else if (cumulus.AmbientExtraEnabled)
            {
                httpStation.extraStation = 1;
            }
            else
            {
                httpStation.extraStation = -1;
            }


            var bl = new JsonExtraSensorBlakeLarsen()
            {
                enabled = cumulus.SolarOptions.UseBlakeLarsen
            };

            var rg11port1 = new JsonExtraSensorRG11device()
            {
                enabled  = cumulus.RG11Enabled,
                commPort = cumulus.RG11Port,
                tipMode  = cumulus.RG11TBRmode,
                tipSize  = cumulus.RG11tipsize,
                dtrMode  = cumulus.RG11TBRmode
            };

            var rg11port2 = new JsonExtraSensorRG11device()
            {
                enabled  = cumulus.RG11Enabled2,
                commPort = cumulus.RG11Port2,
                tipMode  = cumulus.RG11TBRmode2,
                tipSize  = cumulus.RG11tipsize2,
                dtrMode  = cumulus.RG11TBRmode2
            };

            var rg11 = new JsonExtraSensorRG11()
            {
                port1 = rg11port1,
                port2 = rg11port2
            };

            var aq = new JsonExtraSensorAirQuality()
            {
                primaryaqsensor = cumulus.StationOptions.PrimaryAqSensor,
                aqi             = cumulus.airQualityIndex,
            };

            var data = new JsonExtraSensorSettings()
            {
                accessible  = cumulus.ProgramOptions.EnableAccessibility,
                airquality  = aq,
                airLink     = airlink,
                httpSensors = httpStation,
                blakeLarsen = bl,
                rg11        = rg11
            };

            return(data.ToJson());
        }
Пример #3
0
        public string GetAlpacaFormData()
        {
            var indoor = new JsonExtraSensorAirLinkDevice()
            {
                enabled   = cumulus.AirLinkInEnabled,
                ipAddress = cumulus.AirLinkInIPAddr,
                hostname  = cumulus.AirLinkInHostName,
                stationId = cumulus.AirLinkInStationId
            };

            var outdoor = new JsonExtraSensorAirLinkDevice()
            {
                enabled   = cumulus.AirLinkOutEnabled,
                ipAddress = cumulus.AirLinkOutIPAddr,
                hostname  = cumulus.AirLinkOutHostName,
                stationId = cumulus.AirLinkOutStationId
            };

            var airlink = new JsonExtraSensorAirLinkSettings()
            {
                isNode       = cumulus.AirLinkIsNode,
                apiKey       = cumulus.AirLinkApiKey,
                apiSecret    = cumulus.AirLinkApiSecret,
                autoUpdateIp = cumulus.AirLinkAutoUpdateIpAddress,
                indoor       = indoor,
                outdoor      = outdoor
            };

            var ecowitt = new JsonExtraSensorEcowittAmbient()
            {
                useSolar     = cumulus.EcowittExtraUseSolar,
                useUv        = cumulus.EcowittExtraUseUv,
                useTempHum   = cumulus.EcowittExtraUseTempHum,
                useSoilTemp  = cumulus.EcowittExtraUseSoilTemp,
                useSoilMoist = cumulus.EcowittExtraUseSoilMoist,
                useLeafWet   = cumulus.EcowittExtraUseLeafWet,
                useAQI       = cumulus.EcowittExtraUseAQI,
                useCo2       = cumulus.EcowittExtraUseCo2,
                useLightning = cumulus.EcowittExtraUseLightning,
                useLeak      = cumulus.EcowittExtraUseLeak
            };

            var ambient = new JsonExtraSensorEcowittAmbient()
            {
                useSolar     = cumulus.AmbientExtraUseSolar,
                useUv        = cumulus.AmbientExtraUseUv,
                useTempHum   = cumulus.AmbientExtraUseTempHum,
                useSoilTemp  = cumulus.AmbientExtraUseSoilTemp,
                useSoilMoist = cumulus.AmbientExtraUseSoilMoist,
                //useLeafWet = cumulus.AmbientExtraUseLeafWet,
                useAQI       = cumulus.AmbientExtraUseAQI,
                useCo2       = cumulus.AmbientExtraUseCo2,
                useLightning = cumulus.AmbientExtraUseLightning,
                useLeak      = cumulus.AmbientExtraUseLeak
            };

            var httpStation = new JsonExtraSensorHttp()
            {
                ecowitt = ecowitt,
                ambient = ambient
            };

            if (cumulus.EcowittExtraEnabled)
            {
                httpStation.extraStation = 0;
            }
            else if (cumulus.AmbientExtraEnabled)
            {
                httpStation.extraStation = 1;
            }
            else
            {
                httpStation.extraStation = -1;
            }


            var bl = new JsonExtraSensorBlakeLarsen()
            {
                enabled = cumulus.UseBlakeLarsen
            };

            var rg11port1 = new JsonExtraSensorRG11device()
            {
                enabled  = cumulus.RG11Enabled,
                commPort = cumulus.RG11Port,
                tipMode  = cumulus.RG11TBRmode,
                tipSize  = cumulus.RG11tipsize,
                dtrMode  = cumulus.RG11TBRmode
            };

            var rg11port2 = new JsonExtraSensorRG11device()
            {
                enabled  = cumulus.RG11Enabled2,
                commPort = cumulus.RG11Port2,
                tipMode  = cumulus.RG11TBRmode2,
                tipSize  = cumulus.RG11tipsize2,
                dtrMode  = cumulus.RG11TBRmode2
            };

            var rg11 = new JsonExtraSensorRG11()
            {
                port1 = rg11port1,
                port2 = rg11port2
            };

            var aq = new JsonExtraSensorAirQuality()
            {
                primaryaqsensor = cumulus.StationOptions.PrimaryAqSensor,
                aqi             = cumulus.airQualityIndex,
            };

            var data = new JsonExtraSensorSettings()
            {
                accessible  = cumulus.ProgramOptions.EnableAccessibility,
                airquality  = aq,
                airLink     = airlink,
                httpSensors = httpStation,
                blakeLarsen = bl,
                rg11        = rg11
            };

            return(data.ToJson());
        }