-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathpvoutput_for_givtcp.yaml
59 lines (54 loc) · 2.35 KB
/
pvoutput_for_givtcp.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
# Sign up at pvoutput.org and set up your system definition.
# Visit the settings page, scroll to the bottom
# Generate an API Key, save, enable API Access, save.
# Make a note of your API Key and System ID
# Add this to configuration.yaml in Home Assistant
# Make sure you edit all sensor names to match your own entities
# Change PVOUTPUT_API_KEY and PVOUTPUT_SYSTEM_ID (twice!) to match your actual API key and system ID
# Reboot Home Assistant!
rest_command:
update_pvoutput:
url: https://pvoutput.org/service/r2/addstatus.jsp
method: post
content_type: "application/x-www-form-urlencoded"
headers:
X-Pvoutput-Apikey: PVOUTPUT_API_KEY
X-Pvoutput-SystemId: PVOUTPUT_SYSTEM_ID
payload: "d={{now().strftime('%Y%m%d')}}&t={{now().strftime('%H:%M')}}&v1={{((states('sensor.givtcp_pv_energy_today_kwh')|float(default=0))*1000)|int}}&v2={{(states('sensor.givtcp_pv_power'))|round(0)}}&v4={{(states('sensor.givtcp_load_power'))|round(0)}}&v6={{(states('sensor.givtcp_grid_voltage'))|round(0)}}"
update_pvoutput_endofday:
url: https://pvoutput.org/service/r2/addoutput.jsp
method: post
content_type: "application/x-www-form-urlencoded"
headers:
X-Pvoutput-Apikey: PVOUTPUT_API_KEY
X-Pvoutput-SystemId: PVOUTPUT_SYSTEM_ID
payload: "d={{now().strftime('%Y%m%d')}}&g={{((states('sensor.givtcp_pv_energy_today_kwh')|float(default=0))*1000)|int}}&e={{((states('sensor.givtcp_export_energy_today_kwh')|float(default=0))*1000)|int}}"
# Create a new automation and use the following YAML
# This runs every 2 minutes and uploads your live data
alias: PVOutput for GivTCP - Update System
description: ""
trigger:
- platform: time_pattern
minutes: "/2"
condition:
- condition: time
before: "23:54:00"
action:
- service: rest_command.update_pvoutput
data: {}
mode: single
# Create another new automation as follows.
# This runs at the end of the day and uploads your finalised data
alias: PVOutput for GivTCP - Update End Of Day
description: ""
trigger:
- platform: time
at: "23:55:00"
condition: []
action:
- service: rest_command.update_pvoutput_endofday
data: {}
mode: single
# Join the GivEnergy team: https://pvoutput.org/listteam.jsp?tid=1694
# You need at least 5 'outputs' (or days) of data to be able to join a team
# It's possible to bodge around that by manually adding 'Outputs' for previous days.