mirror of
https://github.com/sascha-hemi/pycom-documentation.git
synced 2026-03-21 10:05:56 +01:00
Merge pull request #212 from pycom/pb-833-documentation-of-pybytes-library-api
Pb 833 documentation of pybytes library api -publish
This commit is contained in:
227
config.toml
227
config.toml
@@ -1166,12 +1166,201 @@ theme = "doc-theme"
|
||||
parent = "pybytes"
|
||||
weight = 10
|
||||
|
||||
[[menu.main]]
|
||||
name = "Pybytes library API"
|
||||
url = "/pybytes/api/"
|
||||
identifier= "pybytes@api"
|
||||
parent= "pybytes"
|
||||
weight = 20
|
||||
|
||||
[[menu.main]]
|
||||
name = "Activate Device"
|
||||
url = "/pybytes/api/activate/"
|
||||
identifier = "pybytes@api@activate"
|
||||
parent = "pybytes@api"
|
||||
weight = 11
|
||||
|
||||
[[menu.main]]
|
||||
name = "Connect"
|
||||
url = "/pybytes/api/connect_device/"
|
||||
identifier = "pybytes@api@connect_device"
|
||||
parent = "pybytes@api"
|
||||
weight = 12
|
||||
|
||||
[[menu.main]]
|
||||
name = "Connect LTE"
|
||||
url = "/pybytes/api/connect_lte/"
|
||||
identifier = "pybytes@api@connect_lte"
|
||||
parent = "pybytes@api"
|
||||
weight = 13
|
||||
|
||||
[[menu.main]]
|
||||
name = "Connect loRa ABP"
|
||||
url = "/pybytes/api/connect_lora_abp/"
|
||||
identifier = "pybytes@api@connect_lora_abp"
|
||||
parent = "pybytes@api"
|
||||
weight = 14
|
||||
|
||||
[[menu.main]]
|
||||
name = "Connect loRa OTAA"
|
||||
url = "/pybytes/api/connect_lora_otaa/"
|
||||
identifier = "pybytes@api@connect_lora_otaa"
|
||||
parent = "pybytes@api"
|
||||
weight = 15
|
||||
|
||||
[[menu.main]]
|
||||
name = "Connect Sigfox"
|
||||
url = "/pybytes/api/connect_sigfox/"
|
||||
identifier = "pybytes@api@connect_sigfox"
|
||||
parent = "pybytes@api"
|
||||
weight = 16
|
||||
|
||||
[[menu.main]]
|
||||
name = "Connect Wifi"
|
||||
url = "/pybytes/api/connect_wifi/"
|
||||
identifier = "pybytes@api@connect_wifi"
|
||||
parent = "pybytes@api"
|
||||
weight = 17
|
||||
|
||||
[[menu.main]]
|
||||
name = "Deepsleep"
|
||||
url = "/pybytes/api/deepsleep/"
|
||||
identifier = "pybytes@api@deepsleep"
|
||||
parent = "pybytes@api"
|
||||
weight = 19
|
||||
|
||||
[[menu.main]]
|
||||
name = "Disconnect"
|
||||
url = "/pybytes/api/disconnect/"
|
||||
identifier = "pybytes@api@disconnect"
|
||||
parent = "pybytes@api"
|
||||
weight = 20
|
||||
|
||||
[[menu.main]]
|
||||
name = "Dump CA"
|
||||
url = "/pybytes/api/dump_ca/"
|
||||
identifier = "pybytes@api@dump_ca"
|
||||
parent = "pybytes@api"
|
||||
weight = 22
|
||||
|
||||
[[menu.main]]
|
||||
name = "Enable LTE"
|
||||
url = "/pybytes/api/enable_lte/"
|
||||
identifier = "pybytes@api@enable_lte"
|
||||
parent = "pybytes@api"
|
||||
weight = 23
|
||||
|
||||
[[menu.main]]
|
||||
name = "Enable SSL"
|
||||
url = "/pybytes/api/enable_ssl/"
|
||||
identifier = "pybytes@api@enable_ssl"
|
||||
parent = "pybytes@api"
|
||||
weight = 24
|
||||
|
||||
[[menu.main]]
|
||||
name = "Enable terminal"
|
||||
url = "/pybytes/api/enable_terminal/"
|
||||
identifier = "pybytes@api@enable_terminal"
|
||||
parent = "pybytes@api"
|
||||
weight = 25
|
||||
|
||||
[[menu.main]]
|
||||
name = "Export configuration"
|
||||
url = "/pybytes/api/export_config/"
|
||||
identifier = "pybytes@api@export_config"
|
||||
parent = "pybytes@api"
|
||||
weight = 26
|
||||
|
||||
[[menu.main]]
|
||||
name = "Get configuration"
|
||||
url = "/pybytes/api/get_config/"
|
||||
identifier = "pybytes@api@get_config"
|
||||
parent = "pybytes@api"
|
||||
weight = 27
|
||||
|
||||
[[menu.main]]
|
||||
name = "Is connected"
|
||||
url = "/pybytes/api/is_connected/"
|
||||
identifier = "pybytes@api@is_connected"
|
||||
parent = "pybytes@api"
|
||||
weight = 28
|
||||
|
||||
[[menu.main]]
|
||||
name = "Print configuration"
|
||||
url = "/pybytes/api/print_config/"
|
||||
identifier = "pybytes@api@print_config"
|
||||
parent = "pybytes@api"
|
||||
weight = 29
|
||||
|
||||
[[menu.main]]
|
||||
name = "Read configuration"
|
||||
url = "/pybytes/api/read_config/"
|
||||
identifier = "pybytes@api@read_config"
|
||||
parent = "pybytes@api"
|
||||
weight = 30
|
||||
|
||||
[[menu.main]]
|
||||
name = "Reconnect"
|
||||
url = "/pybytes/api/reconnect/"
|
||||
identifier = "pybytes@api@reconnect"
|
||||
parent = "pybytes@api"
|
||||
weight = 31
|
||||
|
||||
[[menu.main]]
|
||||
name = "Send info message"
|
||||
url = "/pybytes/api/send_info_message/"
|
||||
identifier = "pybytes@api@send_info_message"
|
||||
parent = "pybytes@api"
|
||||
weight = 32
|
||||
|
||||
[[menu.main]]
|
||||
name = "Send ping message"
|
||||
url = "/pybytes/api/send_ping_message/"
|
||||
identifier = "pybytes@api@send_ping_message"
|
||||
parent = "pybytes@api"
|
||||
weight = 33
|
||||
|
||||
[[menu.main]]
|
||||
name = "Send signal"
|
||||
url = "/pybytes/api/send_signal/"
|
||||
identifier = "pybytes@api@send_signal"
|
||||
parent = "pybytes@api"
|
||||
weight = 34
|
||||
|
||||
[[menu.main]]
|
||||
name = "Set configuration"
|
||||
url = "/pybytes/api/set_config/"
|
||||
identifier = "pybytes@api@set_config"
|
||||
parent = "pybytes@api"
|
||||
weight = 35
|
||||
|
||||
[[menu.main]]
|
||||
name = "Start"
|
||||
url = "/pybytes/api/start/"
|
||||
identifier = "pybytes@api@start"
|
||||
parent = "pybytes@api"
|
||||
weight = 36
|
||||
|
||||
[[menu.main]]
|
||||
name = "Update configuration"
|
||||
url = "/pybytes/api/update_config/"
|
||||
identifier = "pybytes@api@update_config"
|
||||
parent = "pybytes@api"
|
||||
weight = 37
|
||||
|
||||
[[menu.main]]
|
||||
name = "Write configuration"
|
||||
url = "/pybytes/api/write_config/"
|
||||
identifier = "pybytes@api@write_config"
|
||||
parent = "pybytes@api"
|
||||
weight = 38
|
||||
|
||||
[[menu.main]]
|
||||
name = "Add a device to Pybytes"
|
||||
url = "/pybytes/connect/"
|
||||
identifier = "pybytes@connect"
|
||||
parent = "pybytes"
|
||||
weight = 20
|
||||
weight = 30
|
||||
|
||||
[[menu.main]]
|
||||
name = "Provisioning via USB"
|
||||
@@ -1180,26 +1369,40 @@ theme = "doc-theme"
|
||||
parent = "pybytes@connect"
|
||||
weight = 10
|
||||
|
||||
[[menu.main]]
|
||||
name = "Sigfox"
|
||||
url = "/pybytes/sigfox/"
|
||||
identifier = "pybytes@sigfox"
|
||||
parent = "pybytes"
|
||||
weight = 40
|
||||
|
||||
[[menu.main]]
|
||||
name = "DevKit contract"
|
||||
url = "/pybytes/sigfox/devkit/"
|
||||
identifier = "pybytes@sigfox@devkit"
|
||||
parent = "pybytes@sigfox"
|
||||
weight = 10
|
||||
|
||||
[[menu.main]]
|
||||
name = "Custom contract"
|
||||
url = "/pybytes/sigfox/custom/"
|
||||
identifier = "pybytes@sigfox@custom"
|
||||
parent = "pybytes@sigfox"
|
||||
weight = 20
|
||||
|
||||
[[menu.main]]
|
||||
name = "Project Releases"
|
||||
url = "/pybytes/releases/"
|
||||
identifier = "pybytes@releases"
|
||||
parent = "pybytes"
|
||||
weight = 20
|
||||
|
||||
[[menu.main]]
|
||||
name = "Pybytes iOS"
|
||||
url = "/pybytes/smart/"
|
||||
identifier = "pybytes@smart"
|
||||
parent = "pybytes"
|
||||
weight = 20
|
||||
weight = 50
|
||||
|
||||
[[menu.main]]
|
||||
name = "Create new release"
|
||||
url = "/pybytes/releases/new/"
|
||||
identifier = "pybytes@releases@new"
|
||||
parent = "pybytes@releases"
|
||||
weight = 20
|
||||
weight = 10
|
||||
|
||||
[[menu.main]]
|
||||
name = "Deploy release"
|
||||
@@ -1255,14 +1458,14 @@ theme = "doc-theme"
|
||||
url = "/pybytes/dashboard/"
|
||||
identifier = "pybytes@dashboard"
|
||||
parent = "pybytes"
|
||||
weight = 30
|
||||
weight = 70
|
||||
|
||||
[[menu.main]]
|
||||
name = "Integrations"
|
||||
url = "/pybytes/integrations/"
|
||||
identifier = "pybytes@integrations"
|
||||
parent = "pybytes"
|
||||
weight = 40
|
||||
weight = 80
|
||||
|
||||
[[menu.main]]
|
||||
name = "Amazon IoT"
|
||||
|
||||
79
content/pybytes/api/_index.md
Normal file
79
content/pybytes/api/_index.md
Normal file
@@ -0,0 +1,79 @@
|
||||
---
|
||||
title: "Pybytes library API"
|
||||
aliases:
|
||||
---
|
||||
|
||||
To test the Pybytes library API, connect your device to Pymakr and call the methods listed below.
|
||||
You can use the Pybytes library API in your MicroPython project.
|
||||
|
||||
|
||||
### Debugging
|
||||
Enable debugging if you are having any issues.
|
||||
There are multiple debug levels, the lowest is 0 which is for warnings only and 99 is the highest used and will print more debugging messages
|
||||
|
||||
#### use:
|
||||
|
||||
```
|
||||
>> import pycom;
|
||||
>> pycom.nvs_set('pybytes_debug', debugLevel)
|
||||
```
|
||||
|
||||
#### e.g.
|
||||
```
|
||||
>> import pycom;
|
||||
>> pycom.nvs_set('pybytes_debug', 99)
|
||||
```
|
||||
|
||||
|
||||
# API List
|
||||
|
||||
|
||||
* [Activate](activate)
|
||||
|
||||
* [Connect](connect)
|
||||
|
||||
* [Connect LTE](connect_lte)
|
||||
|
||||
* [Connect LoRa ABP](connect_lora_abp)
|
||||
|
||||
* [Connect LoRa OTAA](connect_lora_otaa)
|
||||
|
||||
* [Connect Sigfox](connect_sigfox)
|
||||
|
||||
* [Connect Wifi](connect_wifi)
|
||||
|
||||
* [Deepsleep](deepsleep)
|
||||
|
||||
* [Disconnect](disconnect)
|
||||
|
||||
* [Dump CA](dump_ca)
|
||||
|
||||
* [Enable LTE](enable_lte)
|
||||
|
||||
* [Enable SSL](enable_ssl)
|
||||
|
||||
* [Enable terminal](enable_terminal)
|
||||
|
||||
* [Export configuration](export_config)
|
||||
|
||||
* [Get configuration](get_config)
|
||||
|
||||
* [Is connected](is_connected)
|
||||
|
||||
* [Print configuration](print_config)
|
||||
|
||||
* [Read configuration](read_config)
|
||||
|
||||
* [Reconnect](reconnect)
|
||||
|
||||
* [Send info message](send_info_message)
|
||||
|
||||
* [Send ping message](send_ping_message)
|
||||
|
||||
* [Send signal](send_signal)
|
||||
|
||||
* [Set configuration](set_config)
|
||||
|
||||
* [Start](start)
|
||||
|
||||
* [Update configuration](update_config)
|
||||
39
content/pybytes/api/activate.md
Normal file
39
content/pybytes/api/activate.md
Normal file
@@ -0,0 +1,39 @@
|
||||
---
|
||||
title: "Activate Device"
|
||||
aliases:
|
||||
- pybytes/api/activate.html
|
||||
- pybytes/api/activate.md
|
||||
---
|
||||
|
||||
Activate device on Pybytes, via Pymakr plugin.
|
||||
|
||||
**Method**
|
||||
----
|
||||
**pybytes.activate(activation_string)**
|
||||
|
||||
|
||||
**Parameters**
|
||||
----
|
||||
| name | Description | is Required | Default value
|
||||
| ------------- |:-------------:|:-------------:|:-------------:|
|
||||
| activation string | Generated by Pybytes | Yes | - |
|
||||
|
||||
|
||||
**Example**
|
||||
----
|
||||
`pybytes.activate("eyJhIjoiNTYzM...")`
|
||||
|
||||
|
||||
**Success Response**
|
||||
----
|
||||
|
||||
```
|
||||
>> Please wait while we try to connect to Pycom
|
||||
>> Wifi connection established... activating device!
|
||||
>> WMAC: 807D3AC325E8
|
||||
>> Firmware: 1.20.1.r2
|
||||
>> Pybytes: 1.3.0
|
||||
>> Initialized watchdog for WiFi and LTE connection with timeout 1260000 ms
|
||||
>> WiFi connection established
|
||||
>> Pybytes connected successfully (using the built-in pybytes library)
|
||||
```
|
||||
36
content/pybytes/api/connect_device.md
Normal file
36
content/pybytes/api/connect_device.md
Normal file
@@ -0,0 +1,36 @@
|
||||
---
|
||||
title: "Connect Device"
|
||||
aliases:
|
||||
- pybytes/api/connect
|
||||
---
|
||||
|
||||
Initialize connection based on the configured parameters.
|
||||
|
||||
**Method**
|
||||
----
|
||||
**pybytes.connect()**
|
||||
|
||||
**Example**
|
||||
----
|
||||
`pybytes.connect()`
|
||||
|
||||
**Success Response**
|
||||
----
|
||||
|
||||
WiFi:
|
||||
```
|
||||
>> Connecting with SSID and PASSWORD
|
||||
>> WiFi connection established
|
||||
```
|
||||
|
||||
LTE:
|
||||
```
|
||||
>> LTE connection established
|
||||
```
|
||||
|
||||
LoRa ABP:
|
||||
```
|
||||
>> Trying to join LoRa.ABP for 15000 seconds...
|
||||
>> Setting up LoRa socket...
|
||||
>> Connected using LoRa
|
||||
```
|
||||
31
content/pybytes/api/connect_lora_abp.md
Normal file
31
content/pybytes/api/connect_lora_abp.md
Normal file
@@ -0,0 +1,31 @@
|
||||
---
|
||||
title: "Connect LoRa ABP"
|
||||
aliases:
|
||||
- pybytes/api/connect_lora_abp
|
||||
---
|
||||
|
||||
Initialize LoRa ABP connection.
|
||||
|
||||
**Method**
|
||||
----
|
||||
**pybytes.connect_lora_abp(timeout, nanogateway)**
|
||||
|
||||
**Parameters**
|
||||
----
|
||||
| name | Description | is Required | Default value
|
||||
| ------------- |:-------------:|:-------------:|:-------------:|
|
||||
| timeout | Connection timeout | Yes | - |
|
||||
| nanogateway | Enable nanogateway | Yes | - |
|
||||
|
||||
**Example**
|
||||
----
|
||||
`pybytes.connect_lora_abp(15000, false)`
|
||||
|
||||
**Success Response**
|
||||
----
|
||||
|
||||
```
|
||||
>> Trying to join LoRa.ABP for 15000 seconds...
|
||||
>> Setting up LoRa socket...
|
||||
>> Connected using LoRa
|
||||
```
|
||||
31
content/pybytes/api/connect_lora_otaa.md
Normal file
31
content/pybytes/api/connect_lora_otaa.md
Normal file
@@ -0,0 +1,31 @@
|
||||
---
|
||||
title: "Connect LoRa OTAA"
|
||||
aliases:
|
||||
- pybytes/api/connect_lora_otaa
|
||||
---
|
||||
|
||||
Initialize LoRa OTAA connection.
|
||||
|
||||
**Method**
|
||||
----
|
||||
**pybytes.connect_lora_otaa(timeout, nanogateway)**
|
||||
|
||||
**Parameters**
|
||||
----
|
||||
| name | Description | is Required | Default value
|
||||
| ------------- |:-------------:|:-------------:|:-------------:|
|
||||
| timeout | Connection timeout | Yes | - |
|
||||
| nanogateway | Enable nanogateway | Yes | - |
|
||||
|
||||
**Example**
|
||||
----
|
||||
`pybytes.connect_lora_otaa(timeout=15, nanogateway=False)`
|
||||
|
||||
**Success Response**
|
||||
----
|
||||
|
||||
```
|
||||
>> Trying to join LoRa.OTAA for 15 seconds...
|
||||
>> Setting up LoRa socket...
|
||||
>> Connected using LoRa
|
||||
```
|
||||
29
content/pybytes/api/connect_lte.md
Normal file
29
content/pybytes/api/connect_lte.md
Normal file
@@ -0,0 +1,29 @@
|
||||
---
|
||||
title: "Connect LTE"
|
||||
aliases:
|
||||
- pybytes/api/connect_lte
|
||||
---
|
||||
|
||||
Initialize watchdog for WiFi and LTE connection.
|
||||
|
||||
**Method**
|
||||
----
|
||||
**pybytes.connect_lte(reconnect=True, check_interval=0.5)**
|
||||
|
||||
**Parameters**
|
||||
----
|
||||
| name | Description | is Required | Default value
|
||||
| ------------- |:-------------:|:-------------:|:-------------:|
|
||||
| reconnect | Boolean | Yes | - |
|
||||
| check_interval | interval in seconds | Yes | - |
|
||||
|
||||
**Example**
|
||||
----
|
||||
`pybytes.connect_lte(reconnect=True, check_interval=0.5)`
|
||||
|
||||
**Success Response**
|
||||
----
|
||||
|
||||
```
|
||||
>> LTE connection established
|
||||
```
|
||||
22
content/pybytes/api/connect_sigfox.md
Normal file
22
content/pybytes/api/connect_sigfox.md
Normal file
@@ -0,0 +1,22 @@
|
||||
---
|
||||
title: "Connect Sigfox"
|
||||
aliases:
|
||||
- pybytes/api/connect_sigfox
|
||||
---
|
||||
|
||||
Initialize Sigfox connection.
|
||||
|
||||
**Method**
|
||||
----
|
||||
**pybytes.connect_sigfox()**
|
||||
|
||||
**Example**
|
||||
----
|
||||
`pybytes.connect_sigfox()`
|
||||
|
||||
**Success Response**
|
||||
----
|
||||
|
||||
```
|
||||
>> Connected using Sigfox. Only upload stream is supported
|
||||
```
|
||||
19
content/pybytes/api/connect_wifi.md
Normal file
19
content/pybytes/api/connect_wifi.md
Normal file
@@ -0,0 +1,19 @@
|
||||
---
|
||||
title: "Connect Wifi"
|
||||
aliases:
|
||||
- pybytes/api/connect_wifi
|
||||
---
|
||||
|
||||
Initialize watchdog for the WiFi and LTE connection.
|
||||
|
||||
**Method**
|
||||
----
|
||||
**pybytes.connect_wifi()**
|
||||
|
||||
**Success Response**
|
||||
----
|
||||
|
||||
```
|
||||
>> Connecting with SSID and PASSWORD
|
||||
>> WiFi connection established
|
||||
```
|
||||
34
content/pybytes/api/deepsleep.md
Normal file
34
content/pybytes/api/deepsleep.md
Normal file
@@ -0,0 +1,34 @@
|
||||
---
|
||||
title: "Deepsleep"
|
||||
aliases:
|
||||
- pybytes/api/deepsleep
|
||||
---
|
||||
|
||||
Start deepsleep mode for the given period
|
||||
|
||||
**Method**
|
||||
----
|
||||
**pybytes.deepsleep(ms, pins, mode, enable_pull)**
|
||||
|
||||
**Parameters**
|
||||
----
|
||||
| name | Description | is Required | Default value
|
||||
| ------------- |:-------------:|:-------------:|:-------------:|
|
||||
| ms | Sleep period in ms | Yes | - |
|
||||
| pins | A list or tuple containing the GPIO to setup for deepsleep wakeup | No | None |
|
||||
| mode | Configure how GPIOs can wake up -> **machine.WAKEUP_ALL_LOW** or **machine.WAKEUP_ANY_HIGH** | No | None |
|
||||
| enable_pull | If set to **True** keeps the pull up or pull down resistors enabled during deep sleep | No | None |
|
||||
|
||||
**Example**
|
||||
----
|
||||
`>> pybytes.deepsleep(1000)`
|
||||
|
||||
|
||||
**Success Response**
|
||||
----
|
||||
After deepsleep, the device reconnects.
|
||||
|
||||
```
|
||||
>> Connecting with SSID and PASSWORD
|
||||
>> WiFi connection established
|
||||
```
|
||||
22
content/pybytes/api/disconnect.md
Normal file
22
content/pybytes/api/disconnect.md
Normal file
@@ -0,0 +1,22 @@
|
||||
---
|
||||
title: "Disconnect"
|
||||
aliases:
|
||||
- pybytes/api/disconnect
|
||||
---
|
||||
|
||||
Disconnect device
|
||||
|
||||
**Method**
|
||||
----
|
||||
**pybytes.disconnect()**
|
||||
|
||||
**Success Response**
|
||||
----
|
||||
|
||||
```
|
||||
>> Watchdog timeout has been increased to 2147483647 ms
|
||||
>> self.__connection_status=1 | self.__network_type=0
|
||||
>> MQTT over WIFI||LTE... disconnecting MQTT
|
||||
>> Packet sent. (Length: 2)
|
||||
>> Connected over WIFI... disconnecting
|
||||
```
|
||||
29
content/pybytes/api/dump_ca.md
Normal file
29
content/pybytes/api/dump_ca.md
Normal file
@@ -0,0 +1,29 @@
|
||||
---
|
||||
title: "Dump CA"
|
||||
aliases:
|
||||
- pybytes/api/dump_ca
|
||||
---
|
||||
|
||||
Make a dump_ca
|
||||
|
||||
**Method**
|
||||
----
|
||||
**pybytes.dump_ca(ca_file)**
|
||||
|
||||
**Parameters**
|
||||
----
|
||||
| name | Description | is Required | Default value
|
||||
| ------------- |:-------------:|:-------------:|:-------------:|
|
||||
| ca_file | File path | No | /flash/cert/pycom-ca.pem |
|
||||
|
||||
|
||||
**Example**
|
||||
----
|
||||
`pybytes.dump_ca(ca_file='/flash/cert/pycom-ca.pem')`
|
||||
|
||||
**Success Response**
|
||||
----
|
||||
|
||||
```
|
||||
>> Successfully created /flash/cert/pycom-ca.pem
|
||||
```
|
||||
36
content/pybytes/api/enable_lte.md
Normal file
36
content/pybytes/api/enable_lte.md
Normal file
@@ -0,0 +1,36 @@
|
||||
---
|
||||
title: "Enable LTE"
|
||||
aliases:
|
||||
- pybytes/api/enable_lte
|
||||
---
|
||||
|
||||
Enable LTE connection
|
||||
|
||||
**Method**
|
||||
----
|
||||
**pybytes.enable_lte(carrier, cid, band, apn, type, reset, fallback)**
|
||||
|
||||
**Parameters**
|
||||
----
|
||||
| name | Description | is Required | Default value
|
||||
| ------------- |:-------------:|:-------------:|:-------------:|
|
||||
| carrier | Carrier | No | None |
|
||||
| cid | Cid | No | None |
|
||||
| band | Band | No | None |
|
||||
| apn | APN | No | None |
|
||||
| type | Type | No | None |
|
||||
| reset | Reset | No | None |
|
||||
| fallback | If **True** extends network preferences with the given LTE information| No | False |
|
||||
|
||||
**Example**
|
||||
----
|
||||
`pybytes.enable_lte('standard', 1, 8, 'soracom.io', 'IP', False)`
|
||||
|
||||
**Success Response**
|
||||
----
|
||||
|
||||
```
|
||||
>> Pybytes configuration written to /flash/pybytes_config.json
|
||||
>> Watchdog timeout has been increased to 2147483647 ms
|
||||
>> Initialized watchdog for WiFi and LTE connection with timeout 1260000 ms
|
||||
```
|
||||
29
content/pybytes/api/enable_ssl.md
Normal file
29
content/pybytes/api/enable_ssl.md
Normal file
@@ -0,0 +1,29 @@
|
||||
---
|
||||
title: "Enable SSL"
|
||||
aliases:
|
||||
- pybytes/api/enable_ssl
|
||||
---
|
||||
|
||||
Enable SSL
|
||||
|
||||
**Method**
|
||||
----
|
||||
**pybytes.enable_ssl(ca_file, dump_ca)**
|
||||
|
||||
**Parameters**
|
||||
----
|
||||
| name | Description | is Required | Default value
|
||||
| ------------- |:-------------:|:-------------:|:-------------:|
|
||||
| ca_file | File Path | No | /flash/cert/pycom-ca.pem |
|
||||
| dump_ca | Dump_ca | No | Yes |
|
||||
|
||||
**Example**
|
||||
----
|
||||
`pybytes.enable_ssl('/flash/cert/pycom-ca.pem', True)`
|
||||
|
||||
**Success Response**
|
||||
----
|
||||
|
||||
```
|
||||
>> Please reset your module to apply the new settings
|
||||
```
|
||||
15
content/pybytes/api/enable_terminal.md
Normal file
15
content/pybytes/api/enable_terminal.md
Normal file
@@ -0,0 +1,15 @@
|
||||
---
|
||||
title: "Enable Terminal"
|
||||
aliases:
|
||||
- pybytes/api/enable_terminal
|
||||
---
|
||||
|
||||
Enable Terminal
|
||||
|
||||
**Method**
|
||||
----
|
||||
**pybytes.enable_terminal()**
|
||||
|
||||
**Example**
|
||||
----
|
||||
`pybytes.enable_terminal()`
|
||||
28
content/pybytes/api/export_config.md
Normal file
28
content/pybytes/api/export_config.md
Normal file
@@ -0,0 +1,28 @@
|
||||
---
|
||||
title: "Export configuration file"
|
||||
aliases:
|
||||
- pybytes/api/export_config
|
||||
---
|
||||
|
||||
Exports all configuration data into a file at specified path.
|
||||
|
||||
**Method**
|
||||
----
|
||||
**pybytes.export_config(file)**
|
||||
|
||||
**Parameters**
|
||||
----
|
||||
| name | Description | is Required | Default value
|
||||
| ------------- |:-------------:|:-------------:|:-------------:|
|
||||
| file | File Path | No | /flash/pybytes_config.json |
|
||||
|
||||
**Example**
|
||||
----
|
||||
`pybytes.export_config()`
|
||||
|
||||
**Success Response**
|
||||
----
|
||||
|
||||
```
|
||||
>> Pybytes configuration exported to /flash/pybytes_config.json
|
||||
```
|
||||
64
content/pybytes/api/get_config.md
Normal file
64
content/pybytes/api/get_config.md
Normal file
@@ -0,0 +1,64 @@
|
||||
---
|
||||
title: "Get configuration"
|
||||
aliases:
|
||||
- pybytes/api/get_config
|
||||
---
|
||||
|
||||
Returns configuration data.
|
||||
|
||||
**Method**
|
||||
----
|
||||
**pybytes.get_config(key)**
|
||||
|
||||
**Parameters**
|
||||
----
|
||||
| name | Description | is Required | Default value
|
||||
| ------------- |:-------------:|:-------------:|:-------------:|
|
||||
| Key | Returns a specific key-value | No | None |
|
||||
|
||||
**Example**
|
||||
----
|
||||
`pybytes.get_config()`
|
||||
|
||||
**Success Response**
|
||||
----
|
||||
|
||||
```json
|
||||
{
|
||||
'ssl': True,
|
||||
'wifi': {
|
||||
'ssid': 'SSID',
|
||||
'password': 'PASSWORD'
|
||||
},
|
||||
'lte': {
|
||||
'apn': 'apn',
|
||||
'cid': 999,
|
||||
'reset': False,
|
||||
'carrier': 'carrier',
|
||||
'band': 999,
|
||||
'type': 'type'
|
||||
},
|
||||
'username': 'user@email.com',
|
||||
'network_preferences': ['lte', 'lora_otaa'],
|
||||
'cfg_msg': 'Pybytes configuration read from file.json',
|
||||
'dump_ca': True,
|
||||
'wlan_antenna': 0,
|
||||
'server': 'xx.x.x.xx',
|
||||
'lora': {
|
||||
'otaa': {
|
||||
'app_key': 'app_key',
|
||||
'app_device_eui': 'app_device_eui',
|
||||
'app_eui': 'app_eui'
|
||||
}
|
||||
},
|
||||
'ota_server': {
|
||||
'port': 999,
|
||||
'domain': 'software.pycom.io'
|
||||
},
|
||||
'pybytes_autostart': True,
|
||||
'ssl_params': {
|
||||
'ca_certs': 'ca_certs'
|
||||
},
|
||||
'device_id': 'device_id'
|
||||
}
|
||||
```
|
||||
24
content/pybytes/api/is_connected.md
Normal file
24
content/pybytes/api/is_connected.md
Normal file
@@ -0,0 +1,24 @@
|
||||
---
|
||||
title: "Pybytes library API"
|
||||
aliases:
|
||||
- pybytes/api/is_connected
|
||||
---
|
||||
|
||||
**Is connected**
|
||||
----
|
||||
Returns true if connected.
|
||||
|
||||
**Method**
|
||||
----
|
||||
**pybytes.is_connected()**
|
||||
|
||||
**Example**
|
||||
----
|
||||
`pybytes.is_connected()`
|
||||
|
||||
**Success Response**
|
||||
----
|
||||
|
||||
```
|
||||
>> True
|
||||
```
|
||||
22
content/pybytes/api/isconnected.md
Normal file
22
content/pybytes/api/isconnected.md
Normal file
@@ -0,0 +1,22 @@
|
||||
---
|
||||
title: "Is connected"
|
||||
aliases:
|
||||
- pybytes/api/isconnected
|
||||
---
|
||||
|
||||
Returns true if connected.
|
||||
|
||||
**Method**
|
||||
----
|
||||
**pybytes.isconnected()**
|
||||
|
||||
**Example**
|
||||
----
|
||||
`pybytes.isconnected()`
|
||||
|
||||
**Success Response**
|
||||
----
|
||||
|
||||
```
|
||||
>> True
|
||||
```
|
||||
35
content/pybytes/api/print_config.md
Normal file
35
content/pybytes/api/print_config.md
Normal file
@@ -0,0 +1,35 @@
|
||||
---
|
||||
title: "Print config"
|
||||
aliases:
|
||||
- pybytes/api/print_config
|
||||
---
|
||||
|
||||
Prints the current configuration in the terminal.
|
||||
|
||||
**Method**
|
||||
----
|
||||
**pybytes.print_config()**
|
||||
|
||||
**Example**
|
||||
----
|
||||
`pybytes.print_config()`
|
||||
|
||||
**Success Response**
|
||||
----
|
||||
|
||||
```
|
||||
>> ssl = True
|
||||
>> wifi = {'ssid': '', 'password': ''}
|
||||
>> lte = {'apn': 'apn', 'cid': 999, 'reset': False, 'carrier': 'carrier', 'band': 999, 'type': 'type'}
|
||||
>> username = user@email.com
|
||||
>> network_preferences = ['lte', 'lte', 'lte', 'lora_otaa']
|
||||
>> cfg_msg = Pybytes configuration read from file.json
|
||||
>> dump_ca = True
|
||||
>> wlan_antenna = 0
|
||||
>> server = xx.x.x.xx
|
||||
>> lora = {'otaa': {'app_key': 'app_key', 'app_device_eui': 'app_device_eui', 'app_eui': 'app_eui'}}
|
||||
>> ota_server = {'port': 000, 'domain': 'domain.com'}
|
||||
>> pybytes_autostart = True
|
||||
>> ssl_params = {'ca_certs': 'ca_certs'}
|
||||
>> device_id = device_id
|
||||
```
|
||||
29
content/pybytes/api/read_config.md
Normal file
29
content/pybytes/api/read_config.md
Normal file
@@ -0,0 +1,29 @@
|
||||
---
|
||||
title: "Read configuration"
|
||||
aliases:
|
||||
- pybytes/api/read_config
|
||||
---
|
||||
|
||||
Reads the configuration from the given file.
|
||||
|
||||
**Method**
|
||||
----
|
||||
**pybytes.read_config(file', reconnect)**
|
||||
|
||||
**Parameters**
|
||||
----
|
||||
| name | Description | is Required | Default value
|
||||
| ------------- |:-------------:|:-------------:|:-------------:|
|
||||
| file | File Path | No | /flash/pybytes_config.json |
|
||||
| reconnect | Reconnect after changes | No | False |
|
||||
|
||||
**Example**
|
||||
----
|
||||
`pybytes.read_config()`
|
||||
|
||||
**Success Response**
|
||||
----
|
||||
|
||||
```
|
||||
>> Pybytes configuration read from /flash/pybytes_config.json
|
||||
```
|
||||
24
content/pybytes/api/reconnect.md
Normal file
24
content/pybytes/api/reconnect.md
Normal file
@@ -0,0 +1,24 @@
|
||||
---
|
||||
title: "Reconnect"
|
||||
aliases:
|
||||
- pybytes/api/reconnect
|
||||
---
|
||||
|
||||
Reconnects device.
|
||||
|
||||
**Method**
|
||||
----
|
||||
**pybytes.reconnect()**
|
||||
|
||||
**Example**
|
||||
----
|
||||
`pybytes.reconnect()`
|
||||
|
||||
**Success Response**
|
||||
----
|
||||
|
||||
After the device disconnects:
|
||||
```
|
||||
>> Connecting with SSID and PASSWORD
|
||||
>> WiFi connection established
|
||||
```
|
||||
15
content/pybytes/api/send_info_message.md
Normal file
15
content/pybytes/api/send_info_message.md
Normal file
@@ -0,0 +1,15 @@
|
||||
---
|
||||
title: "Send information message"
|
||||
aliases:
|
||||
- pybytes/api/send_info_message
|
||||
---
|
||||
|
||||
Send information message.
|
||||
|
||||
**Method**
|
||||
----
|
||||
**pybytes.send_info_message()**
|
||||
|
||||
**Example**
|
||||
----
|
||||
`pybytes.send_info_message()`
|
||||
15
content/pybytes/api/send_ping_message.md
Normal file
15
content/pybytes/api/send_ping_message.md
Normal file
@@ -0,0 +1,15 @@
|
||||
---
|
||||
title: "Send ping message"
|
||||
aliases:
|
||||
- pybytes/api/send_ping_message
|
||||
---
|
||||
|
||||
Send ping message.
|
||||
|
||||
**Method**
|
||||
----
|
||||
**pybytes.send_ping_message()**
|
||||
|
||||
**Example**
|
||||
----
|
||||
`pybytes.send_ping_message()`
|
||||
28
content/pybytes/api/send_signal.md
Normal file
28
content/pybytes/api/send_signal.md
Normal file
@@ -0,0 +1,28 @@
|
||||
---
|
||||
title: "Send signal"
|
||||
aliases:
|
||||
- pybytes/api/send_signal
|
||||
---
|
||||
|
||||
Send signal to the given signal number.
|
||||
|
||||
**Method**
|
||||
----
|
||||
**pybytes.send_signal(pin, value)**
|
||||
|
||||
**Parameters**
|
||||
----
|
||||
| name | Description | is Required | Default value
|
||||
| ------------- |:-------------:|:-------------:|:-------------:|
|
||||
| pin | pin | Yes | - |
|
||||
| value | signal value | Yes | - |
|
||||
|
||||
**Example**
|
||||
----
|
||||
`pybytes.send_signal(13,25)`
|
||||
|
||||
**Success Response**
|
||||
---
|
||||
```
|
||||
To check the result, look at Pybytes → Device → Data
|
||||
```
|
||||
32
content/pybytes/api/set_config.md
Normal file
32
content/pybytes/api/set_config.md
Normal file
@@ -0,0 +1,32 @@
|
||||
---
|
||||
title: "Set configuration"
|
||||
aliases:
|
||||
- pybytes/api/set_config
|
||||
---
|
||||
|
||||
Set device configuration.
|
||||
|
||||
**Method**
|
||||
----
|
||||
**pybytes.set_config(key, value, permanent, silent, reconnect)**
|
||||
|
||||
**Parameters**
|
||||
----
|
||||
| name | Description | is Required | Default value
|
||||
| ------------- |:-------------:|:-------------:|:-------------:|
|
||||
| key | key | Yes | None |
|
||||
| value | value | No | None |
|
||||
| permanent | boolean | No | True |
|
||||
| silent | boolean | No | False |
|
||||
| reconnect | boolean | No | False |
|
||||
|
||||
**Example**
|
||||
----
|
||||
`pybytes.set_config(key="network_preferences", value="wifi", permanent=True, silent=False, reconnect=False)`
|
||||
|
||||
**Success Response**
|
||||
----
|
||||
|
||||
```
|
||||
>> Pybytes configuration written to /flash/pybytes_config.json
|
||||
```
|
||||
28
content/pybytes/api/set_custom_message_callback.md
Normal file
28
content/pybytes/api/set_custom_message_callback.md
Normal file
@@ -0,0 +1,28 @@
|
||||
---
|
||||
title: "Send custom message callback"
|
||||
aliases:
|
||||
- pybytes/api/set_custom_message_callback
|
||||
---
|
||||
|
||||
Sends custom message callback.
|
||||
|
||||
**Method**
|
||||
----
|
||||
**pybytes.set_custom_message_callback(callback)**
|
||||
|
||||
**Parameters**
|
||||
----
|
||||
| name | Description | is Required | Default value
|
||||
| ------------- |:-------------:|:-------------:|:-------------:|
|
||||
| callback | function | Yes | - |
|
||||
|
||||
**Example**
|
||||
----
|
||||
`pybytes.set_custom_message_callback(print("Hello Pycom!"))`
|
||||
|
||||
**Success Response**
|
||||
----
|
||||
|
||||
```
|
||||
>> Hello Pycom!
|
||||
```
|
||||
27
content/pybytes/api/start.md
Normal file
27
content/pybytes/api/start.md
Normal file
@@ -0,0 +1,27 @@
|
||||
---
|
||||
title: "Start"
|
||||
aliases:
|
||||
- pybytes/api/start
|
||||
---
|
||||
|
||||
Opens the Pybytes library.
|
||||
|
||||
**Method**
|
||||
----
|
||||
**pybytes.start()**
|
||||
|
||||
**Example**
|
||||
----
|
||||
`pybytes.start()`
|
||||
|
||||
**Success Response**
|
||||
----
|
||||
|
||||
```
|
||||
>> WMAC: 807D3AC325E8
|
||||
>> Firmware: 1.20.1.r2
|
||||
>> Pybytes: 1.3.0
|
||||
>> Initialized watchdog for WiFi and LTE connection with timeout 1260000 ms
|
||||
>> WiFi connection established
|
||||
>> Pybytes connected successfully (using the built-in pybytes library)
|
||||
```
|
||||
30
content/pybytes/api/update_config.md
Normal file
30
content/pybytes/api/update_config.md
Normal file
@@ -0,0 +1,30 @@
|
||||
---
|
||||
title: "Update configuration"
|
||||
aliases:
|
||||
- pybytes/api/update_config
|
||||
---
|
||||
|
||||
Update device configuration parameters.
|
||||
|
||||
**Method**
|
||||
----
|
||||
**pybytes.update_config(key, value, permanent, silent, reconnect)**
|
||||
|
||||
**Parameters**
|
||||
----
|
||||
| name | Description | is Required | Default value
|
||||
| ------------- |:-------------:|:-------------:|:-------------:|
|
||||
| key | key | Yes | None |
|
||||
| value | value | No | None |
|
||||
| permanent | boolean | No | True |
|
||||
| silent | boolean | No | False |
|
||||
| reconnect | boolean | No | False |
|
||||
|
||||
**Example**
|
||||
----
|
||||
`pybytes.update_config(key="wifi", value={'password': 'Pa$$w0rd'}, permanent=True, silent=False, reconnect=False)`
|
||||
|
||||
**Success Response**
|
||||
----
|
||||
|
||||
Pybytes configuration written to /flash/pybytes_config.json
|
||||
0
content/pybytes/print_cfg_msg.md
Normal file
0
content/pybytes/print_cfg_msg.md
Normal file
Reference in New Issue
Block a user