Skip to content

Instantly share code, notes, and snippets.

@pkolbus
Created January 1, 2024 04:18
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save pkolbus/f81a0ae604dbf64fdaafe5be38c7eeb0 to your computer and use it in GitHub Desktop.
Save pkolbus/f81a0ae604dbf64fdaafe5be38c7eeb0 to your computer and use it in GitHub Desktop.
HomeAssistant energy price sensor for DTE D1.2 rate plan
{
[
{
"version": 1,
"domain": "workday",
"title": "DTE Peak Days",
"data": {},
"options": {
"name": "DTE Peak Days",
"country": "US",
"excludes": [
"sat",
"sun",
"holiday"
],
"days_offset": 0.0,
"workdays": [
"mon",
"tue",
"wed",
"thu",
"fri"
],
"add_holidays": [],
"remove_holidays": [],
"language": null
},
"pref_disable_new_entities": false,
"pref_disable_polling": false,
"source": "user",
"unique_id": null,
"disabled_by": null
},
{
"version": 1,
"domain": "tod",
"title": "DTE Peak Hours D1.2",
"data": {},
"options": {
"name": "DTE Peak Hours D1.2",
"after_time": "11:00:00",
"before_time": "19:00:00"
},
"pref_disable_new_entities": false,
"pref_disable_polling": false,
"source": "user",
"unique_id": null,
"disabled_by": null
},
{
"version": 1,
"domain": "template",
"title": "DTE D1.2 Rate",
"data": {},
"options": {
"template_type": "sensor",
"name": "DTE D1.2 Rate",
"state": "{% set peak_hr = is_state('binary_sensor.dte_peak_hours_d1_2', 'on') %}\n{% set peak_dy = is_state('binary_sensor.dte_peak_days', 'on') %}\n{% set dist = 8.137 %}\n{% if 6 <= now().month <= 10 %}\n{% if peak_hr and peak_dy %} {{ (1.690 + 13.949 + dist) / 100 }}\n{% else %} {{ (0.569 + 4.696 + dist) / 100 }}\n{% endif %}\n{% else %}\n{% if peak_hr and peak_dy %} {{ (1.427 + 11.783 + dist) / 100 }}\n{% else %} {{ (0.547 + 4.512 + dist) / 100 }}\n{% endif %}\n{% endif %}",
"unit_of_measurement": "USD/kWh"
},
"pref_disable_new_entities": false,
"pref_disable_polling": false,
"source": "user",
"unique_id": null,
"disabled_by": null
},
{
"version": 1,
"domain": "template",
"title": "DTE D1.2 Outflow Rate",
"data": {},
"options": {
"template_type": "sensor",
"name": "DTE D1.2 Outflow Rate",
"state": "{% set peak_hr = is_state('binary_sensor.dte_peak_hours_d1_2', 'on') %}\n{% set peak_dy = is_state('binary_sensor.dte_peak_days', 'on') %}\n{% if 6 <= now().month <= 10 %}\n{% if peak_hr and peak_dy %} {{ (1.690 + 13.949) / 100 }}\n{% else %} {{ (0.569 + 4.696) / 100 }}\n{% endif %}\n{% else %}\n{% if peak_hr and peak_dy %} {{ (1.427 + 11.783) / 100 }}\n{% else %} {{ (0.547 + 4.512) / 100 }}\n{% endif %}\n{% endif %}",
"unit_of_measurement": "USD/kWh"
},
"pref_disable_new_entities": false,
"pref_disable_polling": false,
"source": "user",
"unique_id": null,
"disabled_by": null
}
]
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment