<commit_before>"""Support for deCONZ binary sensors."""
from __future__ import annotations

from collections.abc import ValuesView

from pydeconz.sensor import (
    Alarm,
    CarbonMonoxide,
    DeconzBinarySensor as PydeconzBinarySensor,
    DeconzSensor as PydeconzSensor,
    Fire,
    GenericFlag,
    OpenClose,
    Presence,
    Vibration,
    Water,
)

from homeassistant.components.binary_sensor import (
    DOMAIN,
    BinarySensorDeviceClass,
    BinarySensorEntity,
    BinarySensorEntityDescription,
)
from homeassistant.config_entries import ConfigEntry
from homeassistant.const import ATTR_TEMPERATURE
from homeassistant.core import HomeAssistant, callback
from homeassistant.helpers.dispatcher import async_dispatcher_connect
from homeassistant.helpers.entity import EntityCategory
from homeassistant.helpers.entity_platform import AddEntitiesCallback

from .const import ATTR_DARK, ATTR_ON
from .deconz_device import DeconzDevice
from .gateway import DeconzGateway, get_gateway_from_config_entry

DECONZ_BINARY_SENSORS = (
    Alarm,
    CarbonMonoxide,
    Fire,
    GenericFlag,
    OpenClose,
    Presence,
    Vibration,
    Water,
)

ATTR_ORIENTATION = "orientation"
ATTR_TILTANGLE = "tiltangle"
ATTR_VIBRATIONSTRENGTH = "vibrationstrength"

ENTITY_DESCRIPTIONS = {
    CarbonMonoxide: BinarySensorEntityDescription(
        key="carbonmonoxide",
        device_class=BinarySensorDeviceClass.GAS,
    ),
    Fire: BinarySensorEntityDescription(
        key="fire",
        device_class=BinarySensorDeviceClass.SMOKE,
    ),
    OpenClose: BinarySensorEntityDescription(
        key="openclose",
        device_class=BinarySensorDeviceClass.OPENING,<commit_msg>Change carbon monoxide device class to CO for deCONZ integration (#64185)<commit_after>"""Support for deCONZ binary sensors."""
from __future__ import annotations

from collections.abc import ValuesView

from pydeconz.sensor import (
    Alarm,
    CarbonMonoxide,
    DeconzBinarySensor as PydeconzBinarySensor,
    DeconzSensor as PydeconzSensor,
    Fire,
    GenericFlag,
    OpenClose,
    Presence,
    Vibration,
    Water,
)

from homeassistant.components.binary_sensor import (
    DOMAIN,
    BinarySensorDeviceClass,
    BinarySensorEntity,
    BinarySensorEntityDescription,
)
from homeassistant.config_entries import ConfigEntry
from homeassistant.const import ATTR_TEMPERATURE
from homeassistant.core import HomeAssistant, callback
from homeassistant.helpers.dispatcher import async_dispatcher_connect
from homeassistant.helpers.entity import EntityCategory
from homeassistant.helpers.entity_platform import AddEntitiesCallback

from .const import ATTR_DARK, ATTR_ON
from .deconz_device import DeconzDevice
from .gateway import DeconzGateway, get_gateway_from_config_entry

DECONZ_BINARY_SENSORS = (
    Alarm,
    CarbonMonoxide,
    Fire,
    GenericFlag,
    OpenClose,
    Presence,
    Vibration,
    Water,
)

ATTR_ORIENTATION = "orientation"
ATTR_TILTANGLE = "tiltangle"
ATTR_VIBRATIONSTRENGTH = "vibrationstrength"

ENTITY_DESCRIPTIONS = {
    Alarm: BinarySensorEntityDescription(
        key="alarm",
        device_class=BinarySensorDeviceClass.SAFETY,
    ),
    CarbonMonoxide: BinarySensorEntityDescription(
        key="carbonmonoxide",
        device_class=BinarySensorDeviceClass.CO,
    ),
    Fire: BinarySensorEntityDescription(
        key="fire",
        device_class=BinarySensorDeviceClass.SMOKE,
    ),
    OpenClose: BinarySensorEntityDescription(
        key="openclose",
        device_class=BinarySensorDeviceClass.OPENING,
{'fraction_non_alphanumeric': 0.06028169014084507, 'fraction_numerical': 0.0014084507042253522, 'mean_word_length': 4.53978159126365, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5904229', 'n_tokens_mistral': 1082, 'n_tokens_neox': 1079, 'n_words': 221}