mirror of
https://github.com/home-assistant/home-assistant.io.git
synced 2025-07-22 00:36:49 +00:00
Add Energyzero get_gas_prices and get_energy_price services (#29143)
* Update energyzero.markdown * Update energyzero.markdown * Added required parameter * Align wording with easyEnergy * Set incl vat as required --------- Co-authored-by: c0ffeeca7 <k0ffeeka7@gmail.com>
This commit is contained in:
parent
2f704f9f67
commit
cd1d347eb2
@ -52,3 +52,100 @@ Every day around **14:00 UTC time**, the new prices are published for the follow
|
||||
For the dynamic gas prices, only entities are created that display the
|
||||
`current` and `next hour` price because the price is always fixed for
|
||||
24 hours; new prices are published every morning at **05:00 UTC time**.
|
||||
|
||||
## Services
|
||||
|
||||
The energy and gas prices are exposed using [service calls](/docs/scripts/service-calls/). The services populate [Response Data](/docs/scripts/service-calls#use-templates-to-handle-response-data) with price data.
|
||||
|
||||
### Service `energyzero.get_gas_prices`
|
||||
|
||||
Fetches the gas prices.
|
||||
|
||||
| Service data attribute | Optional | Description | Example |
|
||||
| ---------------------- | -------- | ----------- | --------|
|
||||
| `incl_vat` | no | Defines whether the prices include or exclude VAT. | false
|
||||
| `start` | yes | Start time to get prices. Defaults to today 00:00:00 | 2023-01-01 00:00:00
|
||||
| `end` | yes | End time to get prices. Defaults to today 00:00:00 | 2023-01-01 00:00:00
|
||||
|
||||
### Response data
|
||||
|
||||
The response data is a dictionary with the gas timestamps and prices as string and float values.
|
||||
|
||||
{% raw %}
|
||||
|
||||
```json
|
||||
{
|
||||
"prices": [
|
||||
{
|
||||
"timestamp": "2023-09-25 03:00:00+00:00",
|
||||
"price": 1.1
|
||||
},
|
||||
{
|
||||
"timestamp": "2023-09-25 04:00:00+00:00",
|
||||
"price": 1.05
|
||||
}
|
||||
]
|
||||
}
|
||||
|
||||
```
|
||||
|
||||
{% endraw %}
|
||||
|
||||
### Service `energyzero.get_energy_prices`
|
||||
|
||||
Fetches the energy prices.
|
||||
|
||||
| Service data attribute | Optional | Description | Example |
|
||||
| ---------------------- | -------- | ----------- | --------|
|
||||
| `incl_vat` | no | Defines whether the prices include or exclude VAT. | false
|
||||
| `start` | yes | Start time to get prices. Defaults to today 00:00:00 | 2023-01-01 00:00:00
|
||||
| `end` | yes | End time to get prices. Defaults to today 00:00:00 | 2023-01-01 00:00:00
|
||||
|
||||
### Response data
|
||||
|
||||
The response data is a dictionary with the energy timestamps and prices as string and float values.
|
||||
|
||||
{% raw %}
|
||||
|
||||
```json
|
||||
{
|
||||
"prices": [
|
||||
{
|
||||
"timestamp": "2023-09-25 03:00:00+00:00",
|
||||
"price": 0.05
|
||||
},
|
||||
{
|
||||
"timestamp": "2023-09-25 04:00:00+00:00",
|
||||
"price": 0.12
|
||||
}
|
||||
]
|
||||
}
|
||||
```
|
||||
|
||||
{% endraw %}
|
||||
|
||||
### Add response to sensor
|
||||
|
||||
The response data can be added to a template sensor:
|
||||
|
||||
{% raw %}
|
||||
|
||||
```yaml
|
||||
template:
|
||||
- trigger:
|
||||
- platform: time_pattern
|
||||
hours: "*"
|
||||
action:
|
||||
- service: energyzero.get_energy_prices
|
||||
response_variable: prices
|
||||
data:
|
||||
incl_vat: false
|
||||
sensor:
|
||||
- name: Energy prices
|
||||
device_class: timestamp
|
||||
state: "{{ now() }}"
|
||||
attributes:
|
||||
prices: '{{ prices }}'
|
||||
```
|
||||
|
||||
{% endraw %}
|
||||
|
Loading…
x
Reference in New Issue
Block a user