lstrojny / homebridge-prometheus-exporter Goto Github PK
View Code? Open in Web Editor NEWPrometheus metrics exporter for homebridge accessories
License: Apache License 2.0
Prometheus metrics exporter for homebridge accessories
License: Apache License 2.0
Describe The Bug:
The plugin fails to load due to missing 'hap-nodejs' module error.
To Reproduce:
Expected behavior:
Logs:
[11/9/2022, 3:42:27 PM] ====================
[11/9/2022, 3:42:27 PM] ERROR LOADING PLUGIN homebridge-prometheus-exporter:
[11/9/2022, 3:42:27 PM] Error: Cannot find module 'hap-nodejs'
Require stack:
- /homebridge/node_modules/homebridge-prometheus-exporter/dist/src/metrics.js
- /homebridge/node_modules/homebridge-prometheus-exporter/dist/src/platform.js
- /homebridge/node_modules/homebridge-prometheus-exporter/dist/src/index.js
- /homebridge/node_modules/homebridge/lib/plugin.js
- /homebridge/node_modules/homebridge/lib/pluginManager.js
- /homebridge/node_modules/homebridge/lib/server.js
- /homebridge/node_modules/homebridge/lib/cli.js
- /homebridge/node_modules/homebridge/bin/homebridge
at Function.Module._resolveFilename (node:internal/modules/cjs/loader:985:15)
at Function.Module._load (node:internal/modules/cjs/loader:833:27)
at Module.require (node:internal/modules/cjs/loader:1057:19)
at require (node:internal/modules/cjs/helpers:103:18)
at Object.<anonymous> (/homebridge/node_modules/homebridge-prometheus-exporter/src/metrics.ts:4:1)
at Module._compile (node:internal/modules/cjs/loader:1155:14)
at Object.Module._extensions..js (node:internal/modules/cjs/loader:1209:10)
at Module.load (node:internal/modules/cjs/loader:1033:32)
at Function.Module._load (node:internal/modules/cjs/loader:868:12)
at Module.require (node:internal/modules/cjs/loader:1057:19)
[11/9/2022, 3:42:27 PM] ====================
Plugin Config:
{
"platform": "PrometheusExporter",
"pin": "XXX-XX-XXX",
"debug": false,
"prefix": "homebridge",
"port": 36123,
"refresh_interval": 60,
"request_timeout": 1,
"discovery_timeout": 20
}
Screenshots:
Environment:
oznu/homebridge:latest
built on Ubuntu 20.04.5 LTS)Hi and thanks a lot for this plugin. It's fabulous, I hope it will be keep alive and improved, I just built some of my stat panels (see screenshot), but I was wondering: is there a way to build a panel with the total time of an outlet when is ON?
Probably it would be just a workaround like divide the time by the number of entries etc... but I'm struggling to figure out the correct way, because the exporter use only the 1-0 status but not the timestamp, maybe is possible to implement it? Or any other way to retrieve the same result?
Thanks!
Describe The Bug:
The exporters format is non-compliant to the text based format specified by Prometheus.
While I have successfully imported from this exporter directly into prometheus itself, I am unable to import into telegraf.
In case of telegraf, the parsing of the /metrics output leads to errors.
This seems to be a well-known issue with custom exporters. See also prometheus/common#265
It is not clear to me, why prometheus itself though accepts the format. My best guess is that it is less strict when parsing.
To Reproduce:
Install the plugin and inspect /metrics afterwards.
The output contains multiple TYPE specifications of the same field, leading to parsing errors.
1 # TYPE homebridge_window_covering_current_position_percentage gauge
2 homebridge_window_covering_current_position_percentage{bridge="Homebridge 1C64 3C3E",device_id="<REDACTED>",manufacturer="Shelly",model="SHSW-25",name="Rollo Schlafzimmer West",serial_number="<REDACTED>",firmware_revision="1.9.4",hardware_revision="prod-191217"} 100 1673170769987
[... skip lines 3-6...]
7 # TYPE homebridge_window_covering_current_position_percentage gauge
8 homebridge_window_covering_current_position_percentage{bridge="Homebridge 1C64 3C3E",device_id="<REDACTED>",manufacturer="Shelly",model="SHSW-25",name="Shelly Greta",serial_number="<REDACTED>",firmware_revision ="1.9.4",hardware_revision="prod-191217"} 100 1673170769987
When telegraf sees this, it fails due to the uncompliant format, with the line 7 effectively repeating the type statement from line 1.
2023-01-08T09:31:40Z E! [inputs.prometheus] Error in plugin: error reading metrics for http://ds218:36123/metrics: reading text format failed: text format parsing error in line 7: second TYPE line for metric name "homebridge_window_covering_current_position_percentage", or TYPE reported after samples
Expected behavior:
Exporter should adhere to the TEXT format specification, in particular in relation to HELP and TYPE fields. More info here:
https://prometheus.io/docs/instrumenting/exposition_formats/#comments-help-text-and-type-information
As far as I understand, the fix would be to group all metrics for the same TYPE under a single #TYPE line.
1 # TYPE homebridge_window_covering_current_position_percentage gauge
2 homebridge_window_covering_current_position_percentage{bridge="Homebridge 1C64 3C3E",device_id="<REDACTED>",manufacturer="Shelly",model="SHSW-25",name="Rollo Schlafzimmer West",serial_number="<REDACTED>",firmware_revision="1.9.4",hardware_revision="prod-191217"} 100 1673170769987
8 homebridge_window_covering_current_position_percentage{bridge="Homebridge 1C64 3C3E",device_id="<REDACTED>",manufacturer="Shelly",model="SHSW-25",name="Shelly Greta",serial_number="<REDACTED>",firmware_revision="1.9.4",hardware_revision="prod-191217"} 100 1673170769987
[... other groups for different types l...]
So effectively, from my example output, line 8 directly follows line 2, and the second TYPE declaration from line 7 disappears.
Logs:
omitting, as I deem them non-relevant. Can provide though if necessary.
Plugin Config:
{
"pin": "<REDACTED>",
"debug": true,
"prefix": "homebridge",
"port": 36123,
"interface": "::",
"refresh_interval": 60,
"request_timeout": 10,
"discovery_timeout": 20,
"platform": "PrometheusExporter"
}
Environment:
I saw you mention this on r/homebridge and had to try it. I'm hoping to record thermostat runtime and temperature from the various sensors I have in homebridge.
Describe The Bug:
I see errors in the logs every service refresh interval and fewer metrics (no temperature metrics) available under /metrics
than expected. I'm assuming the error prevents more metrics from being emitted.
To Reproduce:
Install plugin, use default settings, set as child bridge, restart, then view logs.
Expected behavior:
No errors in the logs
Logs:
Here's the first part of many of the errors the from the log with a little manual formatting and pretty print
[invalid_union] Invalid input at path "accessories.accessories.[12].services.[1].characteristics.[0]" (data at resolved path "accessories.accessories.[12].services.[1].characteristics.[0]" is
{
"type": "00000073-0000-1000-8000-0026BB765291",
"iid": 11,
"value": null,
"perms": [
"ev",
"pr"
],
"description": "Programmable Switch Event",
"format": "uint8",
"minValue": 0,
"maxValue": 2,
"minStep": 1,
"valid-values": [
0
]
}
Here's the error before it prints another 4000 lines of accessory json. I imagine all` the useful information is included in the error text but I can post the accessory json if that's useful.
[11/11/2022, 7:35:14 PM] [homebridge-prometheus-exporter] Boundary check for device data failed Error: Error checking type. Details: [invalid_union] Invalid input at path "accessories.accessories.[12].services.[1].characteristics.[0]" (data at resolved path "accessories.accessories.[12].services.[1].characteristics.[0]" is "{"type":"00000073-0000-1000-8000-0026BB765291","iid":11,"value":null,"perms":["ev","pr"],"description":"Programmable Switch Event","format":"uint8","minValue":0,"maxValue":2,"minStep":1,"valid-values":[0]}") | [invalid_union] Invalid input at path "accessories.accessories.[12].services.[2].characteristics.[0]" (data at resolved path "accessories.accessories.[12].services.[2].characteristics.[0]" is "{"type":"00000073-0000-1000-8000-0026BB765291","iid":15,"value":null,"perms":["ev","pr"],"description":"Programmable Switch Event","format":"uint8","minValue":0,"maxValue":2,"minStep":1,"valid-values":[0]}") | [invalid_union] Invalid input at path "accessories.accessories.[12].services.[3].characteristics.[0]" (data at resolved path "accessories.accessories.[12].services.[3].characteristics.[0]" is "{"type":"00000073-0000-1000-8000-0026BB765291","iid":19,"value":null,"perms":["ev","pr"],"description":"Programmable Switch Event","format":"uint8","minValue":0,"maxValue":2,"minStep":1,"valid-values":[0]}") | [invalid_union] Invalid input at path "accessories.accessories.[12].services.[4].characteristics.[0]" (data at resolved path "accessories.accessories.[12].services.[4].characteristics.[0]" is "{"type":"00000073-0000-1000-8000-0026BB765291","iid":23,"value":null,"perms":["ev","pr"],"description":"Programmable Switch Event","format":"uint8","minValue":0,"maxValue":2,"minStep":1,"valid-values":[0]}") | [invalid_union] Invalid input at path "accessories.accessories.[12].services.[5].characteristics.[0]" (data at resolved path "accessories.accessories.[12].services.[5].characteristics.[0]" is "{"type":"00000073-0000-1000-8000-0026BB765291","iid":27,"value":null,"perms":["ev","pr"],"description":"Programmable Switch Event","format":"uint8","minValue":0,"maxValue":2,"minStep":1,"valid-values":[0]}") | [invalid_union] Invalid input at path "accessories.accessories.[18].services.[2].characteristics.[0]" (data at resolved path "accessories.accessories.[18].services.[2].characteristics.[0]" is "{"type":"00000073-0000-1000-8000-0026BB765291","iid":12,"value":null,"perms":["ev","pr"],"description":"Programmable Switch Event","format":"uint8","minValue":0,"maxValue":2,"minStep":1,"valid-values":[0,1,2]}") | [invalid_union] Invalid input at path "accessories.accessories.[18].services.[3].characteristics.[0]" (data at resolved path "accessories.accessories.[18].services.[3].characteristics.[0]" is "{"type":"00000073-0000-1000-8000-0026BB765291","iid":16,"value":null,"perms":["ev","pr"],"description":"Programmable Switch Event","format":"uint8","minValue":0,"maxValue":2,"minStep":1,"valid-values":[0,1,2]}") | [invalid_union] Invalid input at path "accessories.accessories.[18].services.[4].characteristics.[0]" (data at resolved path "accessories.accessories.[18].services.[4].characteristics.[0]" is "{"type":"00000073-0000-1000-8000-0026BB765291","iid":20,"value":null,"perms":["ev","pr"],"description":"Programmable Switch Event","format":"uint8","minValue":0,"maxValue":2,"minStep":1,"valid-values":[0,1,2]}") | [invalid_union] Invalid input at path "accessories.accessories.[18].services.[5].characteristics.[0]" (data at resolved path "accessories.accessories.[18].services.[5].characteristics.[0]" is "{"type":"00000073-0000-1000-8000-0026BB765291","iid":24,"value":null,"perms":["ev","pr"],"description":"Programmable Switch Event","format":"uint8","minValue":0,"maxValue":2,"minStep":1,"valid-values":[0,1,2]}") | [invalid_union] Invalid input at path "accessories.accessories.[18].services.[6].characteristics.[0]" (data at resolved path "accessories.accessories.[18].services.[6].characteristics.[0]" is "{"type":"00000073-0000-1000-8000-0026BB765291","iid":28,"value":null,"perms":["ev","pr"],"description":"Programmable Switch Event","format":"uint8","minValue":0,"maxValue":2,"minStep":1,"valid-values":[0,1,2]}") | [invalid_union] Invalid input at path "accessories.accessories.[19].services.[2].characteristics.[0]" (data at resolved path "accessories.accessories.[19].services.[2].characteristics.[0]" is "{"type":"00000073-0000-1000-8000-0026BB765291","iid":12,"value":null,"perms":["ev","pr"],"description":"Programmable Switch Event","format":"uint8","minValue":0,"maxValue":2,"minStep":1,"valid-values":[0,1,2]}") | [invalid_union] Invalid input at path "accessories.accessories.[19].services.[3].characteristics.[0]" (data at resolved path "accessories.accessories.[19].services.[3].characteristics.[0]" is "{"type":"00000073-0000-1000-8000-0026BB765291","iid":16,"value":null,"perms":["ev","pr"],"description":"Programmable Switch Event","format":"uint8","minValue":0,"maxValue":2,"minStep":1,"valid-values":[0,1,2]}") | [invalid_union] Invalid input at path "accessories.accessories.[19].services.[4].characteristics.[0]" (data at resolved path "accessories.accessories.[19].services.[4].characteristics.[0]" is "{"type":"00000073-0000-1000-8000-0026BB765291","iid":20,"value":null,"perms":["ev","pr"],"description":"Programmable Switch Event","format":"uint8","minValue":0,"maxValue":2,"minStep":1,"valid-values":[0,1,2]}") | [invalid_union] Invalid input at path "accessories.accessories.[19].services.[5].characteristics.[0]" (data at resolved path "accessories.accessories.[19].services.[5].characteristics.[0]" is "{"type":"00000073-0000-1000-8000-0026BB765291","iid":24,"value":null,"perms":["ev","pr"],"description":"Programmable Switch Event","format":"uint8","minValue":0,"maxValue":2,"minStep":1,"valid-values":[0,1,2]}") | [invalid_union] Invalid input at path "accessories.accessories.[19].services.[6].characteristics.[0]" (data at resolved path "accessories.accessories.[19].services.[6].characteristics.[0]" is "{"type":"00000073-0000-1000-8000-0026BB765291","iid":28,"value":null,"perms":["ev","pr"],"description":"Programmable Switch Event","format":"uint8","minValue":0,"maxValue":2,"minStep":1,"valid-values":[0,1,2]}") | [invalid_union] Invalid input at path "accessories.accessories.[20].services.[2].characteristics.[0]" (data at resolved path "accessories.accessories.[20].services.[2].characteristics.[0]" is "{"type":"00000073-0000-1000-8000-0026BB765291","iid":12,"value":null,"perms":["ev","pr"],"description":"Programmable Switch Event","format":"uint8","minValue":0,"maxValue":2,"minStep":1,"valid-values":[0,1,2]}") | [invalid_union] Invalid input at path "accessories.accessories.[20].services.[3].characteristics.[0]" (data at resolved path "accessories.accessories.[20].services.[3].characteristics.[0]" is "{"type":"00000073-0000-1000-8000-0026BB765291","iid":16,"value":null,"perms":["ev","pr"],"description":"Programmable Switch Event","format":"uint8","minValue":0,"maxValue":2,"minStep":1,"valid-values":[0,1,2]}") | [invalid_union] Invalid input at path "accessories.accessories.[20].services.[4].characteristics.[0]" (data at resolved path "accessories.accessories.[20].services.[4].characteristics.[0]" is "{"type":"00000073-0000-1000-8000-0026BB765291","iid":20,"value":null,"perms":["ev","pr"],"description":"Programmable Switch Event","format":"uint8","minValue":0,"maxValue":2,"minStep":1,"valid-values":[0,1,2]}") | [invalid_union] Invalid input at path "accessories.accessories.[20].services.[5].characteristics.[0]" (data at resolved path "accessories.accessories.[20].services.[5].characteristics.[0]" is "{"type":"00000073-0000-1000-8000-0026BB765291","iid":24,"value":null,"perms":["ev","pr"],"description":"Programmable Switch Event","format":"uint8","minValue":0,"maxValue":2,"minStep":1,"valid-values":[0,1,2]}") | [invalid_union] Invalid input at path "accessories.accessories.[20].services.[6].characteristics.[0]" (data at resolved path "accessories.accessories.[20].services.[6].characteristics.[0]" is "{"type":"00000073-0000-1000-8000-0026BB765291","iid":28,"value":null,"perms":["ev","pr"],"description":"Programmable Switch Event","format":"uint8","minValue":0,"maxValue":2,"minStep":1,"valid-values":[0,1,2]}") | [invalid_union] Invalid input at path "accessories.accessories.[23].services.[1].characteristics.[0]" (data at resolved path "accessories.accessories.[23].services.[1].characteristics.[0]" is "{"type":"00000073-0000-1000-8000-0026BB765291","iid":11,"value":null,"perms":["ev","pr"],"description":"Programmable Switch Event","format":"uint8","minValue":0,"maxValue":2,"minStep":1,"valid-values":[0]}")
at checkBoundary (/usr/local/lib/node_modules/homebridge-prometheus-exporter/src/boundaries/checker.ts:51:11)
at HAPNodeJSClient.<anonymous> (/usr/local/lib/node_modules/homebridge-prometheus-exporter/src/adapters/discovery/hap_node_js_client.ts:34:51)
at HAPNodeJSClient.emit (node:events:390:28)
at HAPNodeJSClient.<anonymous> (/usr/local/lib/node_modules/homebridge-prometheus-exporter/node_modules/hap-node-client/HAPNodeJSClient.js:115:10)
at Timeout._onTimeout (/usr/local/lib/node_modules/homebridge-prometheus-exporter/node_modules/hap-node-client/HAPNodeJSClient.js:191:7)
at listOnTimeout (node:internal/timers:557:17)
at processTimers (node:internal/timers:500:7) {
[stack]: 'Error: Error checking type. Details: [invalid_union] Invalid input at path "accessories.accessories.[12].services.[1].characteristics.[0]" (data at resolved path "accessories.accessories.[12].services.[1].characteristics.[0]" is "{"type":"00000073-0000-1000-8000-0026BB765291","iid":11,"value":null,"perms":["ev","pr"],"description":"Programmable Switch Event","format":"uint8","minValue":0,"maxValue":2,"minStep":1,"valid-values":[0]}") | [invalid_union] Invalid input at path "accessories.accessories.[12].services.[2].characteristics.[0]" (data at resolved path "accessories.accessories.[12].services.[2].characteristics.[0]" is "{"type":"00000073-0000-1000-8000-0026BB765291","iid":15,"value":null,"perms":["ev","pr"],"description":"Programmable Switch Event","format":"uint8","minValue":0,"maxValue":2,"minStep":1,"valid-values":[0]}") | [invalid_union] Invalid input at path "accessories.accessories.[12].services.[3].characteristics.[0]" (data at resolved path "accessories.accessories.[12].services.[3].characteristics.[0]" is "{"type":"00000073-0000-1000-8000-0026BB765291","iid":19,"value":null,"perms":["ev","pr"],"description":"Programmable Switch Event","format":"uint8","minValue":0,"maxValue":2,"minStep":1,"valid-values":[0]}") | [invalid_union] Invalid input at path "accessories.accessories.[12].services.[4].characteristics.[0]" (data at resolved path "accessories.accessories.[12].services.[4].characteristics.[0]" is "{"type":"00000073-0000-1000-8000-0026BB765291","iid":23,"value":null,"perms":["ev","pr"],"description":"Programmable Switch Event","format":"uint8","minValue":0,"maxValue":2,"minStep":1,"valid-values":[0]}") | [invalid_union] Invalid input at path "accessories.accessories.[12].services.[5].characteristics.[0]" (data at resolved path "accessories.accessories.[12].services.[5].characteristics.[0]" is "{"type":"00000073-0000-1000-8000-0026BB765291","iid":27,"value":null,"perms":["ev","pr"],"description":"Programmable Switch Event","format":"uint8","minValue":0,"maxValue":2,"minStep":1,"valid-values":[0]}") | [invalid_union] Invalid input at path "accessories.accessories.[18].services.[2].characteristics.[0]" (data at resolved path "accessories.accessories.[18].services.[2].characteristics.[0]" is "{"type":"00000073-0000-1000-8000-0026BB765291","iid":12,"value":null,"perms":["ev","pr"],"description":"Programmable Switch Event","format":"uint8","minValue":0,"maxValue":2,"minStep":1,"valid-values":[0,1,2]}") | [invalid_union] Invalid input at path "accessories.accessories.[18].services.[3].characteristics.[0]" (data at resolved path "accessories.accessories.[18].services.[3].characteristics.[0]" is "{"type":"00000073-0000-1000-8000-0026BB765291","iid":16,"value":null,"perms":["ev","pr"],"description":"Programmable Switch Event","format":"uint8","minValue":0,"maxValue":2,"minStep":1,"valid-values":[0,1,2]}") | [invalid_union] Invalid input at path "accessories.accessories.[18].services.[4].characteristics.[0]" (data at resolved path "accessories.accessories.[18].services.[4].characteristics.[0]" is "{"type":"00000073-0000-1000-8000-0026BB765291","iid":20,"value":null,"perms":["ev","pr"],"description":"Programmable Switch Event","format":"uint8","minValue":0,"maxValue":2,"minStep":1,"valid-values":[0,1,2]}") | [invalid_union] Invalid input at path "accessories.accessories.[18].services.[5].characteristics.[0]" (data at resolved path "accessories.accessories.[18].services.[5].characteristics.[0]" is "{"type":"00000073-0000-1000-8000-0026BB765291","iid":24,"value":null,"perms":["ev","pr"],"description":"Programmable Switch Event","format":"uint8","minValue":0,"maxValue":2,"minStep":1,"valid-values":[0,1,2]}") | [invalid_union] Invalid input at path "accessories.accessories.[18].services.[6].characteristics.[0]" (data at resolved path "accessories.accessories.[18].services.[6].characteristics.[0]" is "{"type":"00000073-0000-1000-8000-0026BB765291","iid":28,"value":null,"perms":["ev","pr"],"description":"Programmable Switch Event","format":"uint8","minValue":0,"maxValue":2,"minStep":1,"valid-values":[0,1,2]}") | [invalid_union] Invalid input at path "accessories.accessories.[19].services.[2].characteristics.[0]" (data at resolved path "accessories.accessories.[19].services.[2].characteristics.[0]" is "{"type":"00000073-0000-1000-8000-0026BB765291","iid":12,"value":null,"perms":["ev","pr"],"description":"Programmable Switch Event","format":"uint8","minValue":0,"maxValue":2,"minStep":1,"valid-values":[0,1,2]}") | [invalid_union] Invalid input at path "accessories.accessories.[19].services.[3].characteristics.[0]" (data at resolved path "accessories.accessories.[19].services.[3].characteristics.[0]" is "{"type":"00000073-0000-1000-8000-0026BB765291","iid":16,"value":null,"perms":["ev","pr"],"description":"Programmable Switch Event","format":"uint8","minValue":0,"maxValue":2,"minStep":1,"valid-values":[0,1,2]}") | [invalid_union] Invalid input at path "accessories.accessories.[19].services.[4].characteristics.[0]" (data at resolved path "accessories.accessories.[19].services.[4].characteristics.[0]" is "{"type":"00000073-0000-1000-8000-0026BB765291","iid":20,"value":null,"perms":["ev","pr"],"description":"Programmable Switch Event","format":"uint8","minValue":0,"maxValue":2,"minStep":1,"valid-values":[0,1,2]}") | [invalid_union] Invalid input at path "accessories.accessories.[19].services.[5].characteristics.[0]" (data at resolved path "accessories.accessories.[19].services.[5].characteristics.[0]" is "{"type":"00000073-0000-1000-8000-0026BB765291","iid":24,"value":null,"perms":["ev","pr"],"description":"Programmable Switch Event","format":"uint8","minValue":0,"maxValue":2,"minStep":1,"valid-values":[0,1,2]}") | [invalid_union] Invalid input at path "accessories.accessories.[19].services.[6].characteristics.[0]" (data at resolved path "accessories.accessories.[19].services.[6].characteristics.[0]" is "{"type":"00000073-0000-1000-8000-0026BB765291","iid":28,"value":null,"perms":["ev","pr"],"description":"Programmable Switch Event","format":"uint8","minValue":0,"maxValue":2,"minStep":1,"valid-values":[0,1,2]}") | [invalid_union] Invalid input at path "accessories.accessories.[20].services.[2].characteristics.[0]" (data at resolved path "accessories.accessories.[20].services.[2].characteristics.[0]" is "{"type":"00000073-0000-1000-8000-0026BB765291","iid":12,"value":null,"perms":["ev","pr"],"description":"Programmable Switch Event","format":"uint8","minValue":0,"maxValue":2,"minStep":1,"valid-values":[0,1,2]}") | [invalid_union] Invalid input at path "accessories.accessories.[20].services.[3].characteristics.[0]" (data at resolved path "accessories.accessories.[20].services.[3].characteristics.[0]" is "{"type":"00000073-0000-1000-8000-0026BB765291","iid":16,"value":null,"perms":["ev","pr"],"description":"Programmable Switch Event","format":"uint8","minValue":0,"maxValue":2,"minStep":1,"valid-values":[0,1,2]}") | [invalid_union] Invalid input at path "accessories.accessories.[20].services.[4].characteristics.[0]" (data at resolved path "accessories.accessories.[20].services.[4].characteristics.[0]" is "{"type":"00000073-0000-1000-8000-0026BB765291","iid":20,"value":null,"perms":["ev","pr"],"description":"Programmable Switch Event","format":"uint8","minValue":0,"maxValue":2,"minStep":1,"valid-values":[0,1,2]}") | [invalid_union] Invalid input at path "accessories.accessories.[20].services.[5].characteristics.[0]" (data at resolved path "accessories.accessories.[20].services.[5].characteristics.[0]" is "{"type":"00000073-0000-1000-8000-0026BB765291","iid":24,"value":null,"perms":["ev","pr"],"description":"Programmable Switch Event","format":"uint8","minValue":0,"maxValue":2,"minStep":1,"valid-values":[0,1,2]}") | [invalid_union] Invalid input at path "accessories.accessories.[20].services.[6].characteristics.[0]" (data at resolved path "accessories.accessories.[20].services.[6].characteristics.[0]" is "{"type":"00000073-0000-1000-8000-0026BB765291","iid":28,"value":null,"perms":["ev","pr"],"description":"Programmable Switch Event","format":"uint8","minValue":0,"maxValue":2,"minStep":1,"valid-values":[0,1,2]}") | [invalid_union] Invalid input at path "accessories.accessories.[23].services.[1].characteristics.[0]" (data at resolved path "accessories.accessories.[23].services.[1].characteristics.[0]" is "{"type":"00000073-0000-1000-8000-0026BB765291","iid":11,"value":null,"perms":["ev","pr"],"description":"Programmable Switch Event","format":"uint8","minValue":0,"maxValue":2,"minStep":1,"valid-values":[0]}")\n' +
' at checkBoundary (/usr/local/lib/node_modules/homebridge-prometheus-exporter/src/boundaries/checker.ts:51:11)\n' +
' at HAPNodeJSClient.<anonymous> (/usr/local/lib/node_modules/homebridge-prometheus-exporter/src/adapters/discovery/hap_node_js_client.ts:34:51)\n' +
' at HAPNodeJSClient.emit (node:events:390:28)\n' +
' at HAPNodeJSClient.<anonymous> (/usr/local/lib/node_modules/homebridge-prometheus-exporter/node_modules/hap-node-client/HAPNodeJSClient.js:115:10)\n' +
' at Timeout._onTimeout (/usr/local/lib/node_modules/homebridge-prometheus-exporter/node_modules/hap-node-client/HAPNodeJSClient.js:191:7)\n' +
' at listOnTimeout (node:internal/timers:557:17)\n' +
' at processTimers (node:internal/timers:500:7)',
[message]: 'Error checking type. Details: [invalid_union] Invalid input at path "accessories.accessories.[12].services.[1].characteristics.[0]" (data at resolved path "accessories.accessories.[12].services.[1].characteristics.[0]" is "{"type":"00000073-0000-1000-8000-0026BB765291","iid":11,"value":null,"perms":["ev","pr"],"description":"Programmable Switch Event","format":"uint8","minValue":0,"maxValue":2,"minStep":1,"valid-values":[0]}") | [invalid_union] Invalid input at path "accessories.accessories.[12].services.[2].characteristics.[0]" (data at resolved path "accessories.accessories.[12].services.[2].characteristics.[0]" is "{"type":"00000073-0000-1000-8000-0026BB765291","iid":15,"value":null,"perms":["ev","pr"],"description":"Programmable Switch Event","format":"uint8","minValue":0,"maxValue":2,"minStep":1,"valid-values":[0]}") | [invalid_union] Invalid input at path "accessories.accessories.[12].services.[3].characteristics.[0]" (data at resolved path "accessories.accessories.[12].services.[3].characteristics.[0]" is "{"type":"00000073-0000-1000-8000-0026BB765291","iid":19,"value":null,"perms":["ev","pr"],"description":"Programmable Switch Event","format":"uint8","minValue":0,"maxValue":2,"minStep":1,"valid-values":[0]}") | [invalid_union] Invalid input at path "accessories.accessories.[12].services.[4].characteristics.[0]" (data at resolved path "accessories.accessories.[12].services.[4].characteristics.[0]" is "{"type":"00000073-0000-1000-8000-0026BB765291","iid":23,"value":null,"perms":["ev","pr"],"description":"Programmable Switch Event","format":"uint8","minValue":0,"maxValue":2,"minStep":1,"valid-values":[0]}") | [invalid_union] Invalid input at path "accessories.accessories.[12].services.[5].characteristics.[0]" (data at resolved path "accessories.accessories.[12].services.[5].characteristics.[0]" is "{"type":"00000073-0000-1000-8000-0026BB765291","iid":27,"value":null,"perms":["ev","pr"],"description":"Programmable Switch Event","format":"uint8","minValue":0,"maxValue":2,"minStep":1,"valid-values":[0]}") | [invalid_union] Invalid input at path "accessories.accessories.[18].services.[2].characteristics.[0]" (data at resolved path "accessories.accessories.[18].services.[2].characteristics.[0]" is "{"type":"00000073-0000-1000-8000-0026BB765291","iid":12,"value":null,"perms":["ev","pr"],"description":"Programmable Switch Event","format":"uint8","minValue":0,"maxValue":2,"minStep":1,"valid-values":[0,1,2]}") | [invalid_union] Invalid input at path "accessories.accessories.[18].services.[3].characteristics.[0]" (data at resolved path "accessories.accessories.[18].services.[3].characteristics.[0]" is "{"type":"00000073-0000-1000-8000-0026BB765291","iid":16,"value":null,"perms":["ev","pr"],"description":"Programmable Switch Event","format":"uint8","minValue":0,"maxValue":2,"minStep":1,"valid-values":[0,1,2]}") | [invalid_union] Invalid input at path "accessories.accessories.[18].services.[4].characteristics.[0]" (data at resolved path "accessories.accessories.[18].services.[4].characteristics.[0]" is "{"type":"00000073-0000-1000-8000-0026BB765291","iid":20,"value":null,"perms":["ev","pr"],"description":"Programmable Switch Event","format":"uint8","minValue":0,"maxValue":2,"minStep":1,"valid-values":[0,1,2]}") | [invalid_union] Invalid input at path "accessories.accessories.[18].services.[5].characteristics.[0]" (data at resolved path "accessories.accessories.[18].services.[5].characteristics.[0]" is "{"type":"00000073-0000-1000-8000-0026BB765291","iid":24,"value":null,"perms":["ev","pr"],"description":"Programmable Switch Event","format":"uint8","minValue":0,"maxValue":2,"minStep":1,"valid-values":[0,1,2]}") | [invalid_union] Invalid input at path "accessories.accessories.[18].services.[6].characteristics.[0]" (data at resolved path "accessories.accessories.[18].services.[6].characteristics.[0]" is "{"type":"00000073-0000-1000-8000-0026BB765291","iid":28,"value":null,"perms":["ev","pr"],"description":"Programmable Switch Event","format":"uint8","minValue":0,"maxValue":2,"minStep":1,"valid-values":[0,1,2]}") | [invalid_union] Invalid input at path "accessories.accessories.[19].services.[2].characteristics.[0]" (data at resolved path "accessories.accessories.[19].services.[2].characteristics.[0]" is "{"type":"00000073-0000-1000-8000-0026BB765291","iid":12,"value":null,"perms":["ev","pr"],"description":"Programmable Switch Event","format":"uint8","minValue":0,"maxValue":2,"minStep":1,"valid-values":[0,1,2]}") | [invalid_union] Invalid input at path "accessories.accessories.[19].services.[3].characteristics.[0]" (data at resolved path "accessories.accessories.[19].services.[3].characteristics.[0]" is "{"type":"00000073-0000-1000-8000-0026BB765291","iid":16,"value":null,"perms":["ev","pr"],"description":"Programmable Switch Event","format":"uint8","minValue":0,"maxValue":2,"minStep":1,"valid-values":[0,1,2]}") | [invalid_union] Invalid input at path "accessories.accessories.[19].services.[4].characteristics.[0]" (data at resolved path "accessories.accessories.[19].services.[4].characteristics.[0]" is "{"type":"00000073-0000-1000-8000-0026BB765291","iid":20,"value":null,"perms":["ev","pr"],"description":"Programmable Switch Event","format":"uint8","minValue":0,"maxValue":2,"minStep":1,"valid-values":[0,1,2]}") | [invalid_union] Invalid input at path "accessories.accessories.[19].services.[5].characteristics.[0]" (data at resolved path "accessories.accessories.[19].services.[5].characteristics.[0]" is "{"type":"00000073-0000-1000-8000-0026BB765291","iid":24,"value":null,"perms":["ev","pr"],"description":"Programmable Switch Event","format":"uint8","minValue":0,"maxValue":2,"minStep":1,"valid-values":[0,1,2]}") | [invalid_union] Invalid input at path "accessories.accessories.[19].services.[6].characteristics.[0]" (data at resolved path "accessories.accessories.[19].services.[6].characteristics.[0]" is "{"type":"00000073-0000-1000-8000-0026BB765291","iid":28,"value":null,"perms":["ev","pr"],"description":"Programmable Switch Event","format":"uint8","minValue":0,"maxValue":2,"minStep":1,"valid-values":[0,1,2]}") | [invalid_union] Invalid input at path "accessories.accessories.[20].services.[2].characteristics.[0]" (data at resolved path "accessories.accessories.[20].services.[2].characteristics.[0]" is "{"type":"00000073-0000-1000-8000-0026BB765291","iid":12,"value":null,"perms":["ev","pr"],"description":"Programmable Switch Event","format":"uint8","minValue":0,"maxValue":2,"minStep":1,"valid-values":[0,1,2]}") | [invalid_union] Invalid input at path "accessories.accessories.[20].services.[3].characteristics.[0]" (data at resolved path "accessories.accessories.[20].services.[3].characteristics.[0]" is "{"type":"00000073-0000-1000-8000-0026BB765291","iid":16,"value":null,"perms":["ev","pr"],"description":"Programmable Switch Event","format":"uint8","minValue":0,"maxValue":2,"minStep":1,"valid-values":[0,1,2]}") | [invalid_union] Invalid input at path "accessories.accessories.[20].services.[4].characteristics.[0]" (data at resolved path "accessories.accessories.[20].services.[4].characteristics.[0]" is "{"type":"00000073-0000-1000-8000-0026BB765291","iid":20,"value":null,"perms":["ev","pr"],"description":"Programmable Switch Event","format":"uint8","minValue":0,"maxValue":2,"minStep":1,"valid-values":[0,1,2]}") | [invalid_union] Invalid input at path "accessories.accessories.[20].services.[5].characteristics.[0]" (data at resolved path "accessories.accessories.[20].services.[5].characteristics.[0]" is "{"type":"00000073-0000-1000-8000-0026BB765291","iid":24,"value":null,"perms":["ev","pr"],"description":"Programmable Switch Event","format":"uint8","minValue":0,"maxValue":2,"minStep":1,"valid-values":[0,1,2]}") | [invalid_union] Invalid input at path "accessories.accessories.[20].services.[6].characteristics.[0]" (data at resolved path "accessories.accessories.[20].services.[6].characteristics.[0]" is "{"type":"00000073-0000-1000-8000-0026BB765291","iid":28,"value":null,"perms":["ev","pr"],"description":"Programmable Switch Event","format":"uint8","minValue":0,"maxValue":2,"minStep":1,"valid-values":[0,1,2]}") | [invalid_union] Invalid input at path "accessories.accessories.[23].services.[1].characteristics.[0]" (data at resolved path "accessories.accessories.[23].services.[1].characteristics.[0]" is "{"type":"00000073-0000-1000-8000-0026BB765291","iid":11,"value":null,"perms":["ev","pr"],"description":"Programmable Switch Event","format":"uint8","minValue":0,"maxValue":2,"minStep":1,"valid-values":[0]}")'
}
Plugin Config:
{
"pin": "...",
"debug": false,
"prefix": "homebridge",
"port": 36123,
"refresh_interval": 60,
"request_timeout": 10,
"discovery_timeout": 20,
"platform": "PrometheusExporter",
"_bridge": {
"username": "...",
"port": 31344
}
}
Screenshots:
Environment:
Describe The Bug:
The plugin doesn't listen to the given port.
The code currently uses ::
as the host to listen. This should probably be changed to localhost
or provide a config option. https://www.fastify.io/docs/latest/Reference/Server/#listen
To Reproduce:
I have IPv6 disabled on my Raspberry Pi. The plugin won't start cleanly for me in this case.
Expected behavior:
It should be able to listen on IPv4 as well.
Logs:
[16/11/2022, 09:51:30] [PrometheusExporter] Failed to start Prometheus HTTP server on port 36123: Error: listen EAFNOSUPPORT: address family not supported :::36123
at Server.setupListenHandle [as _listen2] (node:net:1355:21)
at listenInCluster (node:net:1420:12)
at doListen (node:net:1559:7)
at processTicksAndRejections (node:internal/process/task_queues:84:21) {
[stack]: 'Error: listen EAFNOSUPPORT: address family not supported :::36123\n' +
' at Server.setupListenHandle [as _listen2] (node:net:1355:21)\n' +
' at listenInCluster (node:net:1420:12)\n' +
' at doListen (node:net:1559:7)\n' +
' at processTicksAndRejections (node:internal/process/task_queues:84:21)',
[message]: 'listen EAFNOSUPPORT: address family not supported :::36123',
code: 'EAFNOSUPPORT',
errno: -97,
syscall: 'listen',
address: '::',
port: 36123
}
Plugin Config:
{
"pin": "548-70-314",
"debug": true,
"prefix": "homebridge",
"port": 36123,
"refresh_interval": 60,
"request_timeout": 10,
"discovery_timeout": 20,
"platform": "PrometheusExporter"
}
Screenshots:
Environment:
Just updated and I see this error in my Homebridge log, everything work by the way:
[PrometheusExporter] ::ffff:192.168.1.6:33520 - "GET /metrics HTTP/1.1" 503 "http://192.168.1.5:36123" "Prometheus/2.36.0-rc0" ""
(what is ::ffff:192.168.1.6:33520? Seems to be a mixed address between ipv4 and ipv6)
First of all thank you very much for making this plugin! I have been looking for something like it for some time now. I hope I filled everything correctly. If not please let me know.
Describe The Bug:
I installed the plugin and configured it according to the readme. However if I open the /metrics page it is blank. In the logs I found a very long list of errors. It starts of with "Boundary check for device data failed ZodError:".
To Reproduce:
I am not sure what the problem is. I have quite a few sensors and devices in homebridge (82 devices total). And some of the names have special characters (German) in them.
Expected behavior:
No error messages in the log file and information on the /metrics page.
Logs:
I attached the log file since there is so much content there.
homebridge.log
Plugin Config:
{
"bridge": {
"name": "Homebridge",
"username": "CC:22:3D:E3:CE:32",
"port": 51090,
"pin": "031-45-154"
},
"description": "Home Smart Home",
"platforms": [
{
"name": "Config",
"port": 8581,
"auth": "form",
"theme": "red",
"temp": "/sys/class/thermal/thermal_zone0/temp",
"tempUnits": "c",
"lang": "auto",
"platform": "config"
},
{
"name": "deCONZ",
"anyOn": true,
"configuredName": true,
"effects": true,
"hosts": [
"192.168.1.3:8081"
],
"lights": true,
"nativeHomeKitLights": true,
"nativeHomeKitSensors": true,
"resource": true,
"sensors": true,
"users": {
"xxx": "xxx"
},
"platform": "Hue"
},
{
"name": "Miele@home",
"clientID": "xxx",
"clientSecret": "xxx",
"language": "de",
"reconnectEventServerInterval": 60,
"disableStopActionFor": [
"Dishwasher"
],
"platform": "Miele@home"
},
{
"name": "Shelly",
"username": "xxx",
"password": "xxx",
"admin": {
"enabled": true
},
"devices": [
{
"id": "xxx",
"name": "Wohnzimmer Decke",
"type": "switch"
},
{
"id": "xxx",
"name": "Arbeitszimmer",
"type": "valve",
"exclude": false
}
],
"platform": "Shelly"
},
{
"pin": "031-45-154",
"debug": false,
"prefix": "homebridge",
"port": 36123,
"refresh_interval": 60,
"request_timeout": 10,
"discovery_timeout": 20,
"platform": "PrometheusExporter"
}
],
"accessories": [
{
"name": "Pihole",
"auth": "xxx",
"ssl": false,
"rejectUnauthorized": true,
"host": "192.168.1.3",
"port": 80,
"baseDirectory": "/admin/",
"time": 0,
"reversed": false,
"logLevel": 1,
"accessory": "Pihole"
},
{
"accessory": "PhilipsTV",
"name": "TV Wohnzimmer",
"ip_address": "192.168.1.124",
"poll_status_interval": "60",
"model_year": 2016,
"has_ssl": true,
"has_ambilight": false,
"wol_url": "wol://54:2A:A2:FA:B7:2E",
"username": "xxx",
"password": "xxx"
},
{
"accessory": "mi-flower-care",
"name": "Blumenkasten rechts",
"deviceId": "C4:7C:8D:6C:C8:AE",
"interval": 60
},
{
"accessory": "mi-flower-care",
"name": "Blumenkasten links",
"deviceId": "C4:7C:8D:6C:CD:6A",
"interval": 60
}
],
"disabledPlugins": [
"homebridge-mieleathome",
"homebridge-notification",
"homebridge-mi-flower-care"
]
}
Screenshots:
Environment:
Describe Your Problem:
After installing and configuring the plugin it does not appear to be listening on the metrics port. Upon further inspection the logs give the following:
Logs:
2024-01-31T00:42:21.546Z hapNodeJSClient HAP Discover failed Socket -> http://192.168.87.94:56430 invalid PIN or homebridge is not running in insecure mode with -I response.status - 470, response.data - { status: -70411 }, response.statusText - Connection Authorization Required
Plugin Config:
"bridge": {
"name": "Homebridge E936",
"username": "0E:5A:3B:56:E9:36",
"port": 51942,
"pin": "********",
"advertiser": "avahi",
"bind": [
"eth0",
"wlan0"
]
},
"accessories": [
],
"platforms": [
{
"pin": "********",
"debug": true,
"prefix": "homebridge",
"port": 36123,
"interface": "::",
"refresh_interval": 60,
"request_timeout": 10,
"discovery_timeout": 20,
"platform": "PrometheusExporter",
}
]
I've redacted the PIN here but the PIN in the plugin config (platforms section) matches the bridge PIN.
Additionally I've got insecure mode enabled in the UI.
Environment:
hb-service
under Raspbian GNU/Linux 11 (bullseye)I am not sure if this is a bug or I am blind. I have set it up all, well almost all, exported but I cannot see any of my lights, which are eWeLink zigbee mini in walls, all other eWeLink zigbee are exported like temperature and sensors but not these wall swithces. Are all devices supported? Or some are not going to be exported?
Latest version of all listed being used.
The HomeBridge Prometheus exporter is excellent. However, I have a question that is probably related to its architecture, or the architecture of HomeBridge in general. From what I can see, all metrics are exposed as Guages - they are single snapshot metrics. For example, a temperature sensor reports whatever value it has as the time of scraping. This works great for most sensor types. However, there are some other use cases where other types of metrics could be useful. This is partially discussed in issue #34.
For sensors that report "on" and "off" status, it would be useful if there was any way to expose a Prometheus Counter metric for these sensors. This metric would just be an incrementing count of the number of events that have occurred for the sensor. In this case, it would be the number of "on" and "off" events total, each as separate metrics. This could be tracked from whenever the exporter was started (since most people will be running it long-term - weeks at a time between restarts). If this were made available, it would then be possible to measure the number of events over time easier. This could lead to graphs like "number of times a motion sensor was triggered in the last hour". I can see a lot of cases where this would be useful. You could write Prometheus rules to report on patterns (if motion sensor has >1 event between 12am-5am, start a workflow via AlertManager).
For the most simple case, if this functionality were available, I could see how many times per hour my kids open the door to the refrigerator :) Just a thought and figured I'd capture it in an Issue here to see if this would be possible. Thanks!
Describe The Bug:
After starting homebridge the error message mentioned under "Logs" is displayed. When browsing to /metrics the message "Metrics discovery pending" is displayed.
To Reproduce:
Install and configure plugin. Restart homebridge.
Expected behavior:
No error message and metrics exposed at /metrics.
Logs:
[09/11/2022, 13:15:51] [PrometheusExporter] HAP discovery error Error: Could not resolve UUID 00000012-0000-1000-8000-656261617577 to service
at uuidToServerName (/usr/lib/node_modules/homebridge-prometheus-exporter/src/metrics.ts:140:11)
at aggregate (/usr/lib/node_modules/homebridge-prometheus-exporter/src/metrics.ts:51:37)
at /usr/lib/node_modules/homebridge-prometheus-exporter/src/platform.ts:58:42
Plugin Config:
{
"bridge": {
"name": "Homebridge",
"username": "xxx",
"port": 51090,
"pin": "031-45-154"
},
"description": "Home Smart Home",
"platforms": [
{
"name": "Config",
"port": 8581,
"auth": "form",
"theme": "red",
"temp": "/sys/class/thermal/thermal_zone0/temp",
"tempUnits": "c",
"lang": "auto",
"platform": "config"
},
{
"name": "deCONZ",
"anyOn": true,
"configuredName": true,
"effects": true,
"hosts": [
"192.168.1.3:8081"
],
"lights": true,
"nativeHomeKitLights": true,
"nativeHomeKitSensors": true,
"resource": true,
"sensors": true,
"users": {
"xxx": "xxx"
},
"platform": "Hue"
},
{
"name": "Miele@home",
"clientID": "xxx",
"clientSecret": "xxx",
"language": "de",
"reconnectEventServerInterval": 60,
"disableStopActionFor": [
"Dishwasher"
],
"platform": "Miele@home"
},
{
"name": "Shelly",
"username": "xxx",
"password": "xxx",
"admin": {
"enabled": true
},
"devices": [
{
"id": "xxx",
"name": "Wohnzimmer Decke",
"type": "switch"
},
{
"id": "xxx",
"name": "Arbeitszimmer",
"type": "valve",
"exclude": false
}
],
"platform": "Shelly"
},
{
"pin": "031-45-154",
"debug": false,
"prefix": "homebridge",
"port": 36123,
"refresh_interval": 60,
"request_timeout": 10,
"discovery_timeout": 20,
"platform": "PrometheusExporter"
}
],
"accessories": [
{
"name": "Pihole",
"auth": "xxx",
"ssl": false,
"rejectUnauthorized": true,
"host": "192.168.1.3",
"port": 80,
"baseDirectory": "/admin/",
"time": 0,
"reversed": false,
"logLevel": 1,
"accessory": "Pihole"
},
{
"accessory": "PhilipsTV",
"name": "TV Wohnzimmer",
"ip_address": "192.168.1.124",
"poll_status_interval": "60",
"model_year": 2016,
"has_ssl": true,
"has_ambilight": false,
"wol_url": "wol://54:2A:A2:FA:B7:2E",
"username": "xxx",
"password": "xxx"
},
{
"accessory": "mi-flower-care",
"name": "Blumenkasten rechts",
"deviceId": "xxx",
"interval": 60
},
{
"accessory": "mi-flower-care",
"name": "Blumenkasten links",
"deviceId": "xxx",
"interval": 60
}
],
"disabledPlugins": [
"homebridge-mieleathome",
"homebridge-notification",
"homebridge-mi-flower-care"
]
}
Screenshots:
Environment:
Let‘s have a sensible README
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.