Skip to content

Commit

Permalink
Add a connection event
Browse files Browse the repository at this point in the history
  • Loading branch information
ajmarks committed Sep 9, 2020
1 parent ca0761d commit aa5c0c2
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 2 deletions.
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,10 @@ little about the appliance. The `GeAppliance` object is passed to the callback.
state is received. A tuple `(appliance, state_changes)` is passed to the callback, where `appliance` is the
`GeAppliance` object with the updated state and `state_changes` is a dictionary `{erd_key: new_value}` of the changed
state.
* `EVENT_CONNECTED` - Triggered when the API connects, after adding basic subscriptions
* `EVENT_DISCONNECTED` - Triggered when the API disconnects
* `EVENT_GOT_APPLIANCE_LIST` - Triggered when we get the list of appliances

### GeXmppClient(xmpp_credentials, event_loop=None, **kwargs)
Main XMPP client, and a subclass of `slixmpp.ClientXMPP`.
* `xmpp_credentials: dict` A dictionary of XMPP credentials, usually obtained from either `do_full_login_flow` or, in a
Expand Down
2 changes: 1 addition & 1 deletion gekitchen/__init__.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
"""GE Kitchen Appliances SDK"""

__version__ = "0.2.12"
__version__ = "0.2.13"


from .async_login_flow import (
Expand Down
2 changes: 2 additions & 0 deletions gekitchen/clients/websocket_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
API_URL,
EVENT_ADD_APPLIANCE,
EVENT_APPLIANCE_STATE_CHANGE,
EVENT_CONNECTED,
EVENT_DISCONNECTED,
EVENT_GOT_APPLIANCE_LIST,
)
Expand Down Expand Up @@ -282,6 +283,7 @@ async def async_run_client(self, appliances: Optional[List[GeAppliance]] = None,
else:
await self.subscribe_appliances(appliances)
await self.get_appliance_list()
await self.async_event(EVENT_CONNECTED, None)
async for message in socket:
await self.process_message(message)
_LOGGER.info("Disconnected")
Expand Down
3 changes: 2 additions & 1 deletion gekitchen/const.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,9 @@
API_URL = "https://api.brillion.geappliances.com"
SECURE_URL = "https://secure.brillion.geappliances.com"

EVENT_APPLIANCE_STATE_CHANGE = "appliance_state_change"
EVENT_ADD_APPLIANCE = "add_appliance"
EVENT_APPLIANCE_INITIAL_UPDATE = "appliance_got_type"
EVENT_APPLIANCE_STATE_CHANGE = "appliance_state_change"
EVENT_CONNECTED = "connected"
EVENT_DISCONNECTED = "disconnected"
EVENT_GOT_APPLIANCE_LIST = "got_appliance_list"

0 comments on commit aa5c0c2

Please sign in to comment.