Add Pstryk.pl tariff and meter (#23819)
This commit is contained in:
parent
bd7a8ea6dd
commit
9ea212f0b4
2 changed files with 121 additions and 0 deletions
68
templates/definition/meter/pstryk.yaml
Normal file
68
templates/definition/meter/pstryk.yaml
Normal file
|
|
@ -0,0 +1,68 @@
|
|||
template: pstryk
|
||||
products:
|
||||
- brand: Pstryk.pl
|
||||
description:
|
||||
generic: 3-phase meter via local HTTP
|
||||
|
||||
params:
|
||||
- name: usage
|
||||
choice: ["grid"]
|
||||
- name: host
|
||||
- name: cache
|
||||
advanced: true
|
||||
default: 1s
|
||||
|
||||
render: |
|
||||
{{- define "uri" -}}
|
||||
http://{{ .host }}/state
|
||||
{{- end }}
|
||||
type: custom
|
||||
power:
|
||||
source: http
|
||||
uri: {{ include "uri" . }}
|
||||
jq: .multiSensor.sensors[] | select(.id==0 and .type=="activePower") | .value // 0
|
||||
cache: {{ .cache }}
|
||||
energy:
|
||||
source: http
|
||||
uri: {{ include "uri" . }}
|
||||
jq: ((.multiSensor.sensors[] | select(.id==0 and .type=="forwardActiveEnergy") | .value // 0) / 1000)
|
||||
cache: {{ .cache }}
|
||||
currents:
|
||||
- source: http
|
||||
uri: {{ include "uri" . }}
|
||||
jq: ((.multiSensor.sensors[] | select(.id==1 and .type=="current") | .value // 0) / 1000)
|
||||
cache: {{ .cache }}
|
||||
- source: http
|
||||
uri: {{ include "uri" . }}
|
||||
jq: ((.multiSensor.sensors[] | select(.id==2 and .type=="current") | .value // 0) / 1000)
|
||||
cache: {{ .cache }}
|
||||
- source: http
|
||||
uri: {{ include "uri" . }}
|
||||
jq: ((.multiSensor.sensors[] | select(.id==3 and .type=="current") | .value // 0) / 1000)
|
||||
cache: {{ .cache }}
|
||||
voltages:
|
||||
- source: http
|
||||
uri: {{ include "uri" . }}
|
||||
jq: ((.multiSensor.sensors[] | select(.id==1 and .type=="voltage") | .value // 0) / 10)
|
||||
cache: {{ .cache }}
|
||||
- source: http
|
||||
uri: {{ include "uri" . }}
|
||||
jq: ((.multiSensor.sensors[] | select(.id==2 and .type=="voltage") | .value // 0) / 10)
|
||||
cache: {{ .cache }}
|
||||
- source: http
|
||||
uri: {{ include "uri" . }}
|
||||
jq: ((.multiSensor.sensors[] | select(.id==3 and .type=="voltage") | .value // 0) / 10)
|
||||
cache: {{ .cache }}
|
||||
powers:
|
||||
- source: http
|
||||
uri: {{ include "uri" . }}
|
||||
jq: (.multiSensor.sensors[] | select(.id==1 and .type=="activePower") | .value // 0)
|
||||
cache: {{ .cache }}
|
||||
- source: http
|
||||
uri: {{ include "uri" . }}
|
||||
jq: (.multiSensor.sensors[] | select(.id==2 and .type=="activePower") | .value // 0)
|
||||
cache: {{ .cache }}
|
||||
- source: http
|
||||
uri: {{ include "uri" . }}
|
||||
jq: (.multiSensor.sensors[] | select(.id==3 and .type=="activePower") | .value // 0)
|
||||
cache: {{ .cache }}
|
||||
53
templates/definition/tariff/pstryk.yaml
Normal file
53
templates/definition/tariff/pstryk.yaml
Normal file
|
|
@ -0,0 +1,53 @@
|
|||
template: pstryk
|
||||
products:
|
||||
- brand: Pstryk.pl
|
||||
requirements:
|
||||
description:
|
||||
en: "Get your API token from the Pstryk App."
|
||||
de: "Hol dir deinen API-Token aus der Pstryk App."
|
||||
evcc: ["skiptest"]
|
||||
group: price
|
||||
countries: ["PL"]
|
||||
|
||||
params:
|
||||
- name: token
|
||||
type: string
|
||||
required: true
|
||||
description:
|
||||
en: "API token (e.g. sk-...)."
|
||||
de: "API-Token (z.B. sk-...)."
|
||||
|
||||
- name: plan
|
||||
type: choice
|
||||
default: pricing
|
||||
choice: ["pricing", "prosumer-pricing"]
|
||||
required: true
|
||||
description:
|
||||
en: "Tariff source"
|
||||
de: "Tarifquelle"
|
||||
|
||||
- preset: tariff-base
|
||||
|
||||
- name: interval
|
||||
default: 1h
|
||||
advanced: true
|
||||
|
||||
render: |
|
||||
type: custom
|
||||
{{ include "tariff-base" . }}
|
||||
forecast:
|
||||
source: http
|
||||
uri: https://api.pstryk.pl/integrations/{{ .plan }}/?resolution=hour&window_start={{ `{{ now | mustDateModify "-24h" | date "2006-01-02" }}` }}&window_end={{ `{{ now | mustDateModify "+72h" | date "2006-01-02" }}` }}
|
||||
headers:
|
||||
Authorization: {{ .token }}
|
||||
Accept: application/json
|
||||
jq: |
|
||||
[(.frames // [])[]
|
||||
| select(.is_cheap != null or .is_expensive != null)
|
||||
| {
|
||||
start: (.start | sub("\\+00:00$"; "Z")),
|
||||
end: (.end | sub("\\+00:00$"; "Z")),
|
||||
value: .price_gross
|
||||
}
|
||||
] | tostring
|
||||
interval: {{ .interval }}
|
||||
Loading…
Add table
Add a link
Reference in a new issue