{
"info": {
"author": "Keiichi SHIMA",
"author_email": "keiichi@iijlab.net",
"bugtrack_url": null,
"classifiers": [
"Development Status :: 4 - Beta",
"Environment :: Console",
"Intended Audience :: Developers",
"Intended Audience :: Information Technology",
"License :: OSI Approved :: BSD License",
"Programming Language :: Python :: 3.5",
"Topic :: Home Automation",
"Topic :: Software Development :: Libraries :: Python Modules",
"Topic :: System :: Networking"
],
"description": "Echonet Lite\n============\n\nThis package provides an `Echonet `__ Lite\nmiddleware module for Python3. The current implementation only provides\nquite limited functions to implement Echonet Lite server and client.\n\n`Echonet Lite specification `__ is available\nfrom the Echonet web site.\n\nProgramming an Echonet Lite Node\n--------------------------------\n\nServer Node\n~~~~~~~~~~~\n\nA simple temperature server code is included in the examples directory\nas ``examples/server-temp.py``.\n\n.. code:: python\n\n import struct\n\n from echonetlite.interfaces import monitor\n from echonetlite import middleware\n from echonetlite.protocol import *\n\n class MyTemperature(middleware.NodeSuperObject):\n def __init__(self, eoj):\n super(MyTemperature, self).__init__(eoj=eoj)\n # self.property[EPC_MANUFACTURE_CODE] = ...\n self._add_property(EPC_TEMPERATURE, [0,0])\n self.get_property_map += [\n EPC_TEMPERATURE]\n\n monitor.schedule_loopingcall(\n 1,\n self._update_temperature)\n\n def _update_temperature(self):\n # update temperature value here\n val = 270\n self._properties[EPC_TEMPERATURE] = struct.pack('!h', val)\n\n # Create local devices\n profile = middleware.NodeProfile()\n # profile.property[EPC_MANUFACTURE_CODE] = ...\n # profile.property[EPC_IDENTIFICATION_NUMBER] = ...\n temperature = MyTemperature(eoj=EOJ(clsgrp=CLSGRP_CODE['SENSOR'],\n cls=CLS_SE_CODE['TEMPERATURE'],\n instance_id=1))\n\n # Start the Echonet Lite message loop\n monitor.start(node_id='172.16.254.66',\n devices={str(profile.eoj): profile,\n str(temperature.eoj): temperature})\n\nA server (a local Echonet Lite device) should be defined as a subclass\nof the ``middleware.NodeSuperObject`` class that handles some basic\nrequests required for all the Echonet Lite devices.\n\nSince a temperature sensor device must provide the ``EPC_TEMPERATURE``\nproperty, that property is created in the ``__init__()`` function. Also,\nto respond the GET request from client nodes, the ``EPC_TEMPERATURE``\nvalue is appended to the ``get_property_map`` variable.\n\nThe ``interfaces.monitor`` variable is the core instance of this module.\nIt handles all the event loop and callback processing. This module used\nthe `Twisted `__ framework as its underlying\nlayer.\n\nThe ``interfaces.monitor.schedule_loopingcall()`` function registers a\nfunction periodically called. In this example, the\n``_update_temperature()`` function that is meant to update the internal\ntemperature value is registered and called every second.\n\nIn the ``_update_temperature()`` function, the property value for the\n``EPC_TEMPERATURE`` code is updated. Based on the specification, the\ntemperature value is encoded into 2 bytes of data.\n\nAn Echonet Lite node must have one NodeProfile device. The\n``middleware.NodeProfile`` class provides a basic NodeProfile device\nfunction.\n\nFinally, by calling the ``monitor.start()`` function providing the node\nIP address and device list, the Echonet Lite server that provides two\ndevices one is a NodeProfile device and the other is a temperature\nsensor device starts working\n\nClient Node\n~~~~~~~~~~~\n\nA simple temperature client that can communication with the above simple\ntemperature server is included in the examples directory as\n``examples/client-temp.py``.\n\n.. code:: python\n\n import struct\n\n from echonetlite.interfaces import monitor\n from echonetlite import middleware\n from echonetlite.protocol import *\n\n class Temperature(middleware.RemoteDevice):\n def __init__(self, eoj, node_id):\n super(Temperature, self).__init__(eoj=eoj)\n self._node_id = node_id\n monitor.schedule_loopingcall(\n 10,\n self._request_temperature,\n from_device=controller,\n to_eoj=self.eoj,\n to_node_id=self._node_id)\n\n self.add_listener(EPC_TEMPERATURE,\n self._on_did_receive_temperature)\n\n def _request_temperature(self, from_device, to_eoj, to_node_id):\n from_device.send(esv=ESV_CODE['GET'],\n props=[Property(epc=EPC_TEMPERATURE),],\n to_eoj=to_eoj,\n to_node_id=to_node_id)\n\n def _on_did_receive_temperature(self, from_node_id, from_eoj,\n to_device, esv, prop):\n if esv not in ESV_RESPONSE_CODES:\n return\n (val,) = struct.unpack('!h', bytearray(prop.edt))\n print('Temperature is', val / 10)\n\n class MyProfile(middleware.NodeProfile):\n def __init__(self, eoj=None):\n super(MyProfile, self).__init__(eoj=eoj)\n # profile.property[EPC_MANUFACTURE_CODE] = ...\n # profile.property[EPC_IDENTIFICATION_NUMBER] = ...\n\n def on_did_find_device(self, eoj, from_node_id):\n if (eoj.clsgrp == CLSGRP_CODE['SENSOR']\n and eoj.cls == CLS_SE_CODE['TEMPERATURE']):\n return Temperature(eoj, from_node_id)\n return None\n\n profile = MyProfile()\n controller = middleware.Controller(instance_id=1)\n\n monitor.start(node_id='172.16.254.1',\n devices={str(profile.eoj): profile,\n str(controller.eoj): controller})\n\nThe ``Temperature`` class is a placeholder to register functions to\nrequest a temperature value and to receive its response. In the\n``__init__()`` function, two functions ``request_temperature`` and\n``on_temperature`` are registered for these purposes.\n\nWhen writing a client node, you need to handle new device discovery\ncase. In the ``on_did_find_device()`` function, you will receive an EOJ\nand node IP address when the middleware find a new device. You need to\ncheck the EOJ and create a new device entry (the ``Temperature`` class\nin this case).\n\nCode\n----\n\nThe source code is available at\nhttps://github.com/keiichishima/echonetlite\n\nBug Reports\n-----------\n\nPlease submit bug reports or patches through the GitHub interfaces.\n\nAuthor\n------\n\nKeiichi SHIMA / IIJ Innovation Institute Inc. / WIDE project",
"description_content_type": "",
"docs_url": null,
"download_url": "",
"downloads": {
"last_day": -1,
"last_month": -1,
"last_week": -1
},
"home_page": "https://github.com/keiichishima/echonetlite",
"keywords": "",
"license": "BSD License",
"maintainer": "",
"maintainer_email": "",
"name": "echonetlite",
"package_url": "https://pypi.org/project/echonetlite/",
"platform": "",
"project_url": "https://pypi.org/project/echonetlite/",
"project_urls": {
"Homepage": "https://github.com/keiichishima/echonetlite"
},
"release_url": "https://pypi.org/project/echonetlite/0.1.1/",
"requires_dist": null,
"requires_python": "",
"summary": "Echonet Lite",
"version": "0.1.1"
},
"last_serial": 4883092,
"releases": {
"0.0.1": [
{
"comment_text": "",
"digests": {
"md5": "44444450e1d0d21956e9c3681eb4d3e7",
"sha256": "ede468adc88102df6712cbcdd5d63aee1e8b1be8d7a2d6cefe22a06ab2201318"
},
"downloads": -1,
"filename": "echonetlite-0.0.1.tar.gz",
"has_sig": false,
"md5_digest": "44444450e1d0d21956e9c3681eb4d3e7",
"packagetype": "sdist",
"python_version": "source",
"requires_python": null,
"size": 11395,
"upload_time": "2016-09-06T11:54:55",
"url": "https://files.pythonhosted.org/packages/e8/1c/071c2d08e373fa07e875f76157daf699632e005966ba49e38643fda05006/echonetlite-0.0.1.tar.gz"
}
],
"0.1.0": [
{
"comment_text": "",
"digests": {
"md5": "045858256bba12622ffef59e7676d7b5",
"sha256": "5098c9245171ccdd6b8b796b8dae19caa369e1c40e3a4868674048296a3d6ae4"
},
"downloads": -1,
"filename": "echonetlite-0.1.0.tar.gz",
"has_sig": false,
"md5_digest": "045858256bba12622ffef59e7676d7b5",
"packagetype": "sdist",
"python_version": "source",
"requires_python": null,
"size": 13369,
"upload_time": "2019-02-26T01:50:44",
"url": "https://files.pythonhosted.org/packages/86/8a/9c9f732a0850782cad0d0f3c40cb537685496506bb95a7acef650eafaf1f/echonetlite-0.1.0.tar.gz"
}
],
"0.1.1": [
{
"comment_text": "",
"digests": {
"md5": "69cea8d4449fc027b3d4bd72a26ecdf6",
"sha256": "fe0414f2d39f7a74bbb97be30589b64a18ebf187d0093384de40164299df2f34"
},
"downloads": -1,
"filename": "echonetlite-0.1.1.tar.gz",
"has_sig": false,
"md5_digest": "69cea8d4449fc027b3d4bd72a26ecdf6",
"packagetype": "sdist",
"python_version": "source",
"requires_python": null,
"size": 13364,
"upload_time": "2019-03-01T08:51:00",
"url": "https://files.pythonhosted.org/packages/52/62/f5c8d12ebeedf56dc94b7b308e0144ff1fb8cf6f810fb7cb95c6315f4363/echonetlite-0.1.1.tar.gz"
}
]
},
"urls": [
{
"comment_text": "",
"digests": {
"md5": "69cea8d4449fc027b3d4bd72a26ecdf6",
"sha256": "fe0414f2d39f7a74bbb97be30589b64a18ebf187d0093384de40164299df2f34"
},
"downloads": -1,
"filename": "echonetlite-0.1.1.tar.gz",
"has_sig": false,
"md5_digest": "69cea8d4449fc027b3d4bd72a26ecdf6",
"packagetype": "sdist",
"python_version": "source",
"requires_python": null,
"size": 13364,
"upload_time": "2019-03-01T08:51:00",
"url": "https://files.pythonhosted.org/packages/52/62/f5c8d12ebeedf56dc94b7b308e0144ff1fb8cf6f810fb7cb95c6315f4363/echonetlite-0.1.1.tar.gz"
}
]
}