Compare commits
6 Commits
Author | SHA1 | Date | |
---|---|---|---|
418b44289d
|
|||
23962cdebc
|
|||
b9e639e0a2
|
|||
1870089942
|
|||
f8bcfe4d25
|
|||
aa3f784a41
|
@ -43,7 +43,22 @@ create or replace view temperature_v as
|
||||
cast(values->'Value'->>'value' as float) as temperature,
|
||||
device
|
||||
from measurements
|
||||
where application in ('Temperature Multisensor', 'Temperature Shelly Plus HT');
|
||||
where application in ('Temperature Multisensor', 'Temperature Shelly Plus HT')
|
||||
union
|
||||
select time,
|
||||
cast(values->'Temperature'->>'value' as float) as temperature,
|
||||
device
|
||||
from measurements
|
||||
where application = 'Zigbee2MQTT Hottis Eupenstr.' and
|
||||
attributes->>'DeviceModel' in ('WSDCGQ11LM', 'WSDCGQ01LM');
|
||||
|
||||
create or replace view voltage_v as
|
||||
select time,
|
||||
cast(values->'Voltage'->>'value' as float) / 1000 as voltage,
|
||||
device
|
||||
from measurements
|
||||
where application = 'Zigbee2MQTT Hottis Eupenstr.' and
|
||||
attributes->>'DeviceModel' in ('WSDCGQ11LM', 'WSDCGQ01LM');
|
||||
|
||||
create or replace view temperature2_v as
|
||||
select time,
|
||||
@ -57,7 +72,14 @@ create or replace view humidity_v as
|
||||
cast(values->'Value'->>'value' as float) as humidity,
|
||||
device
|
||||
from measurements
|
||||
where application in ('Humidity Multisensor');
|
||||
where application in ('Humidity Multisensor')
|
||||
union
|
||||
select time,
|
||||
cast(values->'Humidity'->>'value' as float) as temperature,
|
||||
device
|
||||
from measurements
|
||||
where application = 'Zigbee2MQTT Hottis Eupenstr.' and
|
||||
attributes->>'DeviceModel' in ('WSDCGQ11LM', 'WSDCGQ01LM');
|
||||
|
||||
create or replace view soil_v as
|
||||
select time,
|
||||
|
@ -37,7 +37,7 @@ func New(id string, config config.HandlerConfigT) handler.Handler {
|
||||
}
|
||||
|
||||
func (self *SnmpHandler) Handle(message handler.MessageT) {
|
||||
log.Printf("Handler SNMP %d processing %s -> %s", self.Id, message.Topic, message.Payload)
|
||||
# log.Printf("Handler SNMP %d processing %s -> %s", self.Id, message.Topic, message.Payload)
|
||||
|
||||
var observation observation_t
|
||||
err := json.Unmarshal([]byte(message.Payload), &observation)
|
||||
@ -66,7 +66,7 @@ func (self *SnmpHandler) Handle(message handler.MessageT) {
|
||||
}
|
||||
}
|
||||
|
||||
log.Printf("Prepared measurement item: %s", measurement)
|
||||
# log.Printf("Prepared measurement item: %s", measurement)
|
||||
|
||||
self.dbh.StoreMeasurement(&measurement)
|
||||
self.S()
|
||||
|
15
src/udi/handlers/z2m/models/gs361ah04/gs361ah04.go
Normal file
15
src/udi/handlers/z2m/models/gs361ah04/gs361ah04.go
Normal file
@ -0,0 +1,15 @@
|
||||
package gs361ah04
|
||||
|
||||
type Observation struct {
|
||||
LinkQuality uint8 `unit:"" json:"linkquality"`
|
||||
Battery uint8 `unit:"%" json:"battery"`
|
||||
AwayMode string `unit:"" json:"away_mode"`
|
||||
ChildLock string `unit:"" json:"child_lock"`
|
||||
CurrentHeatingSetpoint float32 `unit:"°C" json:"current_heating_setpoint"`
|
||||
LocalTemperature float32 `unit:"°C" json:"local_temperature"`
|
||||
Preset string `unit:"" json:"preset"`
|
||||
SystemMode string `unit:"" json:"system_mode"`
|
||||
ValveDetection string `unit:"" json:"valve_detection"`
|
||||
WindowDetection string `unit:"" json:"window_detection"`
|
||||
}
|
||||
|
11
src/udi/handlers/z2m/models/wsdcgq01lm/wsdcgq01lm.go
Normal file
11
src/udi/handlers/z2m/models/wsdcgq01lm/wsdcgq01lm.go
Normal file
@ -0,0 +1,11 @@
|
||||
package wsdcgq01lm
|
||||
|
||||
type Observation struct {
|
||||
LinkQuality uint8 `unit:"" json:"linkquality"`
|
||||
Battery uint8 `unit:"%" json:"battery"`
|
||||
Humidity float32 `unit:"%H" json:"humidity"`
|
||||
Pressure float32 `unit:"mbar" json:"pressure"`
|
||||
Temperature float32 `unit:"°C" json:"temperature"`
|
||||
Voltage uint16 `unit:"mV" json:"voltage"`
|
||||
}
|
||||
|
@ -4,7 +4,6 @@ type Observation struct {
|
||||
LinkQuality uint8 `unit:"" json:"linkquality"`
|
||||
Battery uint8 `unit:"%" json:"battery"`
|
||||
Humidity float32 `unit:"%H" json:"humidity"`
|
||||
Pressure float32 `unit:"mbar" json:"pressure"`
|
||||
Temperature float32 `unit:"°C" json:"temperature"`
|
||||
Voltage uint16 `unit:"mV" json:"voltage"`
|
||||
}
|
||||
|
@ -11,6 +11,8 @@ import (
|
||||
"udi/handlers/handler"
|
||||
"udi/database"
|
||||
"udi/handlers/z2m/models/wsdcgq11lm"
|
||||
"udi/handlers/z2m/models/wsdcgq01lm"
|
||||
"udi/handlers/z2m/models/gs361ah04"
|
||||
)
|
||||
|
||||
|
||||
@ -80,6 +82,10 @@ func (self *Z2MHandler) Handle(message handler.MessageT) {
|
||||
switch device.DeviceType.ModelIdentifier {
|
||||
case "WSDCGQ11LM":
|
||||
T = wsdcgq11lm.Observation{}
|
||||
case "WSDCGQ01LM":
|
||||
T = wsdcgq01lm.Observation{}
|
||||
case "GS361A-H04":
|
||||
T = gs361ah04.Observation{}
|
||||
default:
|
||||
self.Lost(fmt.Sprintf("No parser found for %s", device.DeviceType.ModelIdentifier), nil, message)
|
||||
return
|
||||
|
Reference in New Issue
Block a user