Compare commits
2 Commits
Author | SHA1 | Date | |
---|---|---|---|
1dbe656681
|
|||
b5f0c0d86f
|
11
queries/saerbeck.sql
Normal file
11
queries/saerbeck.sql
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
create or replace view badesee_temperature_v as
|
||||||
|
select time,
|
||||||
|
cast(values->'Temp_Red'->>'value' as float) as Temp1,
|
||||||
|
cast(values->'Temp_White'->>'value' as float) as Temp2,
|
||||||
|
cast(values->'Temp_Black'->>'value' as float) as Temp3,
|
||||||
|
cast(values->'Battery'->>'value' as float) as battery,
|
||||||
|
attributes->>'Status' as status,
|
||||||
|
device
|
||||||
|
from measurements
|
||||||
|
where application = 'de-hottis-saerbeck-monitoring' and
|
||||||
|
device = 'eui-a84041318187ec13';
|
@ -20,9 +20,9 @@ type message struct {
|
|||||||
ALARM_status string `json:"ALARM_status"`
|
ALARM_status string `json:"ALARM_status"`
|
||||||
Bat float32 `json:"BatV"`
|
Bat float32 `json:"BatV"`
|
||||||
Work_mode string `json:"Work_mode"`
|
Work_mode string `json:"Work_mode"`
|
||||||
Temp_Black string `json:"Temp_Black"`
|
Temp_Black float32 `json:"Temp_Black"`
|
||||||
Temp_Red string `json:"Temp_Red"`
|
Temp_Red float32 `json:"Temp_Red"`
|
||||||
Temp_White string `json:"Temp_White"`
|
Temp_White float32 `json:"Temp_White"`
|
||||||
}
|
}
|
||||||
|
|
||||||
func Parse(fPort int, decodedPayload []byte, _ string, variables *map[string]database.VariableType, attributes *map[string]interface{}, device *database.Device) error {
|
func Parse(fPort int, decodedPayload []byte, _ string, variables *map[string]database.VariableType, attributes *map[string]interface{}, device *database.Device) error {
|
||||||
|
@ -14,6 +14,7 @@ type hottisScd30Values struct {
|
|||||||
CO2Conc int32
|
CO2Conc int32
|
||||||
Temp int32
|
Temp int32
|
||||||
Hum int32
|
Hum int32
|
||||||
|
Bri int32
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -35,6 +36,7 @@ func Parse(fPort int, _ []byte, frmPayload string, variables *map[string]databas
|
|||||||
var co2concentration float32 = float32(values.CO2Conc) / 100;
|
var co2concentration float32 = float32(values.CO2Conc) / 100;
|
||||||
var temperature float32 = float32(values.Temp) / 100;
|
var temperature float32 = float32(values.Temp) / 100;
|
||||||
var humidity float32 = float32(values.Hum) / 100;
|
var humidity float32 = float32(values.Hum) / 100;
|
||||||
|
|
||||||
// log.Printf("CO2: %f, Temp: %f, Hum: %f, Status: %d", co2concentration, temperature, humidity, values.Status)
|
// log.Printf("CO2: %f, Temp: %f, Hum: %f, Status: %d", co2concentration, temperature, humidity, values.Status)
|
||||||
|
|
||||||
(*variables)["CO2concentration"] = database.VariableType {
|
(*variables)["CO2concentration"] = database.VariableType {
|
||||||
@ -55,6 +57,12 @@ func Parse(fPort int, _ []byte, frmPayload string, variables *map[string]databas
|
|||||||
Unit: "%",
|
Unit: "%",
|
||||||
Value: humidity,
|
Value: humidity,
|
||||||
}
|
}
|
||||||
|
(*variables)["Brightness"] = database.VariableType {
|
||||||
|
Label: "Brightness",
|
||||||
|
Variable: "Brightness",
|
||||||
|
Unit: "",
|
||||||
|
Value: values.Bri,
|
||||||
|
}
|
||||||
|
|
||||||
(*attributes)["Status"] = values.Status
|
(*attributes)["Status"] = values.Status
|
||||||
return nil
|
return nil
|
||||||
|
Reference in New Issue
Block a user