How to receive JSON payload from a digital device

Your exact code would depend on how the HTTP notification is sent to your server and on the structure of the JSON, but the first building block is to listen for the incoming post request.

There are lots of WP hooks that would be suitable. One is init, e.g.:

add_action('init', function() {

     $user="the_correct_basic_auth_username";
     $password = 'the_correct_basic_auth_password';

    $has_supplied_credentials = !(empty($_SERVER['PHP_AUTH_USER']) && empty($_SERVER['PHP_AUTH_PW']));

    $is_not_authenticated = (
        !$has_supplied_credentials ||
        $_SERVER['PHP_AUTH_USER'] != $AUTH_USER ||
        $_SERVER['PHP_AUTH_PW']   != $AUTH_PASS
    );
    if ($is_not_authenticated) {
        return;
    }

    /* the rest will depend on how the data is sent and the structure of the JSON. 
    Once you have the data in the structure you want it, you can use the update_user_meta() function to add usermeta. Or, depending on what you're saving, use $wpdb or a wrapper function may suite (such as wp_insert_post()) */

});

I took the basic auth checking code from here – https://gist.github.com/rchrd2/c94eb4701da57ce9a0ad4d2b00794131