Cloud4rpi

Latest version: v1.1.2

Safety actively analyzes 688126 Python packages for vulnerabilities to keep your Python projects secure.

Scan your dependencies

Page 2 of 3

0.1.6

We have improved variable types' validation. The library now checks the following:

- [Type strings](https://github.com/cloud4rpi/cloud4rpi-raspberrypi-python/blob/master/control.pyL63) in a dictionary used in the `device.declare()` method.
- The `device.publish_config()` argument when it is specified.

0.1.5

Improvements:

1. We have added a variable types validation. Now when a variable is configured as `numeric`, you are advised to pass a [numbers.Number](https://docs.python.org/2/library/numbers.html) value into it.
* Boolean type will also work in `numeric` variables because in Python `bool` is a subtype of `int` (see [PEP 285](https://www.python.org/dev/peps/pep-0285/)): `True` will be converted to 1, `False` to 0.
* For `bool` variables, the numeric or boolean values are recommended.
* For `string` variables, it is recommended to pass `str` values, although boolean values will also work: they will be converted to "true" or "false" strings.

2. You can now easily change the service's name when installing cloud4rpi-enabled script as a service using our [service_install.sh](https://gist.github.com/c4r-gists/3bdeff914dd57a26928973656685a503) script.

3. The [service_install.sh](https://github.com/cloud4rpi/cloud4rpi/blob/65d3ceebcf1412698b4635d970845905f6efde77/service_install.sh) script was moved out of the library. Now it exists in the examples repositories and in [gist](https://gist.github.com/c4r-gists/3bdeff914dd57a26928973656685a503).

4. This library now support the secured MQTTs connection. You can enable TLS on Raspberry Pi as follows:

python
DEVICE_TOKEN = '__YOUR_DEVICE_TOKEN__'
device = cloud4rpi.connect(DEVICE_TOKEN, tls_config={'ca_certs': '/etc/ssl/certs/ca-certificates.crt'})


The `tls_config` dictionary holds parameters for the Paho MQTT's [tls_set()](https://github.com/eclipse/paho.mqtt.pythontls_set) function.

0.1.3

Improvements:

1. MQTT messages are now sent with QoS 1, which improves the reliability of message delivery.
2. The logging is now more accurate: published messages appear in the log only after publishing a confirmation.
3. Small changes in the reconnect mechanism.

0.1.2

The API of this version differs from the pre-release versions, if you used Cloud4RPi before the release, please change your code as follows:

python
Device object creation
device = cloud4rpi.connect(DEVICE_TOKEN)
 
Variables declaration
device.declare(variables)
device.declare_diag(diagnostics)
 
Publishing
device.publish_config()
device.publish_data()
device.publish_diag()


The following changes were made in the API:

- The `api` and `device` objects are now merged.
- You don't need to assign the `api.on_command` handler anymore.
- The publishing functions can now be called without arguments to publish the current readings.

If you need to separate reading from publishing, you can still do it as follows:

python
data = device.read_data()
device.publish_data(data)
 
cfg = device.read_config()
device.publish_config(cfg)
 
diag = device.read_diag()
device.publish_diag(diag)

0.1

0.0.10

*Changes since 0.0.9 (to 0.0.10)*

- Fix for management of string variables.
- Increases JSON buffer to send config.

Page 2 of 3

© 2024 Safety CLI Cybersecurity Inc. All Rights Reserved.