Retrieve and display historical energy consumption data.
Shows voltage, current, power, and energy measurements stored by the
device over time (up to 60 days of 1-minute interval data).
Works with:
EM components (3-phase energy monitors)
EM1 components (single-phase energy monitors)
The device must have EMData or EM1Data components that store historical
measurements. Switches, covers, lights and PM meters (Plus 1PM, Plus 2PM,
Plug), and Gen1 devices, keep only a running energy total: read it, with
the live power, using ‘shelly energy status ’.
# Show last 24 hours of energy data
shelly energy history shelly-3em-pro
# Show specific time range
shelly energy history shelly-em --from "2025-01-01" --to "2025-01-07"
# Show last week for specific component
shelly energy history shelly-3em-pro 0 --period week
# Limit number of records shown
shelly energy history shelly-em --limit 100
--from string Start time (RFC3339 or YYYY-MM-DD)
-h, --help help for history
--limit int Limit number of data points (0 = no limit)
-p, --period string Time period (hour, day, week, month)
--to string End time (RFC3339 or YYYY-MM-DD)
--type string Component type (auto, em, em1) (default "auto")
--config string Config file (default $HOME/.config/shelly/config.yaml)
-F, --fields Print available field names for use with --jq and --template
-Q, --jq stringArray Apply jq expression to filter output (repeatable, joined with |)
--log-categories string Filter logs by category (comma-separated: network,api,device,config,auth,plugin)
--log-json Output logs in JSON format
--no-color Disable colored output
--no-headers Hide table headers in output
--offline Only read from cache, error on cache miss
-o, --output string Output format (table, json, yaml, template) (default "table")
--plain Disable borders and colors (machine-readable output)
-q, --quiet Suppress non-essential output
--raw Print the exact device response(s) as a JSON array and suppress normal output
--refresh Bypass cache and fetch fresh data from device
--template string Go template string for output (use with -o template)
-v, --verbose count Increase verbosity (-v=info, -vv=debug, -vvv=trace)