fix typo
This commit is contained in:
parent
3f9734598b
commit
0540519d68
3 changed files with 4 additions and 4 deletions
|
@ -32,7 +32,7 @@ func (storage *influxStorage) Save(data WeatherData) error {
|
|||
fields := map[string]interface{}{
|
||||
"temperature": data.Temperature,
|
||||
"humidity": data.Humidity,
|
||||
"preasure": data.Preasure}
|
||||
"pressure": data.Pressure}
|
||||
|
||||
datapoint := influxdb2.NewPoint("new2",
|
||||
tags,
|
||||
|
|
|
@ -14,7 +14,7 @@ type WeatherStorage interface {
|
|||
//WeatherData type
|
||||
type WeatherData struct {
|
||||
Humidity float64 `json:"humidity"`
|
||||
Preasure float64 `json:"airPreasure"`
|
||||
Pressure float64 `json:"airPressure"`
|
||||
Temperature float64 `json:"temperature"`
|
||||
Location string `json:"location"`
|
||||
TimeStamp time.Time `json:"timestamp"`
|
||||
|
@ -25,7 +25,7 @@ func NewRandomWeatherData(location string) WeatherData {
|
|||
rand.Seed(time.Now().UnixNano())
|
||||
var data WeatherData
|
||||
data.Humidity = rand.Float64() * 100
|
||||
data.Preasure = rand.Float64()*80 + 960
|
||||
data.Pressure = rand.Float64()*80 + 960
|
||||
data.Temperature = rand.Float64()*40 - 5
|
||||
data.Location = location
|
||||
data.TimeStamp = time.Now()
|
||||
|
|
|
@ -59,7 +59,7 @@ func (source *mqttWeatherSource) mqttMessageHandler() mqtt.MessageHandler {
|
|||
}
|
||||
|
||||
if strings.HasSuffix(msg.Topic(), "pressure") {
|
||||
source.lastData.Preasure, _ = strconv.ParseFloat(string(msg.Payload()), 64)
|
||||
source.lastData.Pressure, _ = strconv.ParseFloat(string(msg.Payload()), 64)
|
||||
source.lastData.TimeStamp = time.Now()
|
||||
}
|
||||
if strings.HasSuffix(msg.Topic(), "temp") {
|
||||
|
|
Loading…
Add table
Reference in a new issue