This is a pre-production deployment of Warehouse, however changes made here WILL affect the production instance of PyPI.
Latest Version Dependencies status unknown Test status unknown Test coverage unknown
Project Description

This package provides an Echonet Lite middleware module for Python3. The current implementation only provides quite limited functions to implement Echonet Lite server and client.

Echonet Lite specification is available from the Echonet web site.

Programming an Echonet Lite Node

Server Node

A simple temperature server code is included in the examples directory as examples/

import struct

from echonetlite.interfaces import monitor
from echonetlite import middleware
from echonetlite.protocol import *

class MyTemperature(middleware.NodeSuperObject):
    def __init__(self, eoj):
        super(MyTemperature, self).__init__(eoj=eoj)
        #[EPC_MANUFACTURE_CODE] = ...
        self._add_property(EPC_TEMPERATURE, [0,0])
        self.get_property_map += [


    def _update_temperature(self):
        # update temperature value here
        val = 270
        self._properties[EPC_TEMPERATURE] = struct.pack('!h', val)

# Create local devices
profile = middleware.NodeProfile()
temperature = MyTemperature(eoj=EOJ(clsgrp=CLSGRP_CODE['SENSOR'],

# Start the Echonet Lite message loop
              devices={str(profile.eoj): profile,
                       str(temperature.eoj): temperature})

A server (a local Echonet Lite device) should be defined as a subclass of the middleware.NodeSuperObject class that handles some basic requests required for all the Echonet Lite devices.

Since a temperature sensor device must provide the EPC_TEMPERATURE property, that property is created in the __init__() function. Also, to respond the GET request from client nodes, the EPC_TEMPERATURE value is appended to the get_property_map variable.

The interfaces.monitor variable is the core instance of this module. It handles all the event loop and callback processing. This module used the Twisted framework as its underlying layer.

The interfaces.monitor.schedule_loopingcall() function registers a function periodically called. In this example, the _update_temperature() function that is meant to update the internal temperature value is registered and called every second.

In the _update_temperature() function, the property value for the EPC_TEMPERATURE code is updated. Based on the specification, the temperature value is encoded into 2 bytes of data.

An Echonet Lite node must have one NodeProfile device. The middleware.NodeProfile class provides a basic NodeProfile device function.

Finally, by calling the monitor.start() function providing the node IP address and device list, the Echonet Lite server that provides two devices one is a NodeProfile device and the other is a temperature sensor device starts working

Client Node

A simple temperature client that can communication with the above simple temperature server is included in the examples directory as examples/

import struct

from echonetlite.interfaces import monitor
from echonetlite import middleware
from echonetlite.protocol import *

class Temperature(middleware.RemoteDevice):
    def __init__(self, eoj, node_id):
        super(Temperature, self).__init__(eoj=eoj)
        self._node_id = node_id


    def _request_temperature(self, from_device, to_eoj, to_node_id):

    def _on_did_receive_temperature(self, from_node_id, from_eoj,
                                    to_device, esv, prop):
        if esv not in ESV_RESPONSE_CODES:
        (val,) = struct.unpack('!h', bytearray(prop.edt))
        print('Temperature is', val / 10)

class MyProfile(middleware.NodeProfile):
    def __init__(self, eoj=None):
        super(MyProfile, self).__init__(eoj=eoj)
        #[EPC_MANUFACTURE_CODE] = ...

    def on_did_find_device(self, eoj, from_node_id):
        if (eoj.clsgrp == CLSGRP_CODE['SENSOR']
            and eoj.cls == CLS_SE_CODE['TEMPERATURE']):
            return Temperature(eoj, from_node_id)
        return None

profile = MyProfile()
controller = middleware.Controller(instance_id=1)

              devices={str(profile.eoj): profile,
                       str(controller.eoj): controller})

The Temperature class is a placeholder to register functions to request a temperature value and to receive its response. In the __init__() function, two functions request_temperature and on_temperature are registered for these purposes.

When writing a client node, you need to handle new device discovery case. In the on_did_find_device() function, you will receive an EOJ and node IP address when the middleware find a new device. You need to check the EOJ and create a new device entry (the Temperature class in this case).


The source code is available at

Bug Reports

Please submit bug reports or patches through the GitHub interfaces.


Keiichi SHIMA / IIJ Innovation Institute Inc. / WIDE project

Release History

Release History


This version

History Node

TODO: Figure out how to actually get changelog content.

Changelog content for this version goes here.

Donec et mollis dolor. Praesent et diam eget libero egestas mattis sit amet vitae augue. Nam tincidunt congue enim, ut porta lorem lacinia consectetur. Donec ut libero sed arcu vehicula ultricies a non tortor. Lorem ipsum dolor sit amet, consectetur adipiscing elit.

Show More

Download Files

Download Files

TODO: Brief introduction on what you do with files - including link to relevant help section.

File Name & Checksum SHA256 Checksum Help Version File Type Upload Date
echonetlite-0.0.1.tar.gz (11.4 kB) Copy SHA256 Checksum SHA256 Source Sep 6, 2016

Supported By

WebFaction WebFaction Technical Writing Elastic Elastic Search Pingdom Pingdom Monitoring Dyn Dyn DNS HPE HPE Development Sentry Sentry Error Logging CloudAMQP CloudAMQP RabbitMQ Heroku Heroku PaaS Kabu Creative Kabu Creative UX & Design Fastly Fastly CDN DigiCert DigiCert EV Certificate Rackspace Rackspace Cloud Servers DreamHost DreamHost Log Hosting