Skip to main content
Version: v3

WEATHER

Creating Sensors

const weather = hmSensor.createSensor(hmSensor.id.WEATHER)

WEATHER instance

weather.getForecastWeather()

Type

() => ForecastWeather

ForecastWeather: object

PropertiesDescriptionType
cityNameCity Namestring
forecastDataWeather DataForecastData
tideDataTide DataTideData

ForecastData: object

PropertiesDescriptionType
dataForecastData arrayArray<ForecastDataItem>
countLength of the ForecastData arraynumber

ForecastDataItem: object

PropertiesDescriptionType
highHighest temperaturenumber
lowLowest temperaturenumber
indexindexnumber

TideData: object

PropertiesDescriptionType
dataTideData arrayArray<TideDataItem>
countLength of the TideData arraynumber

TideDataItem: object

PropertiesDescriptionType
sunriseSunrise dataSunrise
sunsetSunset dataSunset

Sunrise: object

PropertiesDescriptionType
hourHournumber
minuteMinutenumber

Sunset: object

PropertiesDescriptionType
hourHournumber
minuteMinutenumber

Code example

// Creating Sensors
const weatherData = weather.getForecastWeather()

console.log(weatherData.cityName)

const forecastData = weatherData.forecastData
for (let i = 0; i < forecastData.count; i++) {
const element = forecastData.data[i] // i:0 means the day
console.log(element.index)
console.log(element.high)
console.log(element.low)
}

const tideData = weatherData.tideData
for (let i = 0; i < tideData.count; i++) {
const element = tideData.data[i] // i:0 means the day
console.log(element.sunrise.hour + element.sunrise.minute)
console.log(element.sunset.hour + element.sunset.minute)
}