mi sensor
This commit is contained in:
parent
57c635b1e0
commit
aa3f784a41
@ -43,7 +43,15 @@ 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 temperature2_v as
|
||||
select time,
|
||||
@ -57,7 +65,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,
|
||||
|
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"`
|
||||
}
|
||||
|
@ -11,6 +11,7 @@ import (
|
||||
"udi/handlers/handler"
|
||||
"udi/database"
|
||||
"udi/handlers/z2m/models/wsdcgq11lm"
|
||||
"udi/handlers/z2m/models/wsdcgq01lm"
|
||||
)
|
||||
|
||||
|
||||
@ -80,6 +81,8 @@ func (self *Z2MHandler) Handle(message handler.MessageT) {
|
||||
switch device.DeviceType.ModelIdentifier {
|
||||
case "WSDCGQ11LM":
|
||||
T = wsdcgq11lm.Observation{}
|
||||
case "WSDCGQ01LM":
|
||||
T = wsdcgq01lm.Observation{}
|
||||
default:
|
||||
self.Lost(fmt.Sprintf("No parser found for %s", device.DeviceType.ModelIdentifier), nil, message)
|
||||
return
|
||||
|
Loading…
x
Reference in New Issue
Block a user