index added

This commit is contained in:
aexel90 2020-12-28 09:37:44 +01:00
parent 5663b27f4a
commit 95d43ee327

View file

@ -20,6 +20,7 @@ const (
LabelName = "Name" LabelName = "Name"
LabelType = "Type" LabelType = "Type"
LabelIndex = "Index"
LabelModelID = "Model_ID" LabelModelID = "Model_ID"
LabelManufacturerName = "Manufacturer_Name" LabelManufacturerName = "Manufacturer_Name"
LabelSWVersion = "SW_Version" LabelSWVersion = "SW_Version"
@ -47,21 +48,21 @@ func (exporter *Exporter) InitMetrics() (metrics []*metric.Metric) {
HueType: TypeLight, HueType: TypeLight,
FqName: "hue_light_info", FqName: "hue_light_info",
Help: "Non-numeric data, value is always 1", Help: "Non-numeric data, value is always 1",
Labels: []string{LabelName, LabelType, LabelModelID, LabelManufacturerName, LabelSWVersion, LabelUniqueID, LabelStateOn, LabelStateAlert, LabelStateBri, LabelStateCT, LabelStateReachable, LabelStateSaturation}, Labels: []string{LabelName, LabelIndex, LabelType, LabelModelID, LabelManufacturerName, LabelSWVersion, LabelUniqueID, LabelStateOn, LabelStateAlert, LabelStateBri, LabelStateCT, LabelStateReachable, LabelStateSaturation},
}) })
metrics = append(metrics, &metric.Metric{ metrics = append(metrics, &metric.Metric{
HueType: TypeSensor, HueType: TypeSensor,
FqName: "hue_sensor_info", FqName: "hue_sensor_info",
Help: "Non-numeric data, value is always 1", Help: "Non-numeric data, value is always 1",
Labels: []string{LabelName, LabelType, LabelModelID, LabelManufacturerName, LabelSWVersion, LabelUniqueID, LabelStateButtonEvent, LabelStateDaylight, LabelStateLastUpdated, LabelStateLastUpdatedTime, LabelStateTemperature, LabelConfigBattery, LabelConfigOn, LabelConfigReachable}, Labels: []string{LabelName, LabelIndex, LabelType, LabelModelID, LabelManufacturerName, LabelSWVersion, LabelUniqueID, LabelStateButtonEvent, LabelStateDaylight, LabelStateLastUpdated, LabelStateLastUpdatedTime, LabelStateTemperature, LabelConfigBattery, LabelConfigOn, LabelConfigReachable},
}) })
metrics = append(metrics, &metric.Metric{ metrics = append(metrics, &metric.Metric{
HueType: TypeSensor, HueType: TypeSensor,
FqName: "hue_sensor_battery", FqName: "hue_sensor_battery",
Help: "battery level percentage", Help: "battery level percentage",
Labels: []string{LabelName, LabelType, LabelModelID, LabelManufacturerName, LabelSWVersion, LabelUniqueID}, Labels: []string{LabelName, LabelIndex, LabelType, LabelModelID, LabelManufacturerName, LabelSWVersion, LabelUniqueID},
ResultKey: LabelConfigBattery, ResultKey: LabelConfigBattery,
}) })
@ -69,7 +70,7 @@ func (exporter *Exporter) InitMetrics() (metrics []*metric.Metric) {
HueType: TypeSensor, HueType: TypeSensor,
FqName: "hue_sensor_temperature", FqName: "hue_sensor_temperature",
Help: "temperature level celsius degree", Help: "temperature level celsius degree",
Labels: []string{LabelName, LabelType, LabelModelID, LabelManufacturerName, LabelSWVersion, LabelUniqueID}, Labels: []string{LabelName, LabelIndex, LabelType, LabelModelID, LabelManufacturerName, LabelSWVersion, LabelUniqueID},
ResultKey: LabelStateTemperature, ResultKey: LabelStateTemperature,
}) })
@ -117,6 +118,7 @@ func collectSensors(bridge *hue.Bridge) (sensorData []map[string]interface{}, er
for _, sensor := range sensors { for _, sensor := range sensors {
result := make(map[string]interface{}) result := make(map[string]interface{})
result[LabelName] = sensor.Name result[LabelName] = sensor.Name
result[LabelIndex] = sensor.Index
result[LabelType] = sensor.Type result[LabelType] = sensor.Type
result[LabelModelID] = sensor.ModelID result[LabelModelID] = sensor.ModelID
result[LabelManufacturerName] = sensor.ManufacturerName result[LabelManufacturerName] = sensor.ManufacturerName
@ -150,6 +152,7 @@ func collectLights(bridge *hue.Bridge) (lightData []map[string]interface{}, err
result := make(map[string]interface{}) result := make(map[string]interface{})
result[LabelName] = light.Name result[LabelName] = light.Name
result[LabelIndex] = light.Index
result[LabelType] = light.Type result[LabelType] = light.Type
result[LabelModelID] = light.ModelID result[LabelModelID] = light.ModelID
result[LabelManufacturerName] = light.ManufacturerName result[LabelManufacturerName] = light.ManufacturerName