Skip to content

Can I pull daily stats from API? #213

Answered by jasonacox
dkerr64 asked this question in Q&A
Discussion options

You must be logged in to vote

Hi David, yes you can pull this data directly from InfluxDB. Here is a curl statement that pulls the last 7 days of HOME usage (change localhost to the host running the dashboard). The first uses the simple kwh data where the second computes the kwh data from raw (more current and is what the "meters" use on the Dashboard):

# Use the kWh series - this uses the CQ data so will lag a bit between CQ runs but will be fast
curl 'http://localhost:8086/query?pretty=true' \
    --data-urlencode "db=powerwall" \
    --data-urlencode "q=SELECT sum(\"home\") FROM \"kwh\".\"http\" WHERE (\"home\" > 0) AND time >= now()-7d GROUP BY time(1d) fill(0) tz('America/Los_Angeles')"

# Use the autogen series …

Replies: 4 comments 4 replies

Comment options

You must be logged in to vote
0 replies
Answer selected by dkerr64
Comment options

You must be logged in to vote
1 reply
@jasonacox
Comment options

Comment options

You must be logged in to vote
3 replies
@jasonacox
Comment options

@dkerr64
Comment options

@jasonacox
Comment options

Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants