Skip to main content

cloudio-connector-python

This library is a helper to create python cloudio applications.

The cloudio project: http://cloudio.hevs.ch/

The cloud.iO three layers

Cloud.iO is composed of 3 layers:

alt text

  • The endpoints: distributed field devices that mainly measures and actuate things.
  • Cloudio services: the cloud.iO server that communicate with the endpoints, stores the data and provide a http rest api to the applications.
  • The applications: data analysis, controls the endpoint setpoints, ...

This library is used to create applications.

The cloud.iO data model

Here is a quick reminder of the cloud.iO data model: alt text

Note: You can have objects in objects, that's why an object list is needed to create an AttributeId.

You can get the data model of an endpoint:

cc = CloudioConnector("https://example.com", "user", "password")

sp = cc.get_endpoint_structure('ba3d3ec2-23b6-45a8-827a-3b3133a69076')   

Read/Write attributes

Example

cc = CloudioConnector("https://example.com", "user", "password")

sp = AttributeId(uuid='ba3d3ec2-23b6-45a8-827a-3b3133a69076', node='myNode', 
                    objects=['myObject'], attribute='mySetPoint')
mea = AttributeId(uuid=cc.get_uuid('demo'), node='myNode', 
                    objects=['myObject'], attribute='myMeasure')

# get the last value of an attribute
last_val = cc.get_last_value(mea)
print(str(mea) + ' ' + str(last_val))

# get the mean value of the last 15 minutes
mean = cc.get_mean_value(mea, 15*60)

# write the value of an attribute
cc.write_value(sp, 1.0)      

Get attributes time series

Example

cc = CloudioConnector("https://example.com", "user", "password")

sp = AttributeId(uuid='ba3d3ec2-23b6-45a8-827a-3b3133a69076', node='myNode', 
                    objects=['myObject'], attribute='mySetPoint')
mea = AttributeId(uuid=cc.get_uuid('demo'), node='myNode', 
                    objects=['myObject'], attribute='myMeasure')

tm_mea = TimeSeries(mea, start=datetime.now() - datetime.timedelta(hours=24), 
                    stop=datetime.now(), resample='15m')
tm_sp = TimeSeries(sp, start=datetime.now() - datetime.timedelta(hours=24), 
                    stop=datetime.now(), resample='15m')

# get attribute time series
data = cc.get_time_series(tm_mea)
# data is the same as tm_mea.data

# convert cloudio time series to panda data frame
cc.data_frame(data, serie_name="My Measure")

# get multiple time series with multithreading
cc.get_multiple_time_series([tm_mea, tm_sp])
print(tm_mea.data)
print(tm_sp.data)

Get notified for attribute new value

Example

class Example(AttributeListener):
    def __init__(self):
        cc = CloudioConnector("https://example.com", "user", "password")
        cc.add_attribute_listener(self)

        attr = AttributeId(uuid=cc.get_uuid('demo'), node='myNode', 
                            objects=['myObject'], attribute='myMeasure'),
        
        # subscribe to attribute on change event
        cc.subscribe_to_attribute(attr)
        
    # this method is called when a subscribed attribute has changed
    def attribute_has_changed(self, attribute: AttributeId, value):
        print(str(attribute) + ' ' + str(value))

Release files for cloudio-connector-python 1.2.3

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for cloudio-connector-python 1.2.3
File Size Uploaded
cloudio-connector-python-1.2.3.tar.gz 7.8 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for cloudio-connector-python 1.2.3
File Interpreter ABI Platform
cloudio_connector_python-1.2.3-py3-none-any.whl Python 3 none any Details

Total release size: 15.4 kB

Release files / cloudio-connector-python-1.2.3.tar.gz

Download URL cloudio-connector-python-1.2.3.tar.gz
Size 7.8 kB
Tags Source
SHA-256 checksum
How to use checksums
9c0ea81ce77bb195181e38bda60c27b763cdef2983268c166d818f8c02c6a701
BLAKE2b-256 checksum
How to use checksums
7d2b91ea873320d302f247191506fac9160f1f4ac0301b655459357c0bc6026b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.1 CPython/3.9.5

Release files / cloudio_connector_python-1.2.3-py3-none-any.whl

Download URL cloudio_connector_python-1.2.3-py3-none-any.whl
Size 7.6 kB
Tags Python 3
SHA-256 checksum
How to use checksums
e45645e91fe65c20f0d623d570797626f83c321f6cac6d4b0b8a197117039fc2
BLAKE2b-256 checksum
How to use checksums
af97766c119634a5fd195cefb77cccf763e524d57bd501fb408bafca1637d04a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.1 CPython/3.9.5

Release history Release notifications | RSS feed

This release

1.2.3 This release

2 release files

1.2.2

2 release files

1.2.1

2 release files

1.2.0

2 release files

1.1.0

2 release files

1.0.1

2 release files

1.0.0

2 release files

0.1.4

2 release files

0.1.3

2 release files

0.1.2

2 release files

0.1.1

2 release files

0.1.0

2 release files

0.0.1

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page