def handle_id_request(msg):
    """Process an internal id request message."""
    node_id = msg.gateway.add_sensor()
    return (
        msg.copy(
            ack=0, sub_type=msg.gateway.const.Internal["I_ID_RESPONSE"], payload=node_id
        )
        if node_id is not None
        else None
    )