Home Assistant Powerwall Dashboard connection #718
Replies: 6 comments 9 replies
-
|
just tried using this w/ my system and it seems to be working great. Thanks for putting this together and sharing it. |
Beta Was this translation helpful? Give feedback.
-
Beta Was this translation helpful? Give feedback.
-
|
Hi @JEMcats and Jason, The new and improved data logic provided by @JEMcats worked like a charm. I have made my dashboard in HA modifications and all is good. Thanks for the update. |
Beta Was this translation helpful? Give feedback.
-
|
Maybe just me but I’ve seen a lot of errors in Logs once implementing these sensors. ChatGPT has helped fix some but just wondering if I’m alone seeing those. |
Beta Was this translation helpful? Give feedback.
-
|
V2 of the configuration is out, it adds proper timezone management and compatibility with the home assistant energy dashboard. If you had V1 of the configuration installed previously, I recommend installing V2. Copy the configuration from the original post NOT the config below, if you copy the config from below you will get the difference map. command_line:
- sensor:
name: Solar power
unique_id: solar_power
icon: "mdi:solar-power"
command: >
curl -s --location 'http://<ip and port of your influxdb>/query?db=powerwall' \
--header 'Content-Type: application/x-www-form-urlencoded' \
--data-urlencode 'q=SELECT last("solar_instant_power") / 1000 FROM "raw"."http" WHERE time >= now() - 1m' \
| jq -r '.results[0].series[0].values[0][1]'
scan_interval: 10
unit_of_measurement: kW
+ device_class: power
+ state_class: measurement
- sensor:
name: Battery power
unique_id: battery_power
icon: "mdi:home-battery"
command: >
curl -s --location 'http://<ip and port of your influxdb>/query?db=powerwall' \
--header 'Content-Type: application/x-www-form-urlencoded' \
--data-urlencode 'q=SELECT last("battery_instant_power") / 1000 FROM "raw"."http" WHERE time >= now() - 1m' \
| jq -r '.results[0].series[0].values[0][1]'
scan_interval: 10
unit_of_measurement: kW
+ device_class: power
+ state_class: measurement
- sensor:
name: Grid power
unique_id: grid_power
icon: "mdi:transmission-tower"
command: >
curl -s --location 'http://<ip and port of your influxdb>/query?db=powerwall' \
--header 'Content-Type: application/x-www-form-urlencoded' \
--data-urlencode 'q=SELECT last("site_instant_power") / 1000 FROM "raw"."http" WHERE time >= now() - 1m' \
| jq -r '.results[0].series[0].values[0][1]'
scan_interval: 10
unit_of_measurement: kW
+ device_class: power
+ state_class: measurement
- sensor:
name: Load power
unique_id: load_power
icon: "mdi:power-plug"
command: >
curl -s --location 'http://<ip and port of your influxdb>/query?db=powerwall' \
--header 'Content-Type: application/x-www-form-urlencoded' \
--data-urlencode 'q=SELECT last("load_instant_power") / 1000 FROM "raw"."http" WHERE time >= now() - 1m' \
| jq -r '.results[0].series[0].values[0][1]'
scan_interval: 10
unit_of_measurement: kW
+ device_class: power
+ state_class: measurement
- sensor:
name: Percentage charged
unique_id: percentage_charged
icon: "mdi:battery"
command: >
curl -s --location 'http://<ip and port of your influxdb>/query?db=powerwall' \
--header 'Content-Type: application/x-www-form-urlencoded' \
--data-urlencode 'q=SELECT last("percentage") /0.95 - 5/0.95 FROM "autogen"."http" WHERE time >= now() - 2m' \
| jq -r '.results[0].series[0].values[0][1]'
scan_interval: 10
unit_of_measurement: "%"
- sensor:
name: Grid status
unique_id: grid_status
icon: "mdi:transmission-tower"
command: >
curl -s --location 'http://<ip and port of your influxdb>/query?db=powerwall'
--header 'Content-Type: application/x-www-form-urlencoded'
--data-urlencode 'q=SELECT min("grid_status") FROM "grid"."http" WHERE time >= now() - 2m'
| jq -r '.results[0].series[0].values[0][1]'
value_template: >
{% if value | int == 1 %}
Connected
{% else %}
Disconnected
{% endif %}
scan_interval: 10
- sensor:
name: Battery charged
unique_id: battery_charged
icon: "mdi:battery-arrow-up"
unit_of_measurement: kWh
+ device_class: energy
+ state_class: total_increasing
command: >
curl -s 'http://<ip and port of your influxdb>/query?db=powerwall'
--header 'Content-Type: application/x-www-form-urlencoded'
- --data-urlencode "q=SELECT integral(\"to_pw\") / 1000 / 3600 FROM \"autogen\".\"http\" WHERE time >= '$(date -d '00:00' -u +'%Y-%m-%dT%H:%M:%SZ')' AND time <= now()"
+ --data-urlencode "q=SELECT integral(\"to_pw\") / 1000 / 3600 FROM \"autogen\".\"http\" WHERE time >= '$(date -u -d "@$(( $(TZ=<your timezone here eg. America/New_York> date -d '00:00' +%s)))" +'%Y-%m-%dT%H:%M:%SZ')' AND time <= now()"
| jq -r '.results[0].series[0].values[0][1] // 0'
scan_interval: 10
- sensor:
name: Battery discharged
unique_id: battery_discharged
icon: "mdi:battery-arrow-down"
unit_of_measurement: kWh
+ device_class: energy
+ state_class: total_increasing
command: >
curl -s 'http://<ip and port of your influxdb>/query?db=powerwall'
--header 'Content-Type: application/x-www-form-urlencoded'
- --data-urlencode "q=SELECT integral(\"from_pw\") / 1000 / 3600 FROM \"autogen\".\"http\" WHERE time >= '$(date -d '00:00' -u +'%Y-%m-%dT%H:%M:%SZ')' AND time <= now()"
+ --data-urlencode "q=SELECT integral(\"from_pw\") / 1000 / 3600 FROM \"autogen\".\"http\" WHERE time >= '$(date -u -d "@$(( $(TZ=<your timezone here eg. America/New_York> date -d '00:00' +%s)))" +'%Y-%m-%dT%H:%M:%SZ')' AND time <= now()"
| jq -r '.results[0].series[0].values[0][1] // 0'
scan_interval: 10
- sensor:
name: Grid exported
unique_id: grid_exported
icon: "mdi:transmission-tower-export"
unit_of_measurement: kWh
+ device_class: energy
+ state_class: total_increasing
command: >
curl -s 'http://<ip and port of your influxdb>/query?db=powerwall'
--header 'Content-Type: application/x-www-form-urlencoded'
- --data-urlencode "q=SELECT integral(\"to_grid\") / 1000 / 3600 FROM \"autogen\".\"http\" WHERE time >= '$(date -d '00:00' -u +'%Y-%m-%dT%H:%M:%SZ')' AND time <= now()"
+ --data-urlencode "q=SELECT integral(\"to_grid\") / 1000 / 3600 FROM \"autogen\".\"http\" WHERE time >= '$(date -u -d "@$(( $(TZ=<your timezone here eg. America/New_York> date -d '00:00' +%s)))" +'%Y-%m-%dT%H:%M:%SZ')' AND time <= now()"
| jq -r '.results[0].series[0].values[0][1] // 0'
scan_interval: 10
- sensor:
name: Grid imported
unique_id: grid_imported
icon: "mdi:transmission-tower-import"
unit_of_measurement: kWh
+ device_class: energy
+ state_class: total_increasing
command: >
curl -s 'http://<ip and port of your influxdb>/query?db=powerwall'
--header 'Content-Type: application/x-www-form-urlencoded'
- --data-urlencode "q=SELECT integral(\"from_grid\") / 1000 / 3600 FROM \"autogen\".\"http\" WHERE time >= '$(date -d '00:00' -u +'%Y-%m-%dT%H:%M:%SZ')' AND time <= now()"
+ --data-urlencode "q=SELECT integral(\"from_grid\") / 1000 / 3600 FROM \"autogen\".\"http\" WHERE time >= '$(date -u -d "@$(( $(TZ=<your timezone here eg. America/New_York> date -d '00:00' +%s)))" +'%Y-%m-%dT%H:%M:%SZ')' AND time <= now()"
| jq -r '.results[0].series[0].values[0][1] // 0'
scan_interval: 10
- sensor:
name: Home usage
unique_id: home_usage
icon: "mdi:home-lightning-bolt"
unit_of_measurement: kWh
+ device_class: energy
+ state_class: total_increasing
command: >
curl -s 'http://<ip and port of your influxdb>/query?db=powerwall'
--header 'Content-Type: application/x-www-form-urlencoded'
- --data-urlencode "q=SELECT integral(\"home\") / 1000 / 3600 FROM \"autogen\".\"http\" WHERE time >= '$(date -d '00:00' -u +'%Y-%m-%dT%H:%M:%SZ')' AND time <= now()"
+ --data-urlencode "q=SELECT integral(\"home\") / 1000 / 3600 FROM \"autogen\".\"http\" WHERE time >= '$(date -u -d "@$(( $(TZ=<your timezone here eg. America/New_York> date -d '00:00' +%s)))" +'%Y-%m-%dT%H:%M:%SZ')' AND time <= now()"
| jq -r '.results[0].series[0].values[0][1] // 0'
scan_interval: 10
- sensor:
name: Solar generated
unique_id: solar_generated
icon: "mdi:solar-power-variant"
unit_of_measurement: kWh
+ device_class: energy
+ state_class: total_increasing
scan_interval: 10
command: >
- curl -s 'http:/<ip and port of your influxdb>/query?db=powerwall'
+ curl -s 'http://<ip and port of your influxdb>/query?db=powerwall'
--header 'Content-Type: application/x-www-form-urlencoded'
- --data-urlencode "q=SELECT integral(\"solar\") / 1000 / 3600 FROM \"autogen\".\"http\" WHERE time >= '$(date -d '00:00' -u +'%Y-%m-%dT%H:%M:%SZ')' AND time <= now()"
+ --data-urlencode "q=SELECT integral(\"solar\") / 1000 / 3600 FROM \"autogen\".\"http\" WHERE time >= '$(date -u -d "@$(( $(TZ=<your timezone here eg. America/New_York> date -d '00:00' +%s)))" +'%Y-%m-%dT%H:%M:%SZ')' AND time <= now()"
| jq -r '.results[0].series[0].values[0][1] // 0' |
Beta Was this translation helpful? Give feedback.
-
|
@JEMcats - Thank you so much for this! I just spent last night setting this up only to find the new and improved version posted this morning. Another plus for the new version is it supports the native Energy Dashboard. I was finally able to add the sensors in the configuration.yaml file to the energy dashboard. |
Beta Was this translation helpful? Give feedback.

Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
I have created a simple way to integrate the most important data from your Powerwall Dashboard data into Home Assistant.
Requirements
influxdb,telegraf, andpypowerwall.Limitations
What does it do
It will expose the following sensors to Home Assistant:
All sensors are in a format ment to mimic the format of HA tesla_fleet by @Bre77.
All sensors in
kWhare daily power meters and will reset at midnight. These sensors are good for the energy dashboard in Home Assistant.All data will be refreshed every 10 seconds, this can be changed by changing the
scan_interval(seconds) values.Install
Add the following with your own values to your home assistant
configuration.yaml:Beta Was this translation helpful? Give feedback.
All reactions