-
-
Notifications
You must be signed in to change notification settings - Fork 27
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
added functionality to receive Events from Openhab and added methods to create and delete openhab items #22
base: master
Are you sure you want to change the base?
Conversation
need write testcases still
create item test
basic tests for setting states and commands added a method to delete items
finished documentation
Hi @galexey What are you thoughts on using aiohttp-sse instead of threading+sseclient? |
renaming of literals to python style
# Conflicts: # openhab/client.py # openhab/items.py
cleaning code regarding new codestyles
Hi! |
I need to rework Commandhandling a bit. expect another commit soon. |
…ands. changed handling of incoming values wrote quite a lot of testcases for creation/deletion of items wrote quite a lot of testcases for event handling
openhab/client.py
Outdated
@@ -143,7 +375,7 @@ def fetch_all_items(self) -> typing.Dict[str, openhab.items.Item]: | |||
Returns: | |||
dict: Returns a dict with item names as key and item class instances as value. | |||
""" | |||
items = {} # type: dict | |||
items = {} # data_type: dict |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this should really be type
openhab/items.py
Outdated
class Item: | ||
"""Base item class.""" | ||
|
||
types = [] # type: typing.List[typing.Type[openhab.types.CommandType]] | ||
types = [] # data_type: typing.List[typing.Type[openhab.types.CommandType]] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this should really be type
openhab/items.py
Outdated
self._state = None # type: typing.Optional[typing.Any] | ||
self._raw_state = None # type: typing.Optional[typing.Any] # raw state as returned by the server | ||
self._members = {} # type: typing.Dict[str, typing.Any] # group members (key = item name), for none-group items it's empty | ||
self._state = None # data_type: typing.Optional[typing.Any] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this should really be type
openhab/items.py
Outdated
self._raw_state = None # type: typing.Optional[typing.Any] # raw state as returned by the server | ||
self._members = {} # type: typing.Dict[str, typing.Any] # group members (key = item name), for none-group items it's empty | ||
self._state = None # data_type: typing.Optional[typing.Any] | ||
self._raw_state = None # data_type: typing.Optional[typing.Any] # raw state as returned by the server |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this should really be type
openhab/items.py
Outdated
self._members = {} # type: typing.Dict[str, typing.Any] # group members (key = item name), for none-group items it's empty | ||
self._state = None # data_type: typing.Optional[typing.Any] | ||
self._raw_state = None # data_type: typing.Optional[typing.Any] # raw state as returned by the server | ||
self._raw_state_event = None # data_type: str # raw state as received from Serverevent |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this should really be type
openhab/items.py
Outdated
self._state = None # data_type: typing.Optional[typing.Any] | ||
self._raw_state = None # data_type: typing.Optional[typing.Any] # raw state as returned by the server | ||
self._raw_state_event = None # data_type: str # raw state as received from Serverevent | ||
self._members = {} # data_type: typing.Dict[str, typing.Any] # group members (key = item name), for none-group items it's empty |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this should really be type
openhab/items.py
Outdated
|
||
def _rest_format(self, value: str) -> typing.Union[str, bytes]: | ||
"""Format a value before submitting to openHAB.""" | ||
_value = value # type: typing.Union[str, bytes] | ||
_value = value # data_type: typing.Union[str, bytes] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this should really be type
openhab/client.py
Outdated
|
||
|
||
|
||
# event = None |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
no commented code blocks
openhab/client.py
Outdated
else: | ||
self.logger.debug("item '{}' not registered. ignoring the arrived event.".format(item_name)) | ||
|
||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
too many newlines
A couple of change requests:
Thanks |
…by Georges some additions around event content bugfixes cleaned code to fix linting issues
Hi! However I can not split up the PRs to isolate the SSE-stuff, I had to change a lot of things in client, items and types modules for sse-implementation. |
when reading images from OH
added voices added voice interpreter added cache for items
Hi, Could you please rebase your PR on that branch ( https://github.com/sim0nx/python-openhab/tree/galexey_pr ) ... if required open a new PR. I would also appreciate docstrings for methods which currently have none :-)... Thanks |
more detailed logging again
more detailed logging again
…ditional thread for processing(dispatching) of events.
I also created som testcases for the new functionality.