astr0n8t / blog

blog.nathanhigley.com (the new one)
GNU General Public License v3.0
0 stars 0 forks source link

posts/energymonitoring/ #48

Open utterances-bot opened 3 months ago

utterances-bot commented 3 months ago

Energy Monitoring with a Tasmota Smart plug · ~/blog

just a guy who likes cyber

https://blog.nathanhigley.com/posts/energymonitoring/

BetterThenUs commented 3 months ago

Hello, unfortunately the container does not run as described under Portainer. After the start phase, it stops with the following error message:

Metric.__init__(self, name, documentation, 'gauge', unit)

File "/usr/local/lib/python3.12/site-packages/prometheus_client/metrics_core.py", line 28, in init raise ValueError('Invalid metric name: ' + name) ValueError: Invalid metric name: tasmota__temperature_°C Traceback (most recent call last): File "/app/metrics.py", line 76, in REGISTRY.register(TasmotaCollector()) File "/usr/local/lib/python3.12/site-packages/prometheus_client/registry.py", line 40, in register names = self._get_names(collector) ^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.12/site-packages/prometheus_client/registry.py", line 80, in _get_names for metric in desc_func(): File "/app/metrics.py", line 32, in collect r = GaugeMetricFamily(metric_name, key, labels=['device'], unit=unit) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

What am I doing wrong?

astr0n8t commented 3 months ago

Seems as if one of the names in tasmota is an odd Unicode character so maybe your tasmota is newer than mine was when I created it. I no longer have a tasmota device so I can't test unfortunately