Closed michalzxc closed 1 year ago
hi @michalzxc,
Could you please provide the MQTT original topic + payload please?
It should look like:
topic '<prefix>/<name>', payload '{"temperature":26.24,"humidity":45.37}'
or
topic '<prefix>/<name>/sensor/temperature' '20.00'
Also please elaborate on the problem: is it crashing or just not exposing the metrics?
It is not exposing it
<prefix=hubitat>/<hub name=home-hub>/<device name, including spaces>/"attributes"/<name>/"value"
Inside "value" there is an actual value, not JSON, but raw
thanks do you mean that the value is in the topic and not in the payload?
ok I got a look to the doc you provided.
Can you please try using the hubitat_support branch please?
The entire topic for power consumption for device called "PC Power Switch":
hubitat/home-hub/PC Power Switch/attributes/power/value
Voltage is here:
hubitat/home-hub/PC Power Switch/attributes/voltage/value
Inside of the first one there is RAW output with 7, representing 7W.
Picture from MQTT Explorer:
On/Off example: I have topic
hubitat/home-hub/Storage light/attributes/switch/value
It has value on
what means light is on, if I want to turn it off I need to publish payload off
to hubitat/home-hub/Storage light/attributes/switch/value
Building container from hubitat branch
In yours example, what you called "some room" is actually a "device name"
And temperature should be under attributes
string
thanks for the details.
In yours example, what you called "some room" is actually a "device name"
yes, a device is usually a room in my example, so don't worry for this one.
And temperature should be under attributes string
did you do something custom?
because the doc you provided says that the metrics look like:
hubitat/[hubname]/[device name]/[attribute name]/value
hubitat/[hubname]/[device name]/attributes/[attribute name]/value
Like for example:
hubitat/home-hub/PC Power Switch/attributes/power/value
There is static attributes
as a string here
I did nothing custom, it doesn't really have any configuration options:
IP, username, password, and selecting devices to expose, that is all that I can configure here
actually it works with both:
hubitat/[hubname]/[device name]/[attribute name]/value
hubitat/[hubname]/[device name]/attributes/[attribute name]/value
So all good in any case. I've updated the branch to remove a breakpoint and to update the test.
Please test and let me know if it works for you.
Thank you! That works 🎉
# TYPE mqtt_message_total counter
mqtt_message_total{topic="hubitat_home-hub_bedroom button aircon"} 2.0
mqtt_message_total{topic="hubitat_home-hub_bedroom light"} 1.0
mqtt_message_total{topic="hubitat_home-hub_big desk button monitors"} 2.0
mqtt_message_total{topic="hubitat_home-hub_pc power switch"} 7.0
mqtt_message_total{topic="hubitat_home-hub_living room main light"} 1.0
mqtt_message_total{topic="glow_C4DD57D80A24_STATE"} 3.0
mqtt_message_total{topic="glow_C4DD57D80A24_SENSOR_electricitymeter"} 3.0
# HELP mqtt_message_created Counter of received messages
# TYPE mqtt_message_created gauge
mqtt_message_created{topic="hubitat_home-hub_bedroom button aircon"} 1.6881450690604203e+09
mqtt_message_created{topic="hubitat_home-hub_bedroom light"} 1.6881450690609236e+09
mqtt_message_created{topic="hubitat_home-hub_big desk button monitors"} 1.688145069061259e+09
mqtt_message_created{topic="hubitat_home-hub_pc power switch"} 1.688145069062229e+09
mqtt_message_created{topic="hubitat_home-hub_living room main light"} 1.6881450691002738e+09
mqtt_message_created{topic="glow_C4DD57D80A24_STATE"} 1.6881450716572747e+09
mqtt_message_created{topic="glow_C4DD57D80A24_SENSOR_electricitymeter"} 1.6881450716623971e+09
# HELP mqtt_lastCheckinEpoch metric generated from MQTT message.
# TYPE mqtt_lastCheckinEpoch gauge
mqtt_lastCheckinEpoch{topic="hubitat_home-hub_bedroom button aircon"} 1.688143195759e+012
mqtt_lastCheckinEpoch{topic="hubitat_home-hub_bedroom light"} 1.688144134114e+012
mqtt_lastCheckinEpoch{topic="hubitat_home-hub_big desk button monitors"} 1.688143616701e+012
mqtt_lastCheckinEpoch{topic="hubitat_home-hub_living room main light"} 1.688143460225e+012
I confused myself in last couple of comments (deleted them), it is all good :) Thank you again
# HELP python_gc_objects_collected_total Objects collected during gc
# TYPE python_gc_objects_collected_total counter
python_gc_objects_collected_total{generation="0"} 462.0
python_gc_objects_collected_total{generation="1"} 145.0
python_gc_objects_collected_total{generation="2"} 0.0
# HELP python_gc_objects_uncollectable_total Uncollectable objects found during GC
# TYPE python_gc_objects_uncollectable_total counter
python_gc_objects_uncollectable_total{generation="0"} 0.0
python_gc_objects_uncollectable_total{generation="1"} 0.0
python_gc_objects_uncollectable_total{generation="2"} 0.0
# HELP python_gc_collections_total Number of times this generation was collected
# TYPE python_gc_collections_total counter
python_gc_collections_total{generation="0"} 44.0
python_gc_collections_total{generation="1"} 4.0
python_gc_collections_total{generation="2"} 0.0
# HELP python_info Python platform information
# TYPE python_info gauge
python_info{implementation="CPython",major="3",minor="10",patchlevel="12",version="3.10.12"} 1.0
# HELP process_virtual_memory_bytes Virtual memory size in bytes.
# TYPE process_virtual_memory_bytes gauge
process_virtual_memory_bytes 2.7455488e+07
# HELP process_resident_memory_bytes Resident memory size in bytes.
# TYPE process_resident_memory_bytes gauge
process_resident_memory_bytes 1.9673088e+07
# HELP process_start_time_seconds Start time of the process since unix epoch in seconds.
# TYPE process_start_time_seconds gauge
process_start_time_seconds 1.68814506766e+09
# HELP process_cpu_seconds_total Total user and system CPU time spent in seconds.
# TYPE process_cpu_seconds_total counter
process_cpu_seconds_total 0.22999999999999998
# HELP process_open_fds Number of open file descriptors.
# TYPE process_open_fds gauge
process_open_fds 8.0
# HELP process_max_fds Maximum number of open file descriptors.
# TYPE process_max_fds gauge
process_max_fds 1.048576e+06
# HELP mqtt_message_total Counter of received messages
# TYPE mqtt_message_total counter
mqtt_message_total{topic="hubitat_home-hub_bedroom button aircon"} 2.0
mqtt_message_total{topic="hubitat_home-hub_bedroom light"} 1.0
mqtt_message_total{topic="hubitat_home-hub_big desk button monitors"} 2.0
mqtt_message_total{topic="hubitat_home-hub_pc power switch"} 7.0
mqtt_message_total{topic="hubitat_home-hub_living room main light"} 1.0
mqtt_message_total{topic="glow_C4DD57D80A24_STATE"} 3.0
mqtt_message_total{topic="glow_C4DD57D80A24_SENSOR_electricitymeter"} 3.0
# HELP mqtt_message_created Counter of received messages
# TYPE mqtt_message_created gauge
mqtt_message_created{topic="hubitat_home-hub_bedroom button aircon"} 1.6881450690604203e+09
mqtt_message_created{topic="hubitat_home-hub_bedroom light"} 1.6881450690609236e+09
mqtt_message_created{topic="hubitat_home-hub_big desk button monitors"} 1.688145069061259e+09
mqtt_message_created{topic="hubitat_home-hub_pc power switch"} 1.688145069062229e+09
mqtt_message_created{topic="hubitat_home-hub_living room main light"} 1.6881450691002738e+09
mqtt_message_created{topic="glow_C4DD57D80A24_STATE"} 1.6881450716572747e+09
mqtt_message_created{topic="glow_C4DD57D80A24_SENSOR_electricitymeter"} 1.6881450716623971e+09
# HELP mqtt_lastCheckinEpoch metric generated from MQTT message.
# TYPE mqtt_lastCheckinEpoch gauge
mqtt_lastCheckinEpoch{topic="hubitat_home-hub_bedroom button aircon"} 1.688143195759e+012
mqtt_lastCheckinEpoch{topic="hubitat_home-hub_bedroom light"} 1.688144134114e+012
mqtt_lastCheckinEpoch{topic="hubitat_home-hub_big desk button monitors"} 1.688143616701e+012
mqtt_lastCheckinEpoch{topic="hubitat_home-hub_living room main light"} 1.688143460225e+012
# HELP mqtt_battery metric generated from MQTT message.
# TYPE mqtt_battery gauge
mqtt_battery{topic="hubitat_home-hub_bedroom button aircon"} 100.0
mqtt_battery{topic="hubitat_home-hub_big desk button monitors"} 97.0
# HELP mqtt_power metric generated from MQTT message.
# TYPE mqtt_power gauge
mqtt_power{topic="hubitat_home-hub_pc power switch"} 7.0
# HELP mqtt_voltage metric generated from MQTT message.
# TYPE mqtt_voltage gauge
mqtt_voltage{topic="hubitat_home-hub_pc power switch"} 250.0
# HELP mqtt_energy metric generated from MQTT message.
# TYPE mqtt_energy gauge
mqtt_energy{topic="hubitat_home-hub_pc power switch"} 4.33
# HELP mqtt_amperage metric generated from MQTT message.
# TYPE mqtt_amperage gauge
mqtt_amperage{topic="hubitat_home-hub_pc power switch"} 0.242
# HELP mqtt_energyCost metric generated from MQTT message.
# TYPE mqtt_energyCost gauge
mqtt_energyCost{topic="hubitat_home-hub_pc power switch"} 0.92
# HELP mqtt_hourlyEnergy metric generated from MQTT message.
# TYPE mqtt_hourlyEnergy gauge
mqtt_hourlyEnergy{topic="hubitat_home-hub_pc power switch"} 0.01
# HELP mqtt_han_rssi metric generated from MQTT message.
# TYPE mqtt_han_rssi gauge
mqtt_han_rssi{topic="glow_C4DD57D80A24_STATE"} -54.0
# HELP mqtt_han_lqi metric generated from MQTT message.
# TYPE mqtt_han_lqi gauge
mqtt_han_lqi{topic="glow_C4DD57D80A24_STATE"} 184.0
# HELP mqtt_electricitymeter_energy_export_cumulative metric generated from MQTT message.
# TYPE mqtt_electricitymeter_energy_export_cumulative gauge
mqtt_electricitymeter_energy_export_cumulative{topic="glow_C4DD57D80A24_SENSOR_electricitymeter"} 0.0
# HELP mqtt_electricitymeter_energy_import_cumulative metric generated from MQTT message.
# TYPE mqtt_electricitymeter_energy_import_cumulative gauge
mqtt_electricitymeter_energy_import_cumulative{topic="glow_C4DD57D80A24_SENSOR_electricitymeter"} 24245.852
# HELP mqtt_electricitymeter_energy_import_day metric generated from MQTT message.
# TYPE mqtt_electricitymeter_energy_import_day gauge
mqtt_electricitymeter_energy_import_day{topic="glow_C4DD57D80A24_SENSOR_electricitymeter"} 11.4
# HELP mqtt_electricitymeter_energy_import_mpan metric generated from MQTT message.
# TYPE mqtt_electricitymeter_energy_import_mpan gauge
mqtt_electricitymeter_energy_import_mpan{topic="glow_C4DD57D80A24_SENSOR_electricitymeter"} 1.30000117248e+012
# HELP mqtt_electricitymeter_energy_import_price_unitrate metric generated from MQTT message.
# TYPE mqtt_electricitymeter_energy_import_price_unitrate gauge
mqtt_electricitymeter_energy_import_price_unitrate{topic="glow_C4DD57D80A24_SENSOR_electricitymeter"} 0.3476
# HELP mqtt_electricitymeter_energy_import_price_standingcharge metric generated from MQTT message.
# TYPE mqtt_electricitymeter_energy_import_price_standingcharge gauge
mqtt_electricitymeter_energy_import_price_standingcharge{topic="glow_C4DD57D80A24_SENSOR_electricitymeter"} 0.6018
# HELP mqtt_electricitymeter_power_value metric generated from MQTT message.
# TYPE mqtt_electricitymeter_power_value gauge
mqtt_electricitymeter_power_value{topic="glow_C4DD57D80A24_SENSOR_electricitymeter"} 0.419
sounds great! :tada:
I'll merge the branch and do the release.
v1.3.0 released
I configured Hubitat Zigbee hub with https://community.hubitat.com/t/beta-yama-yet-another-mqtt-app/62219
I am trying to export metrics it produces to Prometheus Specially I am interested in power metrics: