jaketbd/tasmoprom
Prometheus Exporter for Tasmota Energy Data
41
https://github.com/jaketbd/tasmoprom
Prometheus Exporter for Tasmota Energy Data
TasmoProm is a server that helps you get energy statistics from your Tasmota devices into Prometheus for monitoring and analysis. It does this by directly scraping the data from the Tasmota web interface, making it easy to set up and get started quickly.
Key Points:
docker pull jaketbd/tasmoprom:1.1-linux-<amd64/arm64>
The default location for the configuration file is /etc/tasmoprom/config.yaml
.
You can change the path to the configuration file with the TASMOPROM_CONFIG_FILE_PATH
variable
log_mode
: Controls the verbosity of logs. Options:
debug
: Most detailed logs, including debugging informationinfo
: General events and information (default)error
: Logs only errorsweb
: Configures the built-in web server for Prometheus metrics.
addr
: Address and port to listen on (default: :2112
)path
: Path to expose metrics on (default: /metrics
)blueprints
: Defines the blueprints to use for scraping Tasmota devices.jobs
: Defines the jobs to run, which include the devices to scrape and the blueprint to useThe blueprints can be used to adapt the scraping to other devices and the scope of the collected data
name
: Name of the blueprintspecs
: List of specifications to scrape
metric_name
: Name of the metric in Prometheusselector
: CSS selector to find the value in the HTMLremap_values
: Optional mapping of values to other valueserror_value
: Value to use if the selector is not found or if an error occurs (default: -1
)The jobs define the devices to scrape and the blueprint to use for each device.
name
: Name of the jobnamespace
: Namespace to use for the metricssubsystem
: Subsystem to use for the metricsinterval
: Interval as a duration string (e.g. 10s
, 1m
, 1h
) (default: 5s
)blueprint_name
: Name of the blueprint to use (if not specified, the default blueprint is used)host
: Hostname or IP address of the Tasmota device (scheme and port are required)path
: Path to the Tasmota web interface (default: /?m=1
)NOTE: The metric name provided to prometheus is created from the name of the blueprint specification and the name of the scrape job. For example, if the blueprint specification is named voltage
and the job is named plug1
, the metric name will be plug1_voltage
.
The default blueprint is a template that works with the NOUS A1T (v13.4.0) out of the box.
name: default
specs:
- metric_name: voltage
selector: table:nth-of-type(2) tr:nth-child(2) td:nth-child(3)
- metric_name: current
selector: table:nth-of-type(2) tr:nth-child(3) td:nth-child(3)
- metric_name: active_power
selector: table:nth-of-type(2) tr:nth-child(4) td:nth-child(3)
- metric_name: apparent_power
selector: table:nth-of-type(2) tr:nth-child(5) td:nth-child(3)
- metric_name: reactive_power
selector: table:nth-of-type(2) tr:nth-child(6) td:nth-child(3)
- metric_name: power_actor
selector: table:nth-of-type(2) tr:nth-child(7) td:nth-child(3)
- metric_name: energy_today
selector: table:nth-of-type(2) tr:nth-child(8) td:nth-child(3)
- metric_name: energy_yesterday
selector: table:nth-of-type(2) tr:nth-child(9) td:nth-child(3)
- metric_name: energy_total
selector: table:nth-of-type(2) tr:nth-child(10) td:nth-child(3)
- metric_name: state
selector: table:nth-of-type(4) tr td
remap_values:
OFF: 0
ON: 1
jobs:
- name: plug1
host: http://1.2.3.1
- name: plug2
host: http://1.2.3.2
- name: plug3
host: http://1.2.3.3
- name: plug4
host: http://1.2.3.4
jobs.include_metadata
)docker pull jaketbd/tasmoprom