Professional Documents
Culture Documents
ON
BY
Student Name…………………………………… id number
1)Brhanu Abrha …………………………………………AKU 0901329
2)Tadese Atomssa …...…………………………………….AKU0904885
3)Hajer tekle …………..………………………………….Aku0903803
4)Yemane Gedamu …..…………………………….………..Aku1200639
5)Tesfay Gitet ………….………………………….…….…AKU09005100
Submitted to the
DEPARTMENT OF ELECTRONIC COMMUNICATION ENGINEERING
FACULTY OF ELECTRICAL AND COMPUTER ENGINEERIN
i
Acknowledgement
We would like to acknowledge the support and help of Information and communication
Technology ___________ in the completion of our internship and the preparation of internship
report by providing supportive reference materials and constructive ideas.
Next, we would like to express our deepest thanks to our advisor ___________ who assists us do
well our project continuously.
ii
Abstract
In the new time of technology improvement today, without understanding the new time of
innovation has turned into a need and that is regularly utilized for everyday existence of the
present society. Where nearly in the greater part of the regions have had the option to feel from
the advancement of new time of such innovation, as in the field of PC systems administration
and hardware. For this situation, the requirement for actualizing the room innovation is
progressively required to make a smart room, where during this time the home control is finished
by executing the gadgets. Home can be mechanized through the turn on or off switch utilizing
these hardware gadgets. The planning of Smart room is an application which is a mix of
innovation and administrations gave to the room condition with explicit capacities meant to
improve the security, proficiency, and furthermore solace of its occupants. In the planning some
portion of keen home framework normally comprises of control devices, monitoring apparatuses
and programmed there are a few gadgets that can be gotten to utilizing an advanced mobile
phone or PC which is associated with the Internet organize. IOT (Internet of things) is where a
few things can be associated together, sensed and furthermore remotely controlled over the
system. This paper manages the execution of brilliant home utilizing using new released version
of Cisco packet tracer simulator 7.2, because this feature include different kind of sensor and
actuator and also having different types of smart device used for room automation.
iii
Contents
Declaration ..................................................................................................................................................... i
Acknowledgement ........................................................................................................................................ ii
1.1Background .............................................................................................................................................. 1
1.3.2. Mission................................................................................................................................................ 2
2.3.2. Roles and responsibilities of Business Applications Development and Administration .................... 6
iv
2.4. Hardware over view ............................................................................................................................... 7
2.4.5. Router................................................................................................................................................ 13
2.5 Work piece and work task we have been executing ............................................................................. 15
2.6 Procedures we have been following while performing our Tasks ....................................................... 22
2.9. The measures we have taken in order to overcome our work task ...................................................... 22
v
3.8 Entrepreneurship Skills ......................................................................................................................... 25
CHAPTER FOUR....................................................................................................................................... 27
Design and Implementation of Smart room for disable students using Cisco Packet Tracer Simulator .. 27
4. INTRODUCTION .................................................................................................................................. 27
4.4 ............................................................................................................................................................... 29
REFERENCES ........................................................................................................................................... 38
APPENDEXE ................................................................................................................................................. 40
vi
List of figure
Figure 1: Work flow....................................................................................................................................... 5
Figure 2: network interface card .................................................................................................................. 8
Figure 3: Rj45 connector ............................................................................................................................... 8
Figure 4: Fiber optic cable ............................................................................................................................. 9
Figure 5: Shielded twisted cable ................................................................................................................. 10
Figure 6: Twisted-pair cable with the wire exposed ................................................................................... 11
Figure 7: Rack .............................................................................................................................................. 12
Figure 8: switch ........................................................................................................................................... 13
Figure 9: Router .......................................................................................................................................... 14
Figure 10: firewall ....................................................................................................................................... 14
Figure 11: server ......................................................................................................................................... 15
Figure 12: Tools used for cabling ................................................................................................................ 17
Figure 13:Untwist wire ends ....................................................................................................................... 17
Figure 14:Arrange wires from left to right depending on the connections standard. ............................... 18
Figure 15:Trim wires into a purposed size .................................................................................................. 18
Figure 16:Attach connector (RJ45 connector) ............................................................................................ 19
Figure 17:Check it whether it has fitted or not ........................................................................................... 19
Figure 18:Crimp using crimping tool. .......................................................................................................... 20
Figure 19:Test it whether its working or not .............................................................................................. 20
Figure 20: Wiring standard ......................................................................................................................... 20
Figure 21:: Punch down tool ....................................................................................................................... 21
Figure 22:After the wire punched ............................................................................................................... 21
Figure 23:Smart home with IOT .................................................................................................................. 29
Figure 24:Smart home circuit diagram ....................................................................................................... 30
Figure 25:home gateway ............................................................................................................................ 33
Figure 26:Connecting the wireless devices to home gate way ................................................................... 34
Figure 27:Creating an account to register devices. .................................................................................... 34
Figure 28: conditions or programs to show the result............................................................................... 35
Figure 29:User credentials verification ....................................................................................................... 36
Figure 30:Checking the full simulation ....................................................................................................... 37
vii
List of Abbreviations
LAN Local Area Network
SW Software
HW Hardware
IP Internet Protocol
RJ Registered Jack
PC Personal Computer
HA High Availability
viii
CHAPTER ONE
Aksum University is found at the town of Aksum in Tigray region of Northern Ethiopia, at a
distance of 1080 Kilometers from the Ethiopian capital city. Aksum University was officially
established in February 08, 1999. During this time it included three faculties. These are natural
science, social science, Business and Economics Faculty. At present the University runs
undergraduate programs. It is expected that with the on-going expansion a number of faculties and
programs will be opened and the enrolment capacity will increase.
The ICT in Aksum University store office was established during this time and it is developed
from time to time with the development of the University. As it is developed from time to time it
increases its capacity by increasing the number of workers in the office. The ICT in Aksum
University store office is the back bone of the University by managing any activities related to
materials available on the University. Now a day’s, Aksum University ICT store office gives many
services, among these services the following are the main services:
1.1Background
Inventory management system deals primarily with determining the amount and placement of the
materials within a facility or within multiple locations of a store. One way of managing this
system is to have a web-based system in place that can instantly track and update the information
about the tools or equipment. The importance of implementing a web based inventory system is
becoming vital as most of the time the information are accessible directly, so making the details
of the usage of the equipment
1
Available, and improving the movement and anticipation of their demand as well as the
productivity of the system as a whole.
1. The implementation of this web-based inventory system can help the University to develop the
skills to handle with their operational environments. Because lack of system tool to be used to
monitor the availability and quantity of materials in this University.
1.3.1. Vision
On 2025, Aksum University aspires to become one of the top 25 universities in Africa by
emphasizing on empowering local communities, excelling in innovation and entrepreneurship, and
partnering national and international institutions.
1.3.2. Mission
The mission of Aksum University is to pursue excellence in academics, research and community
services. It also seeks to contribute to the advancement of knowledge, economic growth, and social
welfare of the country.
2
Pursuit of Truth and Freedom of Expression
Good Governance
1.6. Customer
The customer of AKU ICT inventory management system is staff member only that is staff
member can give comment, request item, view item, return request and take response on the
materials
3
CHAPTER TWO
He gave us a description about the company’s organizational structure introduced us with all
departments, staffs and key people in the office introduced us all services of the office which has
helped us to familiarize the overall current situation of the company easily It was nice for us
working in this office because all sections of the office are well organized and it was a good time.
4
2.3. Networking Department Work Flow
Insure that ICT provides, operates and maintains the ICT infrastructure, systems and
solutions to meet the needs of the administrative, educational, and research programs of
the University
5
2.3.2. Roles and responsibilities of Business Applications Development
and Administration
Analyzing business processes of different sections of the university and come up with
automation solution
Automate and facilitate the full life-cycle activities of students and staff (from enrollment
to graduation/resignation/retirement)
Verify the compatibility, scalability and Integrality the different business automation
application going to be implemented in the University.
6
Provide quick services to its users, provide problem identification, support and resolution
functions to its customers
Record, monitor problems being reported to ICT, update users on status of problems, and
report on service level metrics for services provided
Compile a knowledge base of problems and solutions, for use by first level support
personnel
Track and report on Service Level performance that it achieves and ICT delivers
Maintain failed office equipment (printer, ups, computer, laptops, phones, network devices)
Create basic awareness on Internet, security, productivity tools, emerging technologies and
new projects in ICT for the campus users and staff
Following
7
Rj-45 is the most common type of network adapter connection. RJ45 is a type of connector
with 8 pins to be connected with the 8 pins from the cable and is commonly
used for Ethernet networking. Since Ethernet cables have an RJ45 connector on their two ends,
Ethernet cables are sometimes also called RJ45 cables. The "RJ" in RJ45 stands for
"registered jack," since it is a standardized networking interface, the "45" simply refers to the
number of the interface standard. Since RJ45 connector has eight pins, it holds 8 separate wires. If
you look closely at the end of an Ethernet cable, you can actually see the eight wires, which are
each with different color. Four of them are solid colors, while the other four are striped.
8
2.4.2.1. Fiber optic cables
Fiber optic cables transmit light (photons) over glass or plastic “fibers”. These cables are very
good for high-speed, high-capacity data transmission due to lack of attenuation. Fiber optic cables
are single-mode and multi-mode. Single-mode fiber cables carry single ray of light. This type of
cable is normally used for high-bandwidth, longer distance .it generally runs 10-80km and it is
more expensive equipment. But multi-mode fiber cable carries multiple rays of light. This type of
cable is used for shorter distance and runs up to 600m. There are different types of fiber optic
cables
9
2.4.2.2. Shielded twisted pair (STP) cables
Shielded twisted pair cables have an aluminum shield inside the plastic jacket surrounded the
pairs of wires
Unshielded twisted-pair cables are categorized according to the frequency at which they transmit
signals and their data transfer rate
10
Figure 6: Twisted-pair cable with the wire exposed
Attenuation, near end crosstalk (NEXT), and PSNEXT (power sum NEXT) in Cat 6 cable and
connectors are all significantly lower than Cat 5 or Cat 5e. The heavier insulation in some Cat 6
cables makes them too thick to attach to 8P8C connectors without a special modular piece,
resulting in a technically out-of-compliance assembly. Connectors use either T568A or T568B pin
assignments
11
2.4.3. Rack
It is a tool that used to contain the patch panel and switch and used as power distribution. It has a box
shape.
Figure 7: Rack
2.4.4. Switch
Switch is an “intelligent” device because it has application specific integrated circuit (ASIC).it has
the future of storing the MAC address information. Switches learn all the MAC addresses
connected to it. It has many collision domains and one broadcast domain. Each of the switch
interfaces should be connected to the same network. Switch can send and receive data at the same
time. Switches control the flow of network traffic based on the address information in each packet.
A switch learns which devices are connected to its ports (by monitoring the packets it receives),
and then forwards on packets to the appropriate port only. This allows simultaneous
communication across the switch, improving bandwidth. This switching operation reduces the
amount of unnecessary traffic that would have occurred if the same information had been sent
from every port. Switches divide the network into smaller, less congested sections.
12
Figure 8: switch
2.4.5. Router
Router enables computers to communicate and allow communication between two networks, such
as our home network and the Internet. It has many collision domains and many broadcast domains.
Each interface of a router will be connected to a different network. Router functions in an Internet
protocol based network operate at the network layer (OSI Model's layer 3). The primary function
of a router is to connect networks together and keep certain kinds of broadcast traffic under control.
When a data packet comes in on one of the lines, the router reads the address information in the
packet to determine its ultimate destination. Then, using information in its routing table or routing
policy, it directs the packet to the next network on its journey. This creates an overlay internetwork.
When multiple routers are used in interconnected networks, the routers exchange
information about destination addresses using a dynamic routing protocol. Each router
builds up a table listing the preferred routes between any two systems on the interconnected
networks. A router has interfaces for different physical types of network connections, such
as copper cables, fiber optic, or wireless transmission. It also contains firmware for
different networking communications protocol standards. Each network interface uses this
13
specialized computer software to enable data packets to be forwarded from one protocol
transmission system to another. Routers may also be used to connect two or more logical
groups of computer devices known as subnets, each with a different
sub-network address. The subnet addresses recorded in the router do not necessarily map
directly to the physical interface connections.
Figure 9: Router
2.4.6. Firewall
Firewall is a network device that is used to help a network from unwanted or malicious attack and
unwanted intrusion. Firewall is the most commonly used type of security device in an
organization’s perimeter.
14
2.2.7. Server
Servers are nothing more than computers, sometimes with overbuilt parts in them that have been
told to provide some kind of service. They might serve files, accept print jobs, push out web pages,
scan email, handle database transactions, or whatever, but at their hearts, they're Computers. If we
put the right software on it, the computer on our desk would be a server.
15
Running cable, trunk, network design, crimp, punch.
Running cables:-A length of installed cable connecting two network components that are not
in immediate proximity to one another. Laying cable runs is the main work of installing premise
cabling in a customer premises. Types of cable runs include;
Horizontal cable:-Runs through building plenums (the space between the floor and the
ceiling) and false ceilings, connecting wiring closets together and connecting patch panels
to wall plates.
Vertical cable:-Runs through vertical building rises, connecting wiring closets on each
floor with the building’s main equipment room.
Network design:-is generally performed by network designers, engineers, IT
administrators and other related staff. It is done before the implementation of a network
infrastructure.
Crimping: - are typically used to terminate stranded wire.
Punching: - is used to connect and cutting a wire.
2.5.1. Cabling
The most commonly used cable types are unshielded twisted pair (UTP), shielded twisted pair
(STP)coaxial and fiber optic. Unshielded twisted pair is a popular type of cable that consists of
two unshielded wires twisted around each other. Due to its low cost, UTP cabling is used
extensively for local -area networks (LANs) and telephone connections. Throughout the whole
internship time we used unshielded twisted pair cable, specifically cat 6 cables.
While we make connections for cables in our internship time we have been using the following
tools.
Cat6 cable
RJ45 connectors
16
Cutter
Crimping tool
Cable tester
We make connections for the cable we have to follow the steps below:-
17
Sort wires by insulation colors
Figure 14:Arrange wires from left to right depending on the connections standard.
18
Figure 16:Attach connector (RJ45 connector)
Step5.
19
Figure 18:Crimp using crimping tool.
Step7.
Step8.
When we attach RJ45 connector to our intended cable we follow the following pin assignment
wiring standard from left to right:-
20
2.5.2. Punching cables
For punching cables there is a tool used to punch the wires into the jacket called punch down
tool, also called a punch down tool is a small hand tool used by telecommunication and network
technicians. It is used for inserting wire into insulation displacement connectors on punch down
blocks, patch panels, keystone modules, and surface mount boxes (also known as biscuit jacks).
To use the punch down tool, a wire is pre-positioned into a slotted post, and then the punch down
tool is pressed down on top of the wire, over the post. Once the required pressure is reached, the
internal spring is triggered, and the blade pushes the wire into the slot, cutting the insulation, and
securing the wire. For light -duty use, there are also less expensive punch down tools with fixed
blades and no impact mechanism.
21
2.6 Procedures we have been following while performing our Tasks
Procedures we have been using during our internship period in ICT, networking department
procedures while we are performing tasks are:-
2.9. The measures we have taken in order to overcome our work task
Communicating and discussing with organization supervisor and the organization supervisor
discussed with the head of ICT. They told to the resource allocators that the necessary resources
are permitted to us on time. And we gained some knowledge from our organization supervisor and
reading to perform well on the working environment and also we discussed with our friends and
colleagues on how to solve the problems
22
Chapter THREE
skills, team playing skills, leadership skills and etc. In the next pages we will try to describe what
we have learnt in the different aspects that we have mentioned before.
23
Internship is the beginning of the road that will take us to the point we want to be at after our
graduation. Internship is a practice we need to perform, because it prepares us for the future
works
Management are also considered interpersonal skills. Through this internship, we found that we
matured and gained many new perspectives, such as problem solving skill, diversity, effective
communication, teamwork and service recovery, attention to detail, time management, personal
empowerment, self-confidence, responsibility and cultural sensitivity. Our supervisor was so
kind to answer with patience and teach us much that made this internship so enjoyable. We had
gotten a wonderful internship that spent such a happy moment with all of them. Though, still
have so much to learn, we think this challenge was what should include in our career. This
helped much on our future planning
24
3.6 Leadership Skills
Leadership skills are the tool, behaviors, and capabilities that a person needs in order to be
successful at motivating and directing others. Yet true leadership skills involve something more;
the ability to help people grow in their own abilities. It can be said that the most successful
leaders are those that drive other to active their own success. we gained leadership skills from
our supervisor during the internship period which includes managing time, motivating
individuals, giving feedback and building teams.
it is the willingness to take calculated risks, both personal and financial, and then to do
everything possible to get the odds in your favor.”
25
gain firsthand understanding of entrepreneurship along with enhanced technical, professional,
and communication skills. In this internship we have gained self-confidence, information
seeking, problem seeking and sees and acts on opportunities of business in networking. Though
helping us to clarify
26
CHAPTER FOUR
4. INTRODUCTION
The IOT (internet of things) is a system which is equipped for interfacing everything to the web
through remote sensor networks. IOT (internet of things) is made out of two words :web and
things. The IOT innovation usage made a change in new developments in the fields of
horticulture, industry and vitality dispersion by including the significant data with the assistance
of various kinds of sensors. As per Cisco organizing there are enormous number of organizations
and research associations which gives the effects of Internet of things on the web and the
economy in the following five to ten years. The internet of things was first presented by pioneer
Kevin Ashton in the time of 1999 to characterize that the items in the physical globe can be
utilized to associated with
The web by utilizing of the sensors. He gave that the capacity of interfacing Radio recurrence
Identification (RFID) utilized in business to the web to follow the different kinds of
products/materials prepared selling without prerequisite of the human intercession. The present
internet of things (IOT) has a capacity to depict the various sorts articles, gadgets and sensors to
interface with the web. As a result, IOT is commonly new idea, yet coordinating systems and
PCs to oversee and control things had existed in this genuine world for around quite a few years.
Internet of things (IOT) enables items and clients to speak with one another by utilizing of a
novel IP address to each article to distinguish which clients are going to getting to what asset of
the system effectively. IOT additionally depicts a universe of system wherein all items are
associated with the system so information can be partaken in a system. Everyone as of now has
an advanced cell, however a telephone isn't savvy rather it encourages its client to make more
intelligent decisions. also depicts a universe of system wherein each article is associated with the
system so information can be shared. Everybody as of now has an advanced cell, however a
27
telephone is certainly not a brilliant as opposed to it causes its client to settle on more astute
choices.
Then using the VLAN we going to design or make the rooms better and smart and easy for the
disable students.
28
4.3 Theory
Packet Tracer is a cross-platform visual simulation tool designed by Cisco Systems that allows
users to create network topologies and imitate modern computer networks. The software allows
users to simulate the configuration of Cisco routers and switches using a simulated command
line interface. Packet Tracer makes use of a drag and drop user interface, allowing users to add
and remove simulated network devices as they see fit. The software is mainly focused towards
Certified Cisco Network Associate Academy students as an educational tool for helping them
learn fundamental CCNA concepts. Previously students enrolled in a CCNA Academy program
could freely download and use the tool free of charge for educational use.[2][1]
To execute smart home, Cisco packet tracer 7.2 variant is utilized which is another discharged
innovation that incorporates every smart article planned for office mechanization. These gadgets
are: brilliant fan, keen light, savvy window, shrewd entryway. Be that as it may, the home door
gives the controlling components by enlisting every single smart gadget separately by means of
the cloud (WAN).
29
4.5 METHODOLOGY
As clear at the above figure the house is created by utilizing the system test system which
comprises of various gadgets an IOT passage with associated brilliant gadgets, IOT server, DNS
server, IOT cloud (WAN), cell tower, Central office server, ISP server, advanced cell ,link
modem and PC.
The server contains 1. internet of things server 2.Domain name server.The IOT server stores all
the recognized data from the working environment and give customers an endorsed access to the
advantages by entering username and mystery state.
30
4.6 Algorithm
The Algorithm is explained as follows
Step 1: Start the project.
Step 2: Open the pkt file and save the file.
Step 3: Add the required components to the work space as packet tracer simultor shown above.
Step 4: Connect all devices in work space Using cables.
Step 5 : Configure the device and setup internet service provider router.
Step 6: Add Home Gateway to the Network.
Step 7 : Connect smart Devices to the Wireless Network.
Step 8 : Add End User Device to the Network
Step 9:stop
31
The flow chart is explained as follow
start
Add the
components
Configure the
router
Check the
configurat
ion Re configure
stop
32
4.6.1Material requirements
We have been used both hardware and software material to design this project
Gateway is a physical device or software program that serves as the connection point between th
e cloud and controllers, sensors
and intelligent devices. All data moving between IoT devices and the cloud passes through an Io
T gateway, which can be either a dedicated hardware
appliance or software program. An IoT gateway might also be referred to as an intelligent gatewa
y or a control tier
33
Figure 26:Connecting the wireless devices to home gate way
34
Figure 28: conditions or programs to show the result
4.8 IOT-Layouts.
IoT rationale availability was set up on the highest point of the system network. As appeared in
the Figure all IoT gadgets must be set to be associated remotely to the IoT server utilizing
recently made username, secret phrase and the server IP. Effective network was set up when
"Interface" catch changed into "Invigorate". All gadget must utilize the equivalent IoT
qualifications, same certifications were likewise utilized by the mortgage holder for passing the
verification when interfacing by means of program to the principle IoT checking landing page as
appeared in the Figure As the IoT server was arrangement likewise for DNS administrations, the
iothomepage.com was interpreted with the IoT server static IP. When client is associated with
IoThomepage.com it is conceivable to picture the status of the IoT gadgets yet it is additionally
conceivable to audit the collaboration rationale between them. As noticeable in the Figure in this
activity f IoT keen gadgets were utilized: movement indicator, alarm, carport entryway, fan and
smoke alarm however these were just for impact the ecological variable of the reenactment
35
Figure 29:User credentials verification
36
4.8 RESULTS
Once you finish all the main procedure of designing a smart home environment that is – Add home
gateway to the workspace, Add IoT devices to the home gateway in workspace and finally add the end
user device such as smartphone, tab, laptop, etc. When the smartphone in the workspace is clicked, IoT
server can be selected to verify the connections that have been established. Fig shows the registered
devices in the smart home implemented.
4.9 CONCLUSION
This venture work is to examine the idea of the Internet of things and its pertinence in home robotization
setting. Internet of things is another innovation that is utilized for the interconnection of the gadgets with
the assistance of the web association. It empowers the gadgets to detect and screen gadgets remotely. It
has been told the best way to effectively manufacture a keen home that will contain advanced gadgets to
thusly screen and control every action and occasions inside home utilizing IoT shrewd gadgets. So as to
demonstrate the achievability of the work a reenactment instrument is utilized for planning a keen home
37
REFERENCES
[2] packettracernetwork. (2018, January). (What's new in Cisco Packet Tracer 7.0) Retrieved
from packettracernetwork: http://www.packettracernetwork.com/features/packettracer-7- new-
features.html
[3] A, E., & K. A, H. (n.d.). Design and Implementation of a WiFi Based Home Automation
System,. pages 2177-2180.
[4] Abdi, A. (2018). Designing Smart Campus Using Internet of Things. International Journal of
Computer Science Trends and Technology (IJCST), V 6 I 3 PP 109-116.
[5] Aggarwal, R., & Lal Das, M. (2012). RFID Security in the Context of Internet of Things.
page 51-56. Kerala: First International Conference on Security of Internet of Things.
[6] al, M. c. (n.d.). Designing Smart Campus Using Internet of Things. 6(3).
[7] Alexandria, A. (2014). Enabling communication between wireless sensor networks and the
internet of things-ACOAP communication stacks. International journal of Science and
Engineering, 6-7 Vol.5.
[8] AlFarsi, G., & ALSinani, M. (2017). Developing a Mobile Notification System for
AlBuraimi University College Students. International Journal of Information Technology and
Language Studies(IJITLS), 1(1).
[9] ALFarsi, G., Jabbar, J., & ALSinani, M. (2018). Implementing a Mobile Application News
Tool for Disseminating Messages and Events of AlBuraimi University College. International
Journal of Interactive Mobile Technologies (iJIM), 12(7).
38
[10] ALFARSI, G., M, K. A., & ALSINANI, M. (2017). A RULE- BASED SYSTEM FOR
ADVISING UNDERGRADUATE STUDENTS. Journal of Theoretical and Applied Information
Technology, 95(11).
39
APPENDEXE
Programing of the equipment
Smoke detector
import math
ENVIRONMENT_NAME = "Smoke"
state = 0
level = 0
ALARM_LEVEL = 40
def main():
setup()
while True:
loop()
def setup():
IoEClient.setup({
"states": [{
"name": "Alarm",
"type": "bool",
"controllable": False
},
40
{
"name": "Level",
"type": "number",
"controllable": False
}]
})
IoEClient.onInputReceive(onInputReceiveDone)
add_event_detect(0, detect)
state = restoreProperty("state", 0)
setState(state)
def onInputReceiveDone(data):
processData(data, True)
def detect():
processData(customRead(0), False)
if type(defaultValue) is int :
value = int(value)
return value
return defaultValue
41
def loop():
global ENVIRONMENT_NAME
value = Environment.get(ENVIRONMENT_NAME)
if value >= 0:
setLevel(Environment.get(ENVIRONMENT_NAME))
#print(value)
sleep(1)
if len(data) <= 0 :
return
data = data.split(",")
setState(int(data[0]))
def sendReport():
global state
global level
IoEClient.reportStates(report)
def setState(newState):
global state
state = newState
if newState is 0:
42
digitalWrite(1, LOW)
else:
digitalWrite(1, HIGH)
sendReport()
def setLevel(newLevel):
global level
if level == newLevel:
return
level = newLevel
setState(1)
else:
setState(0)
sendReport()
if __name__ == "__main__":
main()
43