Spot electricity prices for home automation
API key is created in SähköNyt app settings (for Premium users).
Key format is snyt_xxx...
All requests to:
https://www.talotekniikkaa.fi/sahkonyt/api.php
1000 requests per day per API key.
Resets at midnight (UTC+2).
Returns current price and daily statistics.
| Parameter | Type | Description |
|---|---|---|
key required |
string | Your API key |
{
"success": true,
"current": {
"price": 5.23,
"time": "2025-12-15 19:00:00",
"valid_until": "2025-12-15 19:15:00"
},
"today": {
"stats": { "min": 1.23, "max": 15.67, "avg": 6.45 }
}
}
Find cheapest continuous period (1-8 hours). Perfect for EV charging.
| Parameter | Type | Description |
|---|---|---|
key required |
string | Your API key |
hours required |
integer | Period length in hours (1-8) |
day optional |
string | today, tomorrow or empty (both) |
{
"success": true,
"result": {
"start": "2025-12-16 02:00:00",
"end": "2025-12-16 05:00:00",
"hours": 3,
"avg_price": 2.45,
"day": "tomorrow"
}
}
Check if current price is below threshold. Also returns next cheap period.
| Parameter | Type | Description |
|---|---|---|
key required |
string | Your API key |
threshold required |
number | Price threshold c/kWh |
{
"success": true,
"result": {
"is_cheap": true,
"current_price": 3.21,
"cheap_until": "2025-12-15 20:00:00",
"next_cheap": null
}
}
Get cheapest 4 hour period for night:?hours=4&day=tomorrow
Heat when price below 5 c/kWh:?threshold=5
Get cheapest 2h period today:?hours=2&day=today
import requests
API_KEY = "snyt_xxxxxxxx..."
BASE_URL = "https://www.talotekniikkaa.fi/sahkonyt/api.php"
# Nykyinen hinta
response = requests.get(f"{BASE_URL}?key={API_KEY}")
data = response.json()
print(f"Hinta nyt: {data['current']['price']} c/kWh")
# Halvin 3 tunnin jakso
response = requests.get(f"{BASE_URL}?key={API_KEY}&hours=3")
data = response.json()
result = data['result']
print(f"Halvin jakso: {result['start']} - {result['end']}")
# Onko nyt halpa? (alle 5 c/kWh)
response = requests.get(f"{BASE_URL}?key={API_KEY}&threshold=5")
data = response.json()
if data['result']['is_cheap']:
print("✅ Nyt on halpa sähkö!")
sensor:
- platform: rest
name: "Sähkön hinta"
resource: "https://www.talotekniikkaa.fi/sahkonyt/api.php?key=API_AVAIN"
value_template: "{{ value_json.current.price }}"
unit_of_measurement: "c/kWh"
scan_interval: 900 # 15 min
json_attributes_path: "$.current"
json_attributes:
- time
- valid_until
- platform: rest
name: "Halvin 3h jakso"
resource: "https://www.talotekniikkaa.fi/sahkonyt/api.php?key=API_AVAIN&hours=3"
value_template: "{{ value_json.result.start }}"
scan_interval: 3600 # 1h
json_attributes_path: "$.result"
json_attributes:
- end
- avg_price
- day
const API_KEY = 'snyt_xxxxxxxx...';
const BASE_URL = 'https://www.talotekniikkaa.fi/sahkonyt/api.php';
async function getCurrentPrice() {
const response = await fetch(`${BASE_URL}?key=${API_KEY}`);
const data = await response.json();
console.log(`Hinta nyt: ${data.current.price} c/kWh`);
return data;
}
async function getCheapestPeriod(hours) {
const response = await fetch(`${BASE_URL}?key=${API_KEY}&hours=${hours}`);
const data = await response.json();
console.log(`Halvin ${hours}h: ${data.result.start}`);
return data.result;
}
async function isCheapNow(threshold) {
const response = await fetch(`${BASE_URL}?key=${API_KEY}&threshold=${threshold}`);
const data = await response.json();
return data.result.is_cheap;
}
# Nykyinen hinta
curl "https://www.talotekniikkaa.fi/sahkonyt/api.php?key=API_AVAIN"
# Halvin 3 tunnin jakso
curl "https://www.talotekniikkaa.fi/sahkonyt/api.php?key=API_AVAIN&hours=3"
# Onko alle 5 c/kWh?
curl "https://www.talotekniikkaa.fi/sahkonyt/api.php?key=API_AVAIN&threshold=5"
| Code | Error | Solution |
|---|---|---|
401 |
API key missing or invalid | Check your key |
403 |
API key deactivated | Contact support |
429 |
Daily limit exceeded | Wait until midnight |
500 |
Server error | Try again later |