thingsboard-endpoint 0.2.0__tar.gz → 0.2.2__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {thingsboard_endpoint-0.2.0/src/thingsboard_endpoint.egg-info → thingsboard_endpoint-0.2.2}/PKG-INFO +1 -1
- {thingsboard_endpoint-0.2.0 → thingsboard_endpoint-0.2.2}/src/thingsboard/endpoint/attribute/type.py +35 -1
- {thingsboard_endpoint-0.2.0 → thingsboard_endpoint-0.2.2}/src/thingsboard/endpoint/endpoint.py +1 -1
- thingsboard_endpoint-0.2.2/src/thingsboard/endpoint/exception/invalid_attribute_type_exception.py +12 -0
- {thingsboard_endpoint-0.2.0 → thingsboard_endpoint-0.2.2}/src/thingsboard/endpoint/mqtt/client.py +1 -1
- {thingsboard_endpoint-0.2.0 → thingsboard_endpoint-0.2.2}/src/thingsboard/endpoint/object/object.py +7 -11
- {thingsboard_endpoint-0.2.0 → thingsboard_endpoint-0.2.2}/src/thingsboard/endpoint/version.py +1 -1
- {thingsboard_endpoint-0.2.0 → thingsboard_endpoint-0.2.2/src/thingsboard_endpoint.egg-info}/PKG-INFO +1 -1
- thingsboard_endpoint-0.2.0/src/thingsboard/endpoint/exception/invalid_attribute_type_exception.py +0 -6
- {thingsboard_endpoint-0.2.0 → thingsboard_endpoint-0.2.2}/LICENSE +0 -0
- {thingsboard_endpoint-0.2.0 → thingsboard_endpoint-0.2.2}/README.md +0 -0
- {thingsboard_endpoint-0.2.0 → thingsboard_endpoint-0.2.2}/pyproject.toml +0 -0
- {thingsboard_endpoint-0.2.0 → thingsboard_endpoint-0.2.2}/setup.cfg +0 -0
- {thingsboard_endpoint-0.2.0 → thingsboard_endpoint-0.2.2}/setup.py +0 -0
- {thingsboard_endpoint-0.2.0 → thingsboard_endpoint-0.2.2}/src/thingsboard/__init__.py +0 -0
- {thingsboard_endpoint-0.2.0 → thingsboard_endpoint-0.2.2}/src/thingsboard/endpoint/__init__.py +0 -0
- {thingsboard_endpoint-0.2.0 → thingsboard_endpoint-0.2.2}/src/thingsboard/endpoint/attribute/__init__.py +0 -0
- {thingsboard_endpoint-0.2.0 → thingsboard_endpoint-0.2.2}/src/thingsboard/endpoint/attribute/attribute.py +0 -0
- {thingsboard_endpoint-0.2.0 → thingsboard_endpoint-0.2.2}/src/thingsboard/endpoint/attribute/constraint.py +0 -0
- {thingsboard_endpoint-0.2.0 → thingsboard_endpoint-0.2.2}/src/thingsboard/endpoint/attribute/decorator.py +0 -0
- {thingsboard_endpoint-0.2.0 → thingsboard_endpoint-0.2.2}/src/thingsboard/endpoint/connector/__init__.py +0 -0
- {thingsboard_endpoint-0.2.0 → thingsboard_endpoint-0.2.2}/src/thingsboard/endpoint/connector/model_to_cloud.py +0 -0
- {thingsboard_endpoint-0.2.0 → thingsboard_endpoint-0.2.2}/src/thingsboard/endpoint/exception/__init__.py +0 -0
- {thingsboard_endpoint-0.2.0 → thingsboard_endpoint-0.2.2}/src/thingsboard/endpoint/exception/invalid_attribute_exception.py +0 -0
- {thingsboard_endpoint-0.2.0 → thingsboard_endpoint-0.2.2}/src/thingsboard/endpoint/exception/invalid_property_exception.py +0 -0
- {thingsboard_endpoint-0.2.0 → thingsboard_endpoint-0.2.2}/src/thingsboard/endpoint/exception/modification_exception.py +0 -0
- {thingsboard_endpoint-0.2.0 → thingsboard_endpoint-0.2.2}/src/thingsboard/endpoint/factory/__init__.py +0 -0
- {thingsboard_endpoint-0.2.0 → thingsboard_endpoint-0.2.2}/src/thingsboard/endpoint/factory/xml.py +0 -0
- {thingsboard_endpoint-0.2.0 → thingsboard_endpoint-0.2.2}/src/thingsboard/endpoint/interface/__init__.py +0 -0
- {thingsboard_endpoint-0.2.0 → thingsboard_endpoint-0.2.2}/src/thingsboard/endpoint/interface/attribute_container.py +0 -0
- {thingsboard_endpoint-0.2.0 → thingsboard_endpoint-0.2.2}/src/thingsboard/endpoint/interface/attribute_listener.py +0 -0
- {thingsboard_endpoint-0.2.0 → thingsboard_endpoint-0.2.2}/src/thingsboard/endpoint/interface/message_format.py +0 -0
- {thingsboard_endpoint-0.2.0 → thingsboard_endpoint-0.2.2}/src/thingsboard/endpoint/interface/named_item.py +0 -0
- {thingsboard_endpoint-0.2.0 → thingsboard_endpoint-0.2.2}/src/thingsboard/endpoint/interface/node_container.py +0 -0
- {thingsboard_endpoint-0.2.0 → thingsboard_endpoint-0.2.2}/src/thingsboard/endpoint/interface/object_container.py +0 -0
- {thingsboard_endpoint-0.2.0 → thingsboard_endpoint-0.2.2}/src/thingsboard/endpoint/interface/unique_identifiable.py +0 -0
- {thingsboard_endpoint-0.2.0 → thingsboard_endpoint-0.2.2}/src/thingsboard/endpoint/interface/uuid.py +0 -0
- {thingsboard_endpoint-0.2.0 → thingsboard_endpoint-0.2.2}/src/thingsboard/endpoint/message_format/__init__.py +0 -0
- {thingsboard_endpoint-0.2.0 → thingsboard_endpoint-0.2.2}/src/thingsboard/endpoint/message_format/factory.py +0 -0
- {thingsboard_endpoint-0.2.0 → thingsboard_endpoint-0.2.2}/src/thingsboard/endpoint/message_format/json_format.py +0 -0
- {thingsboard_endpoint-0.2.0 → thingsboard_endpoint-0.2.2}/src/thingsboard/endpoint/message_format/jsonzip_format.py +0 -0
- {thingsboard_endpoint-0.2.0 → thingsboard_endpoint-0.2.2}/src/thingsboard/endpoint/message_format/thingsboard_format.py +0 -0
- {thingsboard_endpoint-0.2.0 → thingsboard_endpoint-0.2.2}/src/thingsboard/endpoint/mqtt/__init__.py +0 -0
- {thingsboard_endpoint-0.2.0 → thingsboard_endpoint-0.2.2}/src/thingsboard/endpoint/mqtt/pending_update.py +0 -0
- {thingsboard_endpoint-0.2.0 → thingsboard_endpoint-0.2.2}/src/thingsboard/endpoint/mqtt/persistence.py +0 -0
- {thingsboard_endpoint-0.2.0 → thingsboard_endpoint-0.2.2}/src/thingsboard/endpoint/node/__init__.py +0 -0
- {thingsboard_endpoint-0.2.0 → thingsboard_endpoint-0.2.2}/src/thingsboard/endpoint/node/node.py +0 -0
- {thingsboard_endpoint-0.2.0 → thingsboard_endpoint-0.2.2}/src/thingsboard/endpoint/object/__init__.py +0 -0
- {thingsboard_endpoint-0.2.0 → thingsboard_endpoint-0.2.2}/src/thingsboard/endpoint/properties_endpoint_configuration.py +0 -0
- {thingsboard_endpoint-0.2.0 → thingsboard_endpoint-0.2.2}/src/thingsboard/endpoint/runtime/__init__.py +0 -0
- {thingsboard_endpoint-0.2.0 → thingsboard_endpoint-0.2.2}/src/thingsboard/endpoint/runtime/node.py +0 -0
- {thingsboard_endpoint-0.2.0 → thingsboard_endpoint-0.2.2}/src/thingsboard/endpoint/runtime/object.py +0 -0
- {thingsboard_endpoint-0.2.0 → thingsboard_endpoint-0.2.2}/src/thingsboard/endpoint/topicuuid.py +0 -0
- {thingsboard_endpoint-0.2.0 → thingsboard_endpoint-0.2.2}/src/thingsboard_endpoint.egg-info/SOURCES.txt +0 -0
- {thingsboard_endpoint-0.2.0 → thingsboard_endpoint-0.2.2}/src/thingsboard_endpoint.egg-info/dependency_links.txt +0 -0
- {thingsboard_endpoint-0.2.0 → thingsboard_endpoint-0.2.2}/src/thingsboard_endpoint.egg-info/requires.txt +0 -0
- {thingsboard_endpoint-0.2.0 → thingsboard_endpoint-0.2.2}/src/thingsboard_endpoint.egg-info/top_level.txt +0 -0
{thingsboard_endpoint-0.2.0 → thingsboard_endpoint-0.2.2}/src/thingsboard/endpoint/attribute/type.py
RENAMED
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
# -*- coding: utf-8 -*-
|
|
2
2
|
|
|
3
|
-
from thingsboard.endpoint.exception.invalid_attribute_type_exception import
|
|
3
|
+
from thingsboard.endpoint.exception.invalid_attribute_type_exception import (
|
|
4
|
+
InvalidAttributeTypeException,
|
|
5
|
+
InvalidAttributeStringTypeException)
|
|
4
6
|
|
|
5
7
|
|
|
6
8
|
class AttributeType(object):
|
|
@@ -54,6 +56,38 @@ class AttributeType(object):
|
|
|
54
56
|
else:
|
|
55
57
|
return 'Invalid'
|
|
56
58
|
|
|
59
|
+
@classmethod
|
|
60
|
+
def from_string_to_type(cls, str_type: str):
|
|
61
|
+
"""Converts a string to a standard type representation."""
|
|
62
|
+
if str_type.lower() == 'bool' or str_type.lower() == 'boolean':
|
|
63
|
+
the_type = cls.Boolean
|
|
64
|
+
elif str_type.lower() in ('short', 'long', 'integer'):
|
|
65
|
+
the_type = cls.Integer
|
|
66
|
+
elif str_type.lower() == 'float' or str_type.lower() == 'double' or str_type.lower() == 'number':
|
|
67
|
+
the_type = cls.Number
|
|
68
|
+
elif str_type.lower() == 'str' or str_type.lower() == 'string':
|
|
69
|
+
the_type = cls.String
|
|
70
|
+
else:
|
|
71
|
+
the_type = cls.Invalid
|
|
72
|
+
|
|
73
|
+
return the_type
|
|
74
|
+
|
|
75
|
+
@classmethod
|
|
76
|
+
def from_string_to_raw_type(cls, str_type: str):
|
|
77
|
+
"""Converts a string to a standard type representation."""
|
|
78
|
+
if str_type.lower() == 'bool' or str_type.lower() == 'boolean':
|
|
79
|
+
the_raw_type = bool
|
|
80
|
+
elif str_type.lower() in ('short', 'long', 'integer'):
|
|
81
|
+
the_raw_type = int
|
|
82
|
+
elif str_type.lower() == 'float' or str_type.lower() == 'double' or str_type.lower() == 'number':
|
|
83
|
+
the_raw_type = float
|
|
84
|
+
elif str_type.lower() == 'str' or str_type.lower() == 'string':
|
|
85
|
+
the_raw_type = str
|
|
86
|
+
else:
|
|
87
|
+
raise InvalidAttributeTypeException(str_type)
|
|
88
|
+
|
|
89
|
+
return the_raw_type
|
|
90
|
+
|
|
57
91
|
@property
|
|
58
92
|
def type(self):
|
|
59
93
|
return self._type
|
{thingsboard_endpoint-0.2.0 → thingsboard_endpoint-0.2.2}/src/thingsboard/endpoint/endpoint.py
RENAMED
|
@@ -600,7 +600,7 @@ class Endpoint(Threaded, NodeContainer):
|
|
|
600
600
|
msg_id = 'PendingNodeAdded-' + ';'.join(topic_levels) + '-' + str(int(timestamp))
|
|
601
601
|
self.persistence.put(msg_id, mqtt.PendingUpdate(payload))
|
|
602
602
|
else:
|
|
603
|
-
raise Exception('Unknown action type!')
|
|
603
|
+
raise Exception(f'Unknown action type \'{action}\'!')
|
|
604
604
|
except Exception as exception:
|
|
605
605
|
self.log.error(exception, exc_info=True)
|
|
606
606
|
|
thingsboard_endpoint-0.2.2/src/thingsboard/endpoint/exception/invalid_attribute_type_exception.py
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
# -*- coding: utf-8 -*-
|
|
2
|
+
|
|
3
|
+
class InvalidAttributeTypeException(Exception):
|
|
4
|
+
def __init__(self, type):
|
|
5
|
+
super(InvalidAttributeTypeException, self).__init__(
|
|
6
|
+
str(type) + ' is not a valid endpoint attribute type!')
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
class InvalidAttributeStringTypeException(Exception):
|
|
10
|
+
def __init__(self, str_type : str):
|
|
11
|
+
super(InvalidAttributeStringTypeException, self).__init__(
|
|
12
|
+
str_type + ' is not a known attribute string type!')
|
{thingsboard_endpoint-0.2.0 → thingsboard_endpoint-0.2.2}/src/thingsboard/endpoint/object/object.py
RENAMED
|
@@ -139,12 +139,10 @@ class _InternalObject(ObjectContainer, AttributeContainer):
|
|
|
139
139
|
if location:
|
|
140
140
|
if len(location) > 0:
|
|
141
141
|
if len(location) > 1: # Check if it's an object (not attribute)
|
|
142
|
-
location.
|
|
143
|
-
|
|
144
|
-
if
|
|
145
|
-
obj
|
|
146
|
-
if obj:
|
|
147
|
-
return obj.find_attribute(location)
|
|
142
|
+
if location[-1] in self.get_objects():
|
|
143
|
+
obj = self.get_objects()[location.pop()]
|
|
144
|
+
if obj:
|
|
145
|
+
return obj.find_attribute(location)
|
|
148
146
|
else: # It's an attribute
|
|
149
147
|
self.get_attributes() # Update attributes list
|
|
150
148
|
if location[-1] in self.get_attributes():
|
|
@@ -163,11 +161,9 @@ class _InternalObject(ObjectContainer, AttributeContainer):
|
|
|
163
161
|
if location:
|
|
164
162
|
if len(location) > 0:
|
|
165
163
|
if len(location) > 1: # Check if it's an object (not attribute)
|
|
166
|
-
location.
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
obj = self.get_objects()[location.pop()]
|
|
170
|
-
return obj
|
|
164
|
+
if location[-1] in self.get_objects():
|
|
165
|
+
obj = self.get_objects()[location.pop()]
|
|
166
|
+
return obj
|
|
171
167
|
else: # It's an attribute
|
|
172
168
|
obj = self.get_attributes() # Update attributes list
|
|
173
169
|
location.pop() # Remove last item
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{thingsboard_endpoint-0.2.0 → thingsboard_endpoint-0.2.2}/src/thingsboard/endpoint/__init__.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{thingsboard_endpoint-0.2.0 → thingsboard_endpoint-0.2.2}/src/thingsboard/endpoint/factory/xml.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{thingsboard_endpoint-0.2.0 → thingsboard_endpoint-0.2.2}/src/thingsboard/endpoint/interface/uuid.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{thingsboard_endpoint-0.2.0 → thingsboard_endpoint-0.2.2}/src/thingsboard/endpoint/mqtt/__init__.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
{thingsboard_endpoint-0.2.0 → thingsboard_endpoint-0.2.2}/src/thingsboard/endpoint/node/__init__.py
RENAMED
|
File without changes
|
{thingsboard_endpoint-0.2.0 → thingsboard_endpoint-0.2.2}/src/thingsboard/endpoint/node/node.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{thingsboard_endpoint-0.2.0 → thingsboard_endpoint-0.2.2}/src/thingsboard/endpoint/runtime/node.py
RENAMED
|
File without changes
|
{thingsboard_endpoint-0.2.0 → thingsboard_endpoint-0.2.2}/src/thingsboard/endpoint/runtime/object.py
RENAMED
|
File without changes
|
{thingsboard_endpoint-0.2.0 → thingsboard_endpoint-0.2.2}/src/thingsboard/endpoint/topicuuid.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|