Skip to content

Commit

Permalink
Added low carbon + biomass entity
Browse files Browse the repository at this point in the history
  • Loading branch information
JRascagneres committed Nov 7, 2023
1 parent f91db27 commit 0b48f6a
Show file tree
Hide file tree
Showing 5 changed files with 22 additions and 1 deletion.
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,7 @@ Then follow the same steps that are using to setup most integrations:
National Grid Grid Generation Fossil Fuel Percentage | sensor.national_grid_fossil_fuel_percentage_generation | Percentage of total grid generation that is generated from fossil fuel sources: Gas, Oil & Coal
National Grid Grid Generation Renewable Percentage | sensor.national_grid_renewable_percentage_generation | Percentage of total grid generation that is generated from renewable sources: Solar, Wind & Hydro
National Grid Grid Generation Low Carbon Percentage | sensor.national_grid_low_carbon_percentage_generation | Percentage of total grid generation that is generated from renewable & low carbon sources: Solar, Wind, Hydro & Nuclear
National Grid Grid Generation Low Carbon With Biomass Percentage | sensor.low_carbon_with_biomass_percentage_generation | Percentage of total grid generation that is generated from renewable & low carbon sources including Biomass (which is contentious): Solar, Wind, Hydro, Nuclear & Biomass
National Grid Grid Generation Other Percentage | sensor.national_grid_other_percentage_generation | Percentage of total grid generation that is generated from 'other' sources: Nuclear, Biomass & Unknown / Other


Expand Down Expand Up @@ -107,6 +108,7 @@ total_generation_mwh
fossil_fuel_percentage_generation
renewable_percentage_generation
low_carbon_percentage_generation
low_carbon_with_biomass_percentage_generation
other_percentage_generation
grid_collection_time
```
Expand Down
11 changes: 11 additions & 0 deletions custom_components/national_grid/coordinators/national_grid.py
Original file line number Diff line number Diff line change
Expand Up @@ -565,6 +565,17 @@ def get_generation_combined(api_key: str, now_utc_full: datetime, today_utc: str
grid_generation["total_generation_mwh"],
)

grid_generation["low_carbon_with_biomass_percentage_generation"] = percentage_calc(
(
grid_generation["solar_mwh"]
+ grid_generation["wind_mwh"]
+ grid_generation["hydro_mwh"]
+ grid_generation["nuclear_mwh"]
+ grid_generation["biomass_mwh"]
),
grid_generation["total_generation_mwh"],
)

grid_generation["other_percentage_generation"] = percentage_calc(
(
grid_generation["nuclear_mwh"]
Expand Down
2 changes: 1 addition & 1 deletion custom_components/national_grid/manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,6 @@
"dependencies": [],
"iot_class": "cloud_polling",
"requirements": [],
"version": "0.0.28",
"version": "0.0.29",
"config_flow": true
}
1 change: 1 addition & 0 deletions custom_components/national_grid/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ class NationalGridGeneration(TypedDict):
fossil_fuel_percentage_generation: int # Counts gas, oil, coal
renewable_percentage_generation: int # Counts solar, wind, hydro
low_carbon_percentage_generation: int # Counts renewable, nuclear
low_carbon_with_biomass_percentage_generation: int # Counts renewable, nuclear, biomass
other_percentage_generation: int # Counts nuclear, biomass
grid_collection_time: datetime

Expand Down
7 changes: 7 additions & 0 deletions custom_components/national_grid/sensor.py
Original file line number Diff line number Diff line change
Expand Up @@ -305,6 +305,13 @@ class NationalGridSensorEntityDescription(SensorEntityDescription):
native_unit_of_measurement="%",
icon="mdi:leaf",
),
NationalGridSensorEntityDescription(
key="grid_generation.low_carbon_with_biomass_percentage_generation",
name="Grid Generation Low Carbon With Biomass Percentage",
unique_id="low_carbon_with_biomass_percentage_generation",
native_unit_of_measurement="%",
icon="mdi:leaf",
),
NationalGridSensorEntityDescription(
key="grid_generation.other_percentage_generation",
name="Grid Generation Other Percentage",
Expand Down

0 comments on commit 0b48f6a

Please sign in to comment.