Skip to content

Commit

Permalink
Merge pull request #81 from mcbirse/main
Browse files Browse the repository at this point in the history
Add timezone to telegraf so tags are localized - fixes #80
  • Loading branch information
jasonacox authored Sep 24, 2022
2 parents b516016 + 2293f54 commit fef8f93
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 2 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ Follow the **[Grafana Setup](https://github.com/jasonacox/Powerwall-Dashboard#gr

If you prefer, you can perform the same steps that `setup.sh` performs.

You will want to set your local timezone by editing `pypowerwall.env`, `influxdb.sql` and `dashboard.json` or you can use this handy `tz.sh` update script. A list of timezones is available [here](https://en.wikipedia.org/wiki/List_of_tz_database_time_zones).
You will want to set your local timezone by editing `pypowerwall.env`, `telegraf.conf`, `influxdb.sql` and `dashboard.json` or you can use this handy `tz.sh` update script. A list of timezones is available [here](https://en.wikipedia.org/wiki/List_of_tz_database_time_zones).

```bash
# Replace with your timezone
Expand Down
2 changes: 2 additions & 0 deletions telegraf.conf
Original file line number Diff line number Diff line change
Expand Up @@ -115,10 +115,12 @@
[[processors.date]]
tag_key = "month"
date_format = "Jan"
timezone = "America/Los_Angeles"

[[processors.date]]
tag_key = "year"
date_format = "2006"
timezone = "America/Los_Angeles"

# Configuration for sending metrics to InfluxDB
#[[outputs.influxdb]]
Expand Down
3 changes: 2 additions & 1 deletion tz.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#!/bin/bash
# Shell script to replace timezone values in powerwall.yml, influxdb.sql and dashboard.json
# Shell script to replace timezone values in powerwall.yml, telegraf.conf, influxdb.sql and dashboard.json
if [ $# -eq 0 ]
then
echo "ERROR: No timzezone supplied"
Expand All @@ -18,6 +18,7 @@ updatetz() {
local from=${1}
local to=${2}
sed -i.bak "s@${from}@${to}@g" powerwall.yml
sed -i.bak "s@${from}@${to}@g" telegraf.conf
sed -i.bak "s@${from}@${to}@g" influxdb/influxdb.sql
for i in dashboard*.json; do
sed -i.bak "s@${from}@${to}@g" $i
Expand Down

0 comments on commit fef8f93

Please sign in to comment.