Domoticz & Prometheus Integration

Client tools or tools that can connect with Domoticz. Tools for Windows, iOS, Android, Linux etc.

Moderator: leecollings

Post Reply
wywywywy
Posts: 13
Joined: Wednesday 27 September 2017 23:32
Target OS: Linux
Domoticz version:
Contact:

Domoticz & Prometheus Integration

Post by wywywywy »

Hi all,

I guess there's probably a number of people here using Prometheus + Grafana to display various metrics for their homes.

Now Prometheus can easily go and grab JSON for metrics, and Domoticz does expose its metrics through the API.

So in theory this should be possible, but has anyone tried it yet? What is the easiest way to do this?

Personally I am particularly interested in energy usage and temperature metrics. And when I try to get the current usage this is what I get.

/json.htm?type=devices&rid=34

Code: Select all

{
   "ActTime" : 1517263547,
   "ServerTime" : "2018-01-29 22:05:47",
   "Sunrise" : "08:01",
   "Sunset" : "16:45",
   "result" : [
      {
         "AddjMulti" : 1.0,
         "AddjMulti2" : 1.0,
         "AddjValue" : 0.0,
         "AddjValue2" : 0.0,
         "BatteryLevel" : 255,
         "CustomImage" : 0,
         "Data" : "894.0 Watt",
         "Description" : "",
         "Favorite" : 1,
         "HardwareID" : 7,
         "HardwareName" : "CurrentCost",
         "HardwareType" : "CurrentCost Meter USB",
         "HardwareTypeVal" : 65,
         "HaveTimeout" : false,
         "ID" : "0000002",
         "LastUpdate" : "2018-01-29 22:05:37",
         "Name" : "House Power",
         "Notifications" : "false",
         "PlanID" : "0",
         "PlanIDs" : [ 0 ],
         "Protected" : false,
         "ShowNotifications" : true,
         "SignalLevel" : "-",
         "SubType" : "Electric",
         "Timers" : "false",
         "Type" : "Usage",
         "TypeImg" : "current",
         "Unit" : 1,
         "Used" : 1,
         "XOffset" : "0",
         "YOffset" : "0",
         "idx" : "34"
      }
   ],
   "status" : "OK",
   "title" : "Devices"
}
The main thing that worries me is the "Data" is a string not a number. Anyone knows how to get around this in Prometheus?

Thanks.
wywywywy
Posts: 13
Joined: Wednesday 27 September 2017 23:32
Target OS: Linux
Domoticz version:
Contact:

Re: Domoticz & Prometheus Integration

Post by wywywywy »

In the end I created one myself.

I'm going to share it here in case it turns out to be useful to someone else as well.

https://github.com/wywywywy/domoticz_exporter
ggiblin
Posts: 1
Joined: Monday 22 March 2021 22:35
Target OS: -
Domoticz version:
Contact:

Re: Domoticz & Prometheus Integration

Post by ggiblin »

Well done that man.
It's a great exporter.
I installed it tonight.
It does exactly what I want.
Now to set-up a few alerts.

Thanks
Gerard
Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest