Home Assistant can show Power Trace data next to its own devices. There is no dedicated integration yet, but there is a simple path: Power Trace serves the current readings at /live, and Home Assistant reads them with REST sensors. The Power Trace dashboard itself can be embedded in Home Assistant as a page of its own. It all takes one YAML block and a few clicks.
What you need: Power Trace running and collecting data; Home Assistant on the same network (or both on Tailscale); access to configuration.yaml — easiest with the File editor app (Settings → Apps → Install app).
Open this in a browser on the computer you use for Home Assistant:
You should see JSON text with "online": true and the readings: power, voltage, current, pf, freq_hz, relay.
192.168.0.200, rather than a name: not every device knows a name without a dot such as powertrace. On a Raspberry Pi, hostname -I shows the address — take the one from your local network.
Open configuration.yaml (in File editor: folder icon → configuration.yaml) and add the block below at the end of the file. If the file already has a rest: section, add the item to it rather than a second section of the same name.
192.168.0.200 with the IP address of your Power Trace from step 1. It is highlighted in the block — it is the only thing to change. With someone else’s address the sensors will be “unavailable”.
rest:
- resource: http://192.168.0.200:8000/live
scan_interval: 10
sensor:
- name: "PowerTrace power"
value_template: "{{ value_json.power | float(none) }}"
unit_of_measurement: "W"
device_class: power
state_class: measurement
- name: "PowerTrace voltage"
value_template: "{{ value_json.voltage | float(none) }}"
unit_of_measurement: "V"
device_class: voltage
state_class: measurement
- name: "PowerTrace current"
value_template: "{{ value_json.current | float(none) }}"
unit_of_measurement: "A"
device_class: current
state_class: measurement
- name: "PowerTrace power factor"
value_template: "{{ value_json.pf | float(none) }}"
device_class: power_factor
state_class: measurement
- name: "PowerTrace frequency"
value_template: "{{ value_json.freq_hz | float(none) }}"
unit_of_measurement: "Hz"
device_class: frequency
state_class: measurement
binary_sensor:
- name: "PowerTrace relay"
value_template: "{{ (value_json.relay or {}).on | default(false) }}"
device_class: power
rest: has no indentation and - resource: has exactly two spaces.
- Settings → Tools → YAML → Check configuration (or the address
/config/tools/yaml). You should see “Configuration will not prevent Home Assistant from starting!”. - On the same page click Restart → Restart Home Assistant. It is safe even without the check: with an error in the configuration Home Assistant will not restart and will show the error.
- Tools → States, type
powertracein the filter.
sensor.powertrace_power, _voltage, _current, _power_factor, _frequency and binary_sensor.powertrace_relay — with the same values as the Power Trace dashboard.
Standard Home Assistant cards cannot reproduce the Power Trace charts, episodes and analysis, but the dashboard itself can be added as a page of its own:
- Settings → Dashboards → Add dashboard (or the address
/config/lovelace/dashboards) - Choose Webpage
- URL:
http://<Power Trace address>:8000/index.html - Title Power Trace, icon
mdi:flash; to have it in the side menu, leave showing in the sidebar on
/live has no kWh counter, but Home Assistant can work energy out from power:
- Settings → Devices & services → Helpers → Create helper → Integral sensor (or the address
/config/helpers) - Input sensor
sensor.powertrace_power, Integration method — “Trapezoidal rule”, Metric prefix —k, Time unit — “Hours” - The address
/config/energy→ Electricity grid → Add grid connection → pick the sensor you created
The bars appear after the first full hour ends. In our check one hour came to 92 Wh against 91 in Power Trace; with sharp load changes the difference can be larger. The exact energy is in Power Trace itself.
The meter is powered from the same mains, so without power it goes silent and the sensors from step 2 become “unknown”. An automation can build on that: power “unknown” for 5 minutes — the power is out; a number is back — the power came back. No need to edit configuration.yaml.
- Settings → Automations & scenes → Create automation → Create new automation, then ⋮ → Edit in YAML.
- Replace the content with the block below and save.
alias: "Power Trace: power went out / came back"
mode: queued
triggers:
- trigger: state
entity_id: sensor.powertrace_power
to: [unknown, unavailable]
for: { minutes: 5 }
id: lost
- trigger: state
entity_id: sensor.powertrace_power
from: [unknown, unavailable]
id: back
actions:
- choose:
- conditions: [{ condition: trigger, id: lost }]
sequence:
- action: persistent_notification.create
data:
notification_id: powertrace_power
title: Power Trace
message: >-
⚡ Power went out at {{ as_local(trigger.to_state.last_changed).strftime('%H:%M') }}
(or the meter dropped off Wi-Fi)
- conditions:
- { condition: trigger, id: back }
- condition: template
value_template: >-
{{ (trigger.to_state.last_changed - trigger.from_state.last_changed).total_seconds() >= 300 }}
sequence:
- action: persistent_notification.create
data:
notification_id: powertrace_power
title: Power Trace
message: >-
✅ Power came back at {{ as_local(trigger.to_state.last_changed).strftime('%H:%M') }},
it was out for {{ ((trigger.to_state.last_changed - trigger.from_state.last_changed).total_seconds() / 60) | round(0) | int }} min
persistent_notification.create with notify.mobile_app_<phone_name>, for example notify.mobile_app_pixel_8.
Then an embedded dashboard with an http:// address does not load: Home Assistant itself says it cannot show an http iframe. You need an https address for Power Trace. The easiest way to get one is Tailscale — for Power Trace, and for Home Assistant too if it has no https yet:
- On the Power Trace machine run
tailscale serve --bg http://127.0.0.1:8000(on a Raspberry Pi withsudo), see the Tailscale guide. Power Trace becomes available ashttps://<name>.<your tailnet>.ts.net. - If Home Assistant has no https yet: Settings → Apps → Install app → Tailscale; in its configuration, under “Share Home Assistant with Serve or Funnel”, choose serve and save. Do not start it yet.
- Settings → System → Network → HTTP server → Reverse proxy (or the address
/config/network): turn on Trust X-Forwarded-For, add127.0.0.1to Trusted proxies, click Save → Save and restart. After the restart, confirm the new settings, or Home Assistant reverts them in a few minutes. - Start the Tailscale app and approve the login at the link in its log. Home Assistant becomes available as
https://homeassistant.<your tailnet>.ts.net. - In the Power Trace webpage (step 4) set the URL to
https://<Power Trace name>.<your tailnet>.ts.net/index.html.
http: block in configuration.yaml. And do not choose funnel: it opens Home Assistant to the internet.
.ts.net addresses open only on devices in your Tailscale network. The REST sensors (step 2) do not depend on this: Home Assistant itself makes the requests to /live, so the http address stays there.
- Works within your home network: the device you view Home Assistant on must reach Power Trace. Away from home — only through Tailscale.
- If Home Assistant is opened over
https://, embed Power Trace by its https address — see the section above. - The collector updates the readings about once a minute, so there is no point polling more often.
- When Power Trace is offline, the numeric sensors become “unknown” and the relay state shows “off”.
- There is no dedicated integration or MQTT with discovery yet.
Sensors “unavailable”. Most often the block still has the address from the example. Check the address and the network: open /live from the Home Assistant machine. For requests by a public name Power Trace answers 403 — use the IP address, a .local or .lan name, or the Tailscale name.
A message about http instead of the dashboard. Home Assistant is opened over https:// — see the https section.
Configuration error. Most often the YAML indentation or a second rest: section.
Need an MQTT integration with discovery? Write to us — it tells us whether it is worth building.