1
0
Fork 0
mirror of https://github.com/Luzifer/tasmota-config.git synced 2024-12-22 18:51:21 +00:00

Add reader for CurrentCal, PowerCal and VoltageCal

Signed-off-by: Knut Ahlers <knut@ahlers.me>
This commit is contained in:
Knut Ahlers 2020-07-05 01:34:02 +02:00
parent c93c521a7a
commit 9ac7aa8c6b
Signed by: luzifer
GPG key ID: DC2729FDD34BE99E

View file

@ -12,13 +12,16 @@ import (
type settingExtractor func([]byte) (interface{}, error) type settingExtractor func([]byte) (interface{}, error)
var extractors = map[string]settingExtractor{ var extractors = map[string]settingExtractor{
"currentcal": func(p []byte) (interface{}, error) { return extractFloatToInt("CurrentCal", p) },
"devicename": func(p []byte) (interface{}, error) { return extractGenericJSONValue("DeviceName", p) }, "devicename": func(p []byte) (interface{}, error) { return extractGenericJSONValue("DeviceName", p) },
"ledstate": func(p []byte) (interface{}, error) { return extractFloatToInt("LedState", p) }, "ledstate": func(p []byte) (interface{}, error) { return extractFloatToInt("LedState", p) },
"module": extractModule, "module": extractModule,
"otaurl": func(p []byte) (interface{}, error) { return extractGenericJSONValue("OtaUrl", p) }, "otaurl": func(p []byte) (interface{}, error) { return extractGenericJSONValue("OtaUrl", p) },
"powercal": func(p []byte) (interface{}, error) { return extractFloatToInt("PowerCal", p) },
"teleperiod": func(p []byte) (interface{}, error) { return extractFloatToInt("TelePeriod", p) }, "teleperiod": func(p []byte) (interface{}, error) { return extractFloatToInt("TelePeriod", p) },
"timezone": func(p []byte) (interface{}, error) { return extractGenericJSONValue("Timezone", p) }, "timezone": func(p []byte) (interface{}, error) { return extractGenericJSONValue("Timezone", p) },
"topic": func(p []byte) (interface{}, error) { return extractGenericJSONValue("Topic", p) }, "topic": func(p []byte) (interface{}, error) { return extractGenericJSONValue("Topic", p) },
"voltagecal": func(p []byte) (interface{}, error) { return extractFloatToInt("VoltageCal", p) },
} }
func extractSettingValue(setting string, payloadChan chan []byte) (interface{}, error) { func extractSettingValue(setting string, payloadChan chan []byte) (interface{}, error) {