Getting the wrong featured image on archive page

The default WP_Query object on the blog homepage is the feed of blog posts rather than the page itself, so you’ll need to grab the post ID manually and pass it to get_post_thumbnail_id():

function lwb_image_shortcode( $atts ) {
    

    // Attribute für den Shortcode festlegen
    $atts = shortcode_atts(
        array(
            'type'      => 'featured',  // Welches Bild, Standard = Haupt Beitragsbild
            'return'    => 'full',      // Rückgabewert - Full = HTML Image Element | URL = Bild URL
            'size'      => 'medium',    // WordPress Bildgrössen Name  
        ),
        $atts, 'lwb_image'
    );  
    if( is_home() ) {
        $id = get_post_thumbnail_id( (int) get_option( 'page_for_posts' ) );
    }
    else {
        $id = get_post_thumbnail_id();
    }
    if( $atts['return'] == 'full' ) {
        $image = wp_get_attachment_image( $id, $atts['size'], '', '' );
        
    } elseif( $atts['return'] == 'url' ) {
        $image = wp_get_attachment_image_url( $id, $atts['size'], '', '' );
        
    }
    
    return $image;
}
add_shortcode('lwb_image', 'lwb_image_shortcode');