diff --git a/README.md b/README.md index aebc9e4..8095595 100644 --- a/README.md +++ b/README.md @@ -46,11 +46,9 @@ The client has the following methods and properties: change since the previous poll - `client.rooms`: rooms as a list of `pycalaos.client.Room` - `client.items`: items as dictionary of item ID to `pycalaos.item.Item` -- `client.item_types`: list of item types present in this Calaos installation -- `client.items_by_type(type: str)`: returns all items of that type -- `client.item_gui_types`: list of item gui_types present in this Calaos - installation -- `client.items_by_gui_type(type: str)`: returns all items of that gui_type +- `client.item_types`: complete list of item types currently in use +- `client.items_by_type(type: type)`: returns all items of that type (see types + in the 2nd columns of the mapping table) ## Room @@ -98,7 +96,7 @@ Events have the following properties: Mapping from Calaos IOs to pycalaos items is based on the gui_type: -| Calaos type | pycalaos object | +| Calaos type | pycalaos object type | | --------------- | ----------------------- | | **Generic** | | InPlageHoraire | io.InPlageHoraire | diff --git a/pycalaos/client.py b/pycalaos/client.py index 59a60fa..ce3093a 100644 --- a/pycalaos/client.py +++ b/pycalaos/client.py @@ -113,26 +113,20 @@ def reload_home(self): rooms = [] items = {} items_by_type = {} - items_by_gui_type = {} for roomData in resp["home"]: room = Room(roomData["name"], roomData["type"]) for itemData in roomData["items"]: item = new_item(itemData, room, self._conn) items[item._id] = item try: - items_by_type[item.type].append(item) + items_by_type[type(item)].append(item) except KeyError: - items_by_type[item.type] = [item] - try: - items_by_gui_type[item.gui_type].append(item) - except KeyError: - items_by_gui_type[item.gui_type] = [item] + items_by_type[type(item)] = [item] room._addItem(item) rooms.append(room) self._rooms = rooms self._items = items self._items_by_type = items_by_type - self._items_by_gui_type = items_by_gui_type def update_all(self): """Check all states and return events @@ -195,24 +189,12 @@ def items(self): @property def item_types(self): - """Complete list of item types present in this Calaos installation""" + """Complete list of item types currently in use""" return list(self._items_by_type.keys()) def items_by_type(self, type): - """Return only the items with the given type""" + """Return only the items of the given type""" try: return self._items_by_type[type] except KeyError: return [] - - @property - def item_gui_types(self): - """Complete list of item gui types present in this Calaos installation""" - return list(self._items_by_gui_type.keys()) - - def items_by_gui_type(self, type): - """Return only the items with the given gui type""" - try: - return self._items_by_gui_type[type] - except KeyError: - return [] diff --git a/setup.cfg b/setup.cfg index b88034e..08aedd7 100644 --- a/setup.cfg +++ b/setup.cfg @@ -1,2 +1,2 @@ [metadata] -description-file = README.md +description_file = README.md diff --git a/setup.py b/setup.py index f3bdaa2..e1aeec2 100644 --- a/setup.py +++ b/setup.py @@ -6,7 +6,7 @@ setup( name="pycalaos", - version="0.0.15", + version="0.0.16", description="Calaos home automation client library", long_description=long_description, long_description_content_type="text/markdown",