Skip to content

Instantly share code, notes, and snippets.

@nickknissen
Created October 10, 2022 12:25
Show Gist options
  • Save nickknissen/daa46211dacc017b553c2dd053636801 to your computer and use it in GitHub Desktop.
Save nickknissen/daa46211dacc017b553c2dd053636801 to your computer and use it in GitHub Desktop.
kvartalsel fra ewii
template:
- sensor:
- name: "Energy Total Price pr. kWh"
unit_of_measurement: "kr./kWh"
device_class: monetary
state: "{{ (float(states('sensor.current_energy_price')) + float(states('sensor.current_energy_subscription_price')) | float(0)) | round(2) }}"
sensor:
- platform: command_line
name: current_energy_price
unit_of_measurement: "kr./kWh"
command: >-
curl -s https://www.ewii.dk/api/elflow/produkter
| jq '[.Produkter[] | select(.Id=="e82b3b18-07ca-4838-909b-ddd646985fa9") .Priser[] | select(.Omraade == "VestForStorebaelt" and .Enhed =="Oere") .Beloeb ] | add | tonumber / 100'
- platform: command_line
name: current_energy_subscription_price
unit_of_measurement: "kr./kWh"
command: >-
curl -s https://www.ewii.dk/api/elflow/produkter
| jq '[.Produkter[] | select(.Id=="e82b3b18-07ca-4838-909b-ddd646985fa9") .Priser[] | select(.Omraade == "VestForStorebaelt" and .Enhed =="Kroner") .Beloeb] | add | tonumber / 730'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment