Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -28,16 +28,16 @@ Seam provides client libraries for many languages, such as JavaScript, Python, R
* C# ([nuget](https://www.nuget.org/packages/Seam), [GitHub](https://github.com/seamapi/csharp))

{% tabs %}
{% tab title="JavaScript" %}
{% tab title="Python" %}
```bash
npm i seam
pip install seam
# For some development environments, use pip3 in this command instead of pip.
```
{% endtab %}

{% tab title="Python" %}
{% tab title="JavaScript" %}
```bash
pip install seam
# For some development environments, use pip3 in this command instead of pip.
npm i seam
```
{% endtab %}

Expand Down Expand Up @@ -196,15 +196,15 @@ After a My2N account is linked with Seam, you can retrieve devices for this My2N

{% tabs %}
{% tab title="Python" %}
\`\`\`\`python all\_locks = seam.locks.list()

some\_lock = all\_locks\[0]
```python
all_locks = seam.locks.list()

assert some\_lock.properties\["online"] is True assert some\_lock.properties\["locked"] is True
some_lock = all_locks[0]

print(some\_lock)
assert some_lock.properties["online"] is True
assert some_lock.properties["locked"] is True

```python
print(some_lock)
# Device(
# device_id='f0c074d6-34d0-4910-a16a-dfe078d5d178',
# device_type='two_n_intercom',
Expand All @@ -228,9 +228,9 @@ print(some\_lock)
# )
```

\{% endtab %\}
{% endtab %}

\{% tab title="Javascript" %\}
{% tab title="Javascript" %}

```javascript
const allLocks = await seam.locks.list()
Expand Down Expand Up @@ -267,22 +267,42 @@ console.log(someLock)
*/
```

\{% endtab %\}
{% endtab %}

\{% tab title="Ruby" %\}
{% tab title="Ruby" %}

```ruby
some_lock = seam.locks.list.first

puts some_lock.properties.online # true
puts some_lock.properties.locked # true

puts some_lock.inspect # > # warnings=[] # errors=[] # created_at=2023-05-03 18:01:16.965 UTC # } # "image_alt_text"=>"Placeholder Lock Image" # "image_url"=>"https://connect.getseam.com/assets/images/devices/unknown-lock.png", # "name"=>"Device 0", # "supported_code_lengths"=>[4, 5, 6, 7, 8], # }, # "device_name"=>"Device 0" # "device_id"=>1, # "two_n_metadata"=>{ # "serial_number"=>"ef730e77-8cc0-4290-a818-14388e9fe84f", # "manufacturer"=>"two_n", # "locked"=>true, # "online"=>true, # properties={ # device_type="two_n_intercom" # device_id="580365be-4f0f-42d9-9336-07f0bba09e28" # <Seam::Device:0x00c8bb8
puts some_lock.inspect
# <Seam::Device:0x00c8bb8
# device_id="580365be-4f0f-42d9-9336-07f0bba09e28"
# device_type="two_n_intercom"
# properties={
# "online"=>true,
# "locked"=>true,
# "manufacturer"=>"two_n",
# "serial_number"=>"ef730e77-8cc0-4290-a818-14388e9fe84f",
# "two_n_metadata"=>{
# "device_id"=>1,
# "device_name"=>"Device 0"
# },
# "supported_code_lengths"=>[4, 5, 6, 7, 8],
# "name"=>"Device 0",
# "image_url"=>"https://connect.getseam.com/assets/images/devices/unknown-lock.png",
# "image_alt_text"=>"Placeholder Lock Image"
# }
# created_at=2023-05-03 18:01:16.965 UTC
# errors=[]
# warnings=[]
```

\{% endtab %\}
{% endtab %}

\{% tab title="PHP" %\}
{% tab title="PHP" %}

```php
use Seam\SeamClient;
Expand All @@ -294,13 +314,16 @@ $locks = $seam->locks->list();
echo json_encode($locks);
```

\{% endtab %\} \{% endtabs %\}
{% endtab %}
{% endtabs %}

#### 4 — Locking & Unlocking a Door

Next, you can perform the basic action of locking and unlocking the door.

\{% openapi src="../.gitbook/assets/openapi.json" path="/locks/lock\_door" method="post" %\} [openapi.json](../.gitbook/assets/openapi.json) \{% endopenapi %\}
{% openapi src="../.gitbook/assets/openapi.json" path="/locks/lock_door" method="post" %}
[openapi.json](../.gitbook/assets/openapi.json)
{% endopenapi %}

#### Unlock a door

Expand All @@ -312,7 +335,8 @@ Next, you can perform the basic action of locking and unlocking the door.
| ---------- | ------ | ----------- |
| device\_id | String | |

\{% tabs %\} \{% tab title="Python" %\}
{% tabs %}
{% tab title="Python" %}

```python
# lock the door
Expand All @@ -326,9 +350,9 @@ updated_lock = seam.locks.get(device_id: some_lock.device_id)
assert updated_lock.properties["locked"] is False
```

\{% endtab %\}
{% endtab %}

\{% tab title="Javascript" %\}
{% tab title="Javascript" %}

```javascript
// lock the door
Expand All @@ -342,9 +366,9 @@ updatedLock = await seam.locks.get(someLock.device_id)
console.log(updatedLock.properties.locked) // false
```

\{% endtab %\}
{% endtab %}

\{% tab title="Ruby" %\}
{% tab title="Ruby" %}

```ruby
# lock the door
Expand All @@ -358,9 +382,9 @@ updated_lock = seam.locks.get(device_id: some_lock.device_id)
puts updated_lock.properties.locked # false
```

\{% endtab %\}
{% endtab %}

\{% tab title="PHP" %\}
{% tab title="PHP" %}

```php
use Seam\SeamClient;
Expand All @@ -375,15 +399,17 @@ $seam->locks->unlock_door($lock->device_id);
$seam->locks->lock_door($lock->device_id);
```

\{% endtab %\} \{% endtabs %\}
{% endtab %}
{% endtabs %}

#### 5 — Creating Access Codes on 2N Intercoms

2N devices have a directory with residents. These residents can be assigned PIN codes to unlock the door.

Seam maps these residents to [access codes](https://docs.seam.co/latest/capability-guides/smart-locks/access-codes) and allows you to create and manage them through the Seam API.

\{% tabs %\} \{% tab title="Python" %\}
{% tabs %}
{% tab title="Python" %}

```python
# create an ongoing code
Expand Down Expand Up @@ -419,9 +445,9 @@ seam.access_codes.list(device=some_lock)

```

\{% endtab %\}
{% endtab %}

\{% tab title="Javascript" %\}
{% tab title="Javascript" %}

```javascript
// create an ongoing code
Expand Down Expand Up @@ -465,9 +491,9 @@ await seam.accessCodes.list({
*/
```

\{% endtab %\}
{% endtab %}

\{% tab title="Ruby" %\}
{% tab title="Ruby" %}

```ruby
# create an ongoing code
Expand Down Expand Up @@ -515,9 +541,9 @@ seam.access_codes.list(device_id: some_lock.device_id)
# access_code_id="91a08a3d-a0bb-4ff0-bfb4-ced164353988">]
```

\{% endtab %\}
{% endtab %}

\{% tab title="PHP" %\}
{% tab title="PHP" %}

```

Expand All @@ -543,8 +569,6 @@ $seam->access_codes->create(
{% endtab %}
{% endtabs %}

###

## Next Steps

Now that you've completed this guide, you can try to connect a real 2N device. To do so, make sure to switch to a non-sandbox workspace and API key as real devices cannot be connected to sandbox workspaces.
Expand Down
81 changes: 44 additions & 37 deletions docs/brand-guides/get-started-with-controlbyweb-devices.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,16 +21,16 @@ Seam provides client libraries for many languages, such as JavaScript, Python, R
* C# ([nuget](https://www.nuget.org/packages/Seam), [GitHub](https://github.com/seamapi/csharp))

{% tabs %}
{% tab title="JavaScript" %}
{% tab title="Python" %}
```bash
npm i seam
pip install seam
# For some development environments, use pip3 in this command instead of pip.
```
{% endtab %}

{% tab title="Python" %}
{% tab title="JavaScript" %}
```bash
pip install seam
# For some development environments, use pip3 in this command instead of pip.
npm i seam
```
{% endtab %}

Expand Down Expand Up @@ -163,15 +163,15 @@ After a ControlByWeb account is linked with Seam, you can retrieve devices for t

{% tabs %}
{% tab title="Python" %}
\`\`\`\`python all\_locks = seam.locks.list()

some\_lock = all\_locks\[0]
```python
all_locks = seam.locks.list()

assert some\_lock.properties\["online"] is True assert some\_lock.properties\["locked"] is True
some_lock = all_locks[0]

print(some\_lock)
assert some_lock.properties["online"] is True
assert some_lock.properties["locked"] is True

```python
print(some_lock)
# Device(
# device_id='4a570d13-9704-46e0-b69c-9fea80d6a7aa',
# device_type='controlbyweb_device',
Expand All @@ -193,7 +193,9 @@ print(some\_lock)
# errors=[]
# )
```
{% endtab %}

{% tab title="Javascript" %}
```javascript
const allLocks = await seam.locks.list()

Expand Down Expand Up @@ -230,19 +232,38 @@ console.log(someLock)
}
*/
```
{% endtab %}



{% tab title="Ruby" %}
```ruby
some_lock = seam.locks.list.first

puts some_lock.properties.online # true
puts some_lock.properties.locked # true

puts some_lock.inspect # > # warnings=[] # errors=[] # created_at=2023-04-25 14:34:50 UTC # } # "image_alt_text"=>"Placeholder Lock Image" # "image_url"=>"https://connect.getseam.com/assets/images/devices/unknown-lock.png", # "name"=>"Device 2", # }, # "device_name"=>"Device 2" # "relay_name"=>"firstRelay", # "device_id"=>"9997", # "controlbyweb_metadata"=>{ # "manufacturer"=>"controlbyweb", # "online"=>true, # "locked"=>true, # properties={ # device_type="controlbyweb_device" # device_id="4a570d13-9704-46e0-b69c-9fea80d6a7aa" # <Seam::Device:0x00146639380
puts some_lock.inspect
# <Seam::Device:0x00146639380
# device_id="4a570d13-9704-46e0-b69c-9fea80d6a7aa"
# device_type="controlbyweb_device"
# properties={
# "locked"=>true,
# "online"=>true,
# "manufacturer"=>"controlbyweb",
# "controlbyweb_metadata"=>{
# "device_id"=>"9997",
# "relay_name"=>"firstRelay",
# "device_name"=>"Device 2"
# },
# "name"=>"Device 2",
# "image_url"=>"https://connect.getseam.com/assets/images/devices/unknown-lock.png",
# "image_alt_text"=>"Placeholder Lock Image"
# }
# created_at=2023-04-25 14:34:50 UTC
# errors=[]
# warnings=[]
```

\{% endtab %\} \{% endtabs %\}
{% endtab %}
{% endtabs %}

**4 — Triggering a ControlByWeb relay**

Expand All @@ -258,40 +279,26 @@ Next, you can perform the basic action of triggering a relay on the device. This
| ---------- | ------ | ----------- |
| device\_id | String | |

\{% tabs %\} \{% tab title="Python" %\}

{% tabs %}
{% tab title="Python" %}
```python
# trigger the relay
seam.locks.unlock_door(some_lock)
```
{% endtab %}

\{% endtab %\}

\{% tab title="Javascript" %\}

{% tab title="Javascript" %}
```javascript
// trigger the relay
await seam.locks.unlockDoor(someLock.device_id)
```
{% endtab %}

\{% endtab %\}

\{% tab title="Ruby" %\}

```

ruby
{% tab title="Ruby" %}
```ruby
# trigger the relay
seam.locks.unlock_door(device_id: some_lock.device_id)
```
{% endtab %}

{% tab title="Javascript" %}

{% endtab %}

{% tab title="Ruby" %}

{% endtab %}
{% endtabs %}

Expand Down
Loading