Skip to content

Commit

Permalink
Add ignore unavailable state to global settings
Browse files Browse the repository at this point in the history
  • Loading branch information
bramstroker committed Oct 29, 2022
1 parent ece4148 commit b20ffe0
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
3 changes: 2 additions & 1 deletion README.md
Expand Up @@ -156,7 +156,8 @@ All these settings are completely optional. You can skip this section if you don
| energy_integration_method | string | **Optional** | trapezoid | Integration method for the energy sensor. See [HA docs](https://www.home-assistant.io/integrations/integration/#method) |
| energy_sensor_precision | numeric | **Optional** | 4 | Number of decimals you want for the energy sensors. See [HA docs](https://www.home-assistant.io/integrations/integration/#round) |
| energy_sensor_unit_prefix | string | **Optional** | Unit prefix for the energy sensor. See [HA docs](https://www.home-assistant.io/integrations/integration/#unit_prefix). Set to `none` for to create a Wh sensor |
| create_domain_groups | list | **Optional** | | Create grouped power sensor aggregating all powercalc sensors of given domains, see [Group sensors per domain](#group-sensors-per-domain)
| create_domain_groups | list | **Optional** | | Create grouped power sensor aggregating all powercalc sensors of given domains, see [Group sensors per domain](#group-sensors-per-domain) |
| ignore_unavailable_state | boolean | **Optional** | false | Set this to `true` when you want the power sensor to display a value (0 or `standby_power`) regardless of whether the source entity is available. |

**Example:**

Expand Down
3 changes: 3 additions & 0 deletions custom_components/powercalc/__init__.py
Expand Up @@ -48,6 +48,7 @@
CONF_ENERGY_SENSOR_PRECISION,
CONF_ENERGY_SENSOR_UNIT_PREFIX,
CONF_FORCE_UPDATE_FREQUENCY,
CONF_IGNORE_UNAVAILABLE_STATE,
CONF_MANUFACTURER,
CONF_MODEL,
CONF_POWER_SENSOR_CATEGORY,
Expand Down Expand Up @@ -151,6 +152,7 @@
vol.Optional(CONF_CREATE_DOMAIN_GROUPS, default=[]): vol.All(
cv.ensure_list, [cv.string]
),
vol.Optional(CONF_IGNORE_UNAVAILABLE_STATE): cv.boolean,
}
),
)
Expand Down Expand Up @@ -179,6 +181,7 @@ async def async_setup(hass: HomeAssistant, config: dict) -> bool:
CONF_ENERGY_SENSOR_CATEGORY: DEFAULT_ENTITY_CATEGORY,
CONF_ENERGY_SENSOR_UNIT_PREFIX: UnitPrefix.KILO,
CONF_FORCE_UPDATE_FREQUENCY: DEFAULT_UPDATE_FREQUENCY,
CONF_IGNORE_UNAVAILABLE_STATE: False,
CONF_CREATE_DOMAIN_GROUPS: [],
CONF_CREATE_ENERGY_SENSORS: True,
CONF_CREATE_UTILITY_METERS: False,
Expand Down

0 comments on commit b20ffe0

Please sign in to comment.