Multiple "Customers" One Photon?

Anyone know if it’s possible to have a photon or core claimed by multiple users at this point? Once the device is claimed can only that particular user control it, or can you add more claimants? (Is that right word? :P)

I have a few sparks running around my house for some home automation projects. I’d like to be able to add users (with my own backend) that have limited abilities within the app. I can pretty easily parse out abilities based on user type in my app… But I’m not sure how to log them into the spark cloud.

A device can only be claimed to one user account (user/password).
However, you can share the access token string between multiple devices (in a secure way) if you wish several devices to control it without sharing the username/password.

1 Like

I have similar questions. As I can see in Web build, I could add device to single (user) email account. What is the limit of devices can be added under a user (if any).

For instance, if I have 5 devices, is there a easy way (procedures) to upload code to all devices under the account ?

Will there be a FW version control in future to be used during development time (select recently build FW). I know u have recently have new SW but for production revision only.

There is no limit to the number of devices a user can claim.

Mass firmware distribution is a feature of our paid dashboard for product creators — as we work to make sure Particle grows and is successful, this is an advanced feature we worked very hard on and are very proud of. We’re confident it is easily worth the money. :smile: Try a free trial!

If you cant justify the 49$/month, an alternative is to make a batch job that calls the API and flashes each device, not as pretty, but in early test phase with a few tens of devices...

curl -X PUT -F file=@firmware.bin -F file_type=binary https://api.particle.io/v1/devices/ID?access_token=TOKEN

PHP script to flash multiple devices

<?
define('TOKEN', 'YourAccessTokenHere');

if (isset($_POST["flash"]))
{
    $filename = $_FILES["firmware"]["tmp_name"];

    move_uploaded_file($filename, "firmware.bin");
    $filename = "firmware.bin";

    foreach ($_POST["target"] as $device)
    {
            $data = array("file_type" => "binary", "file"=>"@".$filename);
            $ch = curl_init("https://api.particle.io/v1/devices/".$device."?access_token=".TOKEN);

            curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
            curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "PUT");
            curl_setopt($ch, CURLOPT_POSTFIELDS,$data);

            $response = curl_exec($ch);
        $status[$device] = $response;
            if(!$response) {
                return false;
            }
    }
}

$res = file_get_contents('https://api.particle.io/v1/devices?access_token='.TOKEN);
$devices = json_decode($res);

echo "
<form method='post' enctype='multipart/form-data'>
<table border=1><thead><tr><th>Select</th><th>ID</th><th>Name</th><th>Last IP</th><th>Last connected</th><th>Connected</th><th>Status</th></tr></thead>";

$default = array();

foreach ($devices as $device)
{
    echo "<tr>
        <td><input type='checkbox' value='".$device->id."' name='target[]' ".(in_array($device->id, $default)?' checked ':'')."></td>
        <td>".$device->id."</td>
                <td>".$device->name."</td>
                <td>".$device->last_ip_address."</td>
                <td>".$device->last_heard."</td>
                <td>".(($device->connected==1)?'Yes':'')."</td>
        <td>".$status[$device->id]."</td>
         </tr>";
}
echo "</table><br>
<input type='file' name='firmware'><input type='submit' value='Flash now' name='flash'>
</form>";
2 Likes

Is this still the best way to allow multiple people to develop on the same photon without sharing credentials or transferring ownership back and fourth?