Ecowitt Gateway Firmware 1.5.7+ (1.5.9+ for CO2 and 1.6.4+ for Rain commands)
Methods
getSensors({//Optional filter can be by type and/or status. Accepts strings or arrays of strings for type and status.type: 'WH65',status: 'active'})getLiveData(includeRain=true,filterActiveSensors=false)//Gets current Weather conditions. Including rain will append the getRain data while filterActiveSensors will remove non-active sensors if showngetRainData()//Gets Rain Data.getRain()//New method to get Rain information including Piezo and Rain EventsgetSoilMoistureCalibration()//Gets Soil Moisture Calibration Data (including current analog and digital value for all connected sensors)getPM25Offset()// Gets PM25 Offset DatagetCO2Offset()// Gets CO2 Offset DatagetFirmwareVersion()//Gets current Firmware version.getSystemParams()//Gets System Parameters. (in development)getMacAddr()//Gets MAC AddressgetCustomServerInfo()//Gets Custom Server InformationsetCustomServerInfo({//Sets Custom Server Information (All Fields optional)station: 'STATION ID',//Station Namekey: 'KEY',//Station Keyserver: '192.168.X.X',//Server Locationport: 3000,//Port Numberinterval: 60,//Interval to send update in seconds(minimum 16)protocol: 'wunderground',//Protocol (wunderground or ecowitt)enabled: true,//Custom Server Enabledpath_ecowitt: '/weather',//Server Path for Wunderground Protocolpath_wunderground: '/weather'//Server Path for Ecowitt Protocol})staticdiscover(timeout)//Find Gateways, Timeout in milliseconds
Example
constEWG=require('ecowitt-gateway');constgw=newEWG('192.168.X.X',45000);//port default is 45000 and is optionalgw.getLiveData().then(data=>{console.log(JSON.stringify(data));});