Prevent panic if mqtt not configured

This commit is contained in:
andig 2020-04-09 13:19:06 +02:00
parent 2bfeed5451
commit 5a69cf7fd0

View file

@ -66,6 +66,9 @@ func NewBoolGetterFromConfig(pc *Config) (res BoolGetter) {
func NewFloatGetterFromConfig(pc *Config) (res FloatGetter) {
switch pc.Type {
case "mqtt":
if MQTT == nil {
log.FATAL.Fatal("mqtt not configured")
}
if pc.Timeout == 0 {
pc.Timeout = mqttTimeout
}