Custom component development: binary_sensor with different configs

Beginner for homeassistant, sorry if this is a noob question:

Trying to write a custom component for crow alarm system; i understand that i needed a python API for this custom component which communicates with socket connection, so i wrote one. So far so good.

I also copied and changed “envisalink” component for that purpose and i handled the zone status on binary_sensors. However, the module has some additional binary information like battery, mains power, dialler phone line etc.

So, how can i also add these binary sensors; does binary_sensor.py support 2 different device classes, or should i handle them in sensors.py (although all system sensors are binary), or is there a way to include them in alarm_control_panel.py?

I would appreciate if you can direct me to the right direction; or at least show me a sample of binary_sensors.py with 2 different classes if this is a thing.

The crow alarm api sends zone and system statuses as follows (I can change it if it is required):
Zones:

for i in range (1, maxZones+1):
    _zoneState[i] = {'status': {'open': False, 'bypass': False, 'alarm': False, 'tamper': False}, 
                     'last_fault': 0}

System status:

_systemState = {'status':{'mains': False, 'battery': False,'tamper': False, 'line': False, 'dialler': False,
                'ready': True, 'fuse': False, 'zonebattery': False, 'pendantbattery': False, 'codetamper': False}}

binary_sensor.py:

from . import (
    CONF_ZONENAME,
    CONF_ZONETYPE,
    DATA_CRW,
    SIGNAL_ZONE_UPDATE,
    ZONE_SCHEMA,
    CrowIPModuleDevice,
)

_LOGGER = logging.getLogger(__name__)

async def async_setup_platform(hass, config, async_add_entities, discovery_info=None):
    """Set up the Crow binary sensor devices."""
    configured_zones = discovery_info["zones"]

    devices = []
    for zone_num in configured_zones:
        device_config_data = ZONE_SCHEMA(configured_zones[zone_num])
        device = CrowIPModuleBinarySensor(
            hass,
            zone_num,
            device_config_data[CONF_ZONENAME],
            device_config_data[CONF_ZONETYPE],
            hass.data[DATA_CRW].zone_state[zone_num],
            hass.data[DATA_CRW],
        )
        devices.append(device)

    async_add_entities(devices)


class CrowIPModuleBinarySensor(CrowIPModuleDevice, BinarySensorDevice):
    """Representation of an Crow IP Module binary sensor."""

    def __init__(self, hass, zone_number, zone_name, zone_type, info, controller):
        """Initialize the binary_sensor."""
        self._zone_type = zone_type
        self._zone_number = zone_number

        _LOGGER.debug("Setting up zone: %s", zone_name)
        super().__init__(zone_name, info, controller)

    async def async_added_to_hass(self):
        """Register callbacks."""
        async_dispatcher_connect(self.hass, SIGNAL_ZONE_UPDATE, self._update_callback)

    @property
    def is_on(self):
        """Return true if sensor is on."""
        return self._info["status"]["open"]

    @property
    def device_class(self):
        """Return the class of this sensor, from DEVICE_CLASSES."""
        return self._zone_type

    @callback
    def _update_callback(self, zone):
        """Update the zone's state, if needed."""
        if zone is None or int(zone) == self._zone_number:
            self.async_schedule_update_ha_state()

Solved it with using 2 different Classes in binary_sensor.py; and sending CONFIG for both classes from init.py:

"""Support for Crow Alarm IP Module."""
import datetime
import logging

from homeassistant.components.binary_sensor import BinarySensorDevice
from homeassistant.core import callback
from homeassistant.helpers.dispatcher import async_dispatcher_connect
from homeassistant.util import dt as dt_util

from . import (
    CONF_ZONENAME,
    CONF_ZONETYPE,
    DATA_CRW,
    SIGNAL_ZONE_UPDATE,
    ZONE_SCHEMA,
    CrowIPModuleDevice,
    SYSTEM_SCHEMA,
    CONF_SYSTEMNAME,
    CONF_SYSTEMTYPE,
    SIGNAL_SYSTEM_UPDATE,
)

_LOGGER = logging.getLogger(__name__)

async def async_setup_platform(hass, config, async_add_entities, discovery_info=None):
    """Set up the Crow binary sensor devices."""
    configured_zones = discovery_info["zones"]
    configured_system = discovery_info["system"]

    devices = []
    for zone_num in configured_zones:
        device_config_data = ZONE_SCHEMA(configured_zones[zone_num])
        device = CrowIPModuleBinarySensor(
            hass,
            zone_num,
            device_config_data[CONF_ZONENAME],
            device_config_data[CONF_ZONETYPE],
            hass.data[DATA_CRW].zone_state[zone_num],
            hass.data[DATA_CRW],
        )
        devices.append(device)

    for system_num in configured_system:
        device_config_data = SYSTEM_SCHEMA(configured_system[system_num])
        _LOGGER.debug("Setting up system: %s", device_config_data)
        device = CrowIPModuleSystemBinarySensor(
            hass,
            system_num,
            device_config_data[CONF_SYSTEMNAME],
            CONF_SYSTEMTYPE[device_config_data[CONF_SYSTEMNAME]],
            hass.data[DATA_CRW].system_state,
            hass.data[DATA_CRW],
        )
        devices.append(device)

    async_add_entities(devices)


class CrowIPModuleBinarySensor(CrowIPModuleDevice, BinarySensorDevice):
    """Representation of an Crow IP Module binary sensor."""

    def __init__(self, hass, zone_number, zone_name, zone_type, info, controller):
        """Initialize the binary_sensor."""
        self._zone_type = zone_type
        self._zone_number = zone_number

        _LOGGER.debug("Setting up zone: %s", zone_name)
        super().__init__(zone_name, info, controller)

    async def async_added_to_hass(self):
        """Register callbacks."""
        async_dispatcher_connect(self.hass, SIGNAL_ZONE_UPDATE, self._update_callback)

    @property
    def is_on(self):
        """Return true if sensor is on."""
        return self._info["status"]["open"]

    @property
    def device_class(self):
        """Return the class of this sensor, from DEVICE_CLASSES."""
        return self._zone_type

    @callback
    def _update_callback(self, zone):
        """Update the zone's state, if needed."""
        if zone is None or int(zone) == self._zone_number:
            self.async_schedule_update_ha_state()

class CrowIPModuleSystemBinarySensor(CrowIPModuleDevice, BinarySensorDevice):
    """Representation of an Crow IP Module binary sensor."""

    def __init__(self, hass, system_number, system_name, system_type, info, controller):
        """Initialize the binary_sensor."""
        self._system_type = system_type
        self._system_name = system_name

        _LOGGER.debug("Setting up system: %s", system_name)
        super().__init__(system_name, info, controller)

    async def async_added_to_hass(self):
        """Register callbacks."""
        async_dispatcher_connect(self.hass, SIGNAL_SYSTEM_UPDATE, self._update_callback)

    @property
    def is_on(self):
        """Return true if sensor is on."""
        return self._info["status"][self._system_name]

    @property
    def device_class(self):
        """Return the class of this sensor, from DEVICE_CLASSES."""
        return self._system_type

    @callback
    def _update_callback(self, system):
        """Update the zone's state, if needed."""
        if system is None or system == self._system_name:
            self.async_schedule_update_ha_state()

The load_platform from init is this:

    if zones:
        hass.async_create_task(
            async_load_platform(
                hass, 
                "binary_sensor", 
                "crowipmodule", 
                {CONF_ZONES: zones, CONF_SYSTEM: system}, 
                config,
            )
        )