SlideShare a Scribd company logo
Python for IoT
A return of experience
Alexandre Abadie, Inria
Outline
What IoT are we talking about ?
The usual protocols for IoT
Pyaiot, connecting objects to the web
How we built Pyaiot
Lessons learned
Conclusion
What IoT are we talking about ?
The Internet of Things today
High-end devices
Low-end devices
⇒ adapted protocols are required
Outline
What IoT are we talking about ?
⇒ The usual protocols for IoT
Pyaiot, connecting objects to the web
How we built Pyaiot
Lessons learned
Conclusion
Usual protocols for IoT: CoAP
Core WG at IETF specifications (2010)
RFC 7252
Similar to HTTP REST:
GET/PUT/POST/DELETE + OBSERVE
Works on UDP with small payload
overhead
More information at http://coap.technology/
source: https://fr.wikipedia.org/wiki/CoAP
CoAP: available implementations in Python
3 available implementations:
TxThings: Twisted based, Python 2 & 3
https://github.com/mwasilak/txThings
Aiocoap: asyncio based, Python 3 only
https://github.com/chrysn/aiocoap
CoaPthon: Threading based, Python 2 & 3
https://github.com/Tanganelli/CoAPthon
Implementations exist for other languages: http://coap.technology/impls.html
Usual protocols for IoT: MQTT
Based on publication/subscriptions to topics pattern
Topics have a path form: this/is/a/topic
MQTT v3.1.1 is an OASIS standard
MQTT Sensor Network (MQTT-SN): adapted for constrained devices
source: https://dev.to/kenwalger/overview-of-the-mqtt-protocol
MQTT: available implementations in Python
2 available implementations:
Paho-mqtt: threading based, considered as the reference implementation
https://pypi.python.org/pypi/paho-mqtt
HBMQTT: asyncio based
https://github.com/beerfactory/hbmqtt
Outline
What IoT are we talking about ?
The usual protocols for IoT
⇒ Pyaiot, connecting objects to the web
How we built Pyaiot
Lessons learned
Conclusion
Why Pyaiot?
Need for a web application able to communicate with contrained devices
⇒ but constrained devices cannot use usual web protocols
Why Pyaiot?
Need for a web application able to communicate with contrained devices
⇒ but constrained devices cannot use usual web protocols
Need for multi-site support
⇒ but constrained devices cannot be exposed directly to the web
Why Pyaiot?
Need for a web application able to communicate with contrained devices
⇒ but constrained devices cannot use usual web protocols
Need for multi-site support
⇒ but constrained devices cannot be exposed directly to the web
Heterogeneous protocol support
⇒ various IoT protocols exist
General guidelines
Open-Source and simple design⇒ can be deployed by anyone
https://github.com/pyaiot/pyaiot
General guidelines
Open-Source and simple design⇒ can be deployed by anyone
https://github.com/pyaiot/pyaiot
Multiprotocol: CoAP, MQTT, etc ⇒ interoperability
General guidelines
Open-Source and simple design⇒ can be deployed by anyone
https://github.com/pyaiot/pyaiot
Multiprotocol: CoAP, MQTT, etc ⇒ interoperability
Modular ⇒ extensible
General guidelines
Open-Source and simple design⇒ can be deployed by anyone
https://github.com/pyaiot/pyaiot
Multiprotocol: CoAP, MQTT, etc ⇒ interoperability
Modular ⇒ extensible
Bi-directionnal and real time access to nodes ⇒ reactive
General guidelines
Open-Source and simple design⇒ can be deployed by anyone
https://github.com/pyaiot/pyaiot
Multiprotocol: CoAP, MQTT, etc ⇒ interoperability
Modular ⇒ extensible
Bi-directionnal and real time access to nodes ⇒ reactive
No constraint regarding the backend language ⇒ let's choose Python!
General guidelines
Open-Source and simple design⇒ can be deployed by anyone
https://github.com/pyaiot/pyaiot
Multiprotocol: CoAP, MQTT, etc ⇒ interoperability
Modular ⇒ extensible
Bi-directionnal and real time access to nodes ⇒ reactive
No constraint regarding the backend language ⇒ let's choose Python!
Pyaiot targets contrained nodes running RIOT: https://riot-os.org
Pyaiot overview
Permanent web showcase for RIOT available at
http://riot-demo.inria.fr
Pyaiot: The web dashboard
Outline
What IoT are we talking about ?
The usual protocols for IoT
Pyaiot, connecting objects to the web
⇒ How we built Pyaiot
Lessons learned
Conclusion
Pyaiot overview
Pyaiot services
Gateways are clients running in private networks
Nodes are kept isolated from Internet
Messages exchanged in JSON format
Works with low-end devices (RIOT) and high-end devices (Python)
Technical choices
Web dashboard developed with Vue.js   http://vuejs.org
Service applications based on Tornado framework with:
HTTP server
Websocket server and client
Aiocoap for CoAP protocol support
HBMQTT for MQTT protocol support
Technical choices
Web dashboard developed with Vue.js   http://vuejs.org
Service applications based on Tornado framework with:
HTTP server
Websocket server and client
Aiocoap for CoAP protocol support
HBMQTT for MQTT protocol support
⇒ All python packages are asyncio based/compatible ⇒ simplify integration
The MQTT gateway in detail
MQTT-SN is required for low-end device
⇒ a MQTT to MQTT-SN gateway/broker is required
No implementation in Python
⇒ let's go for mosquitto.rsmb
The MQTT gateway in detail
MQTT-SN is required for low-end device
⇒ a MQTT to MQTT-SN gateway/broker is required
No implementation in Python
⇒ let's go for mosquitto.rsmb
Node/Gateway
subscribe/publish to topic publish/subscribe to topics
gateway//discover node/check
node//resources
node//
Outline
What IoT are we talking about ?
The usual protocols for IoT
Pyaiot, connecting objects to the web
How we built Pyaiot
⇒ Lessons learned
Conclusion
Using asyncio
Easy to read asynchronous programming language
Using asyncio
Easy to read asynchronous programming language
Asyncio new syntax available with Python >= 3.5
Using asyncio
Easy to read asynchronous programming language
Asyncio new syntax available with Python >= 3.5
... but Python 3.4.2 available on Raspbian
@asyncio.coroutine
def my_coroutine():
my_long_call()
yield from my_coroutine() # wait until done
asyncio.get_event_loop().create_task(my_coroutine) # scheduled in ioloop
asyncio.ensure_future(my_coroutine) # scheduled in ioloop, requires python 3.4.4
Using asyncio
Easy to read asynchronous programming language
Asyncio new syntax available with Python >= 3.5
... but Python 3.4.2 available on Raspbian
@asyncio.coroutine
def my_coroutine():
my_long_call()
yield from my_coroutine() # wait until done
asyncio.get_event_loop().create_task(my_coroutine) # scheduled in ioloop
asyncio.ensure_future(my_coroutine) # scheduled in ioloop, requires python 3.4.4
with python 3.5 new syntax:
async def my_coroutine():
my_long_call()
await my_coroutine() # wait until done
asyncio.ensure_future(my_coroutine) # scheduled in ioloop
The benefits of Python
Develop fast, even with complex things
The benefits of Python
Develop fast, even with complex things
Can run on any high-end device : from a Raspberry PI to a Cloud server
The benefits of Python
Develop fast, even with complex things
Can run on any high-end device : from a Raspberry PI to a Cloud server
Off-the-shelf packages for IoT available: Aiocoap, HBMQTT
The benefits of Python
Develop fast, even with complex things
Can run on any high-end device : from a Raspberry PI to a Cloud server
Off-the-shelf packages for IoT available: Aiocoap, HBMQTT
⇒ Python is adapted to IoT
Conclusion
Widely used protocol in IoT is MQTT
Adapted protocols are required for constrained devices (microcontrollers)
⇒ CoAP, MQTT-SN
Conclusion
Widely used protocol in IoT is MQTT
Adapted protocols are required for constrained devices (microcontrollers)
⇒ CoAP, MQTT-SN
We easily built an application following the initial requirements
⇒ Pyaiot: https://github.com/pyaiot/pyaiot
Conclusion
Widely used protocol in IoT is MQTT
Adapted protocols are required for constrained devices (microcontrollers)
⇒ CoAP, MQTT-SN
We easily built an application following the initial requirements
⇒ Pyaiot: https://github.com/pyaiot/pyaiot
Asyncio made things simpler... after some headaches
Conclusion
Widely used protocol in IoT is MQTT
Adapted protocols are required for constrained devices (microcontrollers)
⇒ CoAP, MQTT-SN
We easily built an application following the initial requirements
⇒ Pyaiot: https://github.com/pyaiot/pyaiot
Asyncio made things simpler... after some headaches
Pyaiot is still work in progress... even if it works pretty well
Demo!
http://riot-demo.inria.fr
Thanks!

More Related Content

What's hot (20)

PDF
Kranky Geek WebRTC 2015 - What's next for WebRTC?
Kranky Geek
 
PDF
Linux-wpan: IEEE 802.15.4 and 6LoWPAN in the Linux Kernel - BUD17-120
Linaro
 
PDF
Inria Tech Talk : RIOT, l'OS libre pour vos objets connectés #IoT
Stéphanie Roger
 
PDF
Linux on RISC-V (ELC 2020)
Drew Fustini
 
PDF
Upperside WebRTC conference - WebRTC intro
Victor Pascual Ávila
 
PDF
Linux on RISC-V with Open Hardware (ELC-E 2020)
Drew Fustini
 
PDF
Kranky Geek WebRTC 2015 - The future of ORTC with WebRTC
Kranky Geek
 
PDF
Connected Tizen: Bringing Tizen to Your Connected Devices Using the Yocto Pro...
Samsung Open Source Group
 
PDF
Janus conf'19: janus client side
Alexandre Gouaillard
 
PDF
Quality Assurance for WebRTC Services
Tsahi Levent-levi
 
PDF
SOSCON 2016 JerryScript
Samsung Open Source Group
 
PDF
Webrtc puzzle
Mihály Mészáros
 
PDF
What is a Service Mesh and what can it do for your Microservices
Matt Turner
 
PDF
WebRTC eduCONF
Mihály Mészáros
 
PDF
Multimedia support in WebKitGTK and WPE, current status and plans (GStreamer ...
Igalia
 
PDF
IoTivity Tutorial: Prototyping IoT Devices on GNU/Linux
Samsung Open Source Group
 
PDF
Open Source Internet of Things 101 – EclipseCon 2016
Benjamin Cabé
 
PDF
BKK16-105 HALs for LITE
Linaro
 
PDF
Iotivity atmel-20150328rzr
Phil www.rzr.online.fr
 
PDF
Reaching the multimedia web from embedded platforms with WPEWebkit
Igalia
 
Kranky Geek WebRTC 2015 - What's next for WebRTC?
Kranky Geek
 
Linux-wpan: IEEE 802.15.4 and 6LoWPAN in the Linux Kernel - BUD17-120
Linaro
 
Inria Tech Talk : RIOT, l'OS libre pour vos objets connectés #IoT
Stéphanie Roger
 
Linux on RISC-V (ELC 2020)
Drew Fustini
 
Upperside WebRTC conference - WebRTC intro
Victor Pascual Ávila
 
Linux on RISC-V with Open Hardware (ELC-E 2020)
Drew Fustini
 
Kranky Geek WebRTC 2015 - The future of ORTC with WebRTC
Kranky Geek
 
Connected Tizen: Bringing Tizen to Your Connected Devices Using the Yocto Pro...
Samsung Open Source Group
 
Janus conf'19: janus client side
Alexandre Gouaillard
 
Quality Assurance for WebRTC Services
Tsahi Levent-levi
 
SOSCON 2016 JerryScript
Samsung Open Source Group
 
Webrtc puzzle
Mihály Mészáros
 
What is a Service Mesh and what can it do for your Microservices
Matt Turner
 
WebRTC eduCONF
Mihály Mészáros
 
Multimedia support in WebKitGTK and WPE, current status and plans (GStreamer ...
Igalia
 
IoTivity Tutorial: Prototyping IoT Devices on GNU/Linux
Samsung Open Source Group
 
Open Source Internet of Things 101 – EclipseCon 2016
Benjamin Cabé
 
BKK16-105 HALs for LITE
Linaro
 
Iotivity atmel-20150328rzr
Phil www.rzr.online.fr
 
Reaching the multimedia web from embedded platforms with WPEWebkit
Igalia
 

Similar to Python for IoT, A return of experience (20)

PDF
Python in IoT: Powering Smart, Scalable Solutions
GrapesTech Solutions
 
PDF
Python for IoT: Building Smart Devices and Applications
priyanka rajput
 
PDF
Python for IoT Development: A Beginner-Friendly Approach
Shiv Technolabs Pvt. Ltd.
 
PDF
IoT Prototyping using BBB and Debian
Mender.io
 
PPT
Course Notes-Unit 5.ppt
SafaM3
 
PDF
Fundamental components of the Internet of Things unit 1.pdf
govindsingh258478
 
PDF
Elastic network of things with mqtt and micro python
Wei Lin
 
PDF
MQTT – protocol for yours IoT
Miroslav Resetar
 
PPTX
An assessment of internet of things protocols for constrain apps
Pokala Sai
 
PDF
Overview on Application protocols in Internet of Things
JIGAR MAKHIJA
 
PPTX
Python urllib
udhayakumarc1
 
PDF
Designing Internet of things
Mahdi Hosseini Moghaddam
 
PDF
Mqtt Essentials A Lightweight Iot Protocol Gaston Hillar
wasayhiltz
 
PPTX
IoT
Ananth Kumar
 
PDF
Physical Design of IoT.pdf
JoshuaKimmich1
 
PPTX
Null mumbai-iot-workshop
Nitesh Malviya
 
PDF
System design of multiprotocol iot
Dev Bhattacharya
 
PPTX
Nodemcu and IOT.pptx
DixonSunny2
 
PPTX
IoT PROTOCOLS AND SECURITY in Internet Of Things.pptx
FrankMollel3
 
PDF
IoT - Understanding internet of things
veerababu penugonda(Mr-IoT)
 
Python in IoT: Powering Smart, Scalable Solutions
GrapesTech Solutions
 
Python for IoT: Building Smart Devices and Applications
priyanka rajput
 
Python for IoT Development: A Beginner-Friendly Approach
Shiv Technolabs Pvt. Ltd.
 
IoT Prototyping using BBB and Debian
Mender.io
 
Course Notes-Unit 5.ppt
SafaM3
 
Fundamental components of the Internet of Things unit 1.pdf
govindsingh258478
 
Elastic network of things with mqtt and micro python
Wei Lin
 
MQTT – protocol for yours IoT
Miroslav Resetar
 
An assessment of internet of things protocols for constrain apps
Pokala Sai
 
Overview on Application protocols in Internet of Things
JIGAR MAKHIJA
 
Python urllib
udhayakumarc1
 
Designing Internet of things
Mahdi Hosseini Moghaddam
 
Mqtt Essentials A Lightweight Iot Protocol Gaston Hillar
wasayhiltz
 
Physical Design of IoT.pdf
JoshuaKimmich1
 
Null mumbai-iot-workshop
Nitesh Malviya
 
System design of multiprotocol iot
Dev Bhattacharya
 
Nodemcu and IOT.pptx
DixonSunny2
 
IoT PROTOCOLS AND SECURITY in Internet Of Things.pptx
FrankMollel3
 
IoT - Understanding internet of things
veerababu penugonda(Mr-IoT)
 
Ad

Recently uploaded (20)

PDF
“NPU IP Hardware Shaped Through Software and Use-case Analysis,” a Presentati...
Edge AI and Vision Alliance
 
PDF
The Rise of AI and IoT in Mobile App Tech.pdf
IMG Global Infotech
 
PDF
How do you fast track Agentic automation use cases discovery?
DianaGray10
 
PDF
Agentic AI lifecycle for Enterprise Hyper-Automation
Debmalya Biswas
 
PPTX
Designing_the_Future_AI_Driven_Product_Experiences_Across_Devices.pptx
presentifyai
 
PPTX
Agentforce World Tour Toronto '25 - MCP with MuleSoft
Alexandra N. Martinez
 
PDF
Newgen 2022-Forrester Newgen TEI_13 05 2022-The-Total-Economic-Impact-Newgen-...
darshakparmar
 
PPTX
Mastering ODC + Okta Configuration - Chennai OSUG
HathiMaryA
 
PPTX
COMPARISON OF RASTER ANALYSIS TOOLS OF QGIS AND ARCGIS
Sharanya Sarkar
 
PDF
Transcript: Book industry state of the nation 2025 - Tech Forum 2025
BookNet Canada
 
PPTX
Agentforce World Tour Toronto '25 - Supercharge MuleSoft Development with Mod...
Alexandra N. Martinez
 
PDF
“Squinting Vision Pipelines: Detecting and Correcting Errors in Vision Models...
Edge AI and Vision Alliance
 
PDF
Future-Proof or Fall Behind? 10 Tech Trends You Can’t Afford to Ignore in 2025
DIGITALCONFEX
 
PDF
[Newgen] NewgenONE Marvin Brochure 1.pdf
darshakparmar
 
PDF
SIZING YOUR AIR CONDITIONER---A PRACTICAL GUIDE.pdf
Muhammad Rizwan Akram
 
PDF
Bitcoin for Millennials podcast with Bram, Power Laws of Bitcoin
Stephen Perrenod
 
PPTX
From Sci-Fi to Reality: Exploring AI Evolution
Svetlana Meissner
 
PDF
Book industry state of the nation 2025 - Tech Forum 2025
BookNet Canada
 
PDF
What’s my job again? Slides from Mark Simos talk at 2025 Tampa BSides
Mark Simos
 
PPTX
The Project Compass - GDG on Campus MSIT
dscmsitkol
 
“NPU IP Hardware Shaped Through Software and Use-case Analysis,” a Presentati...
Edge AI and Vision Alliance
 
The Rise of AI and IoT in Mobile App Tech.pdf
IMG Global Infotech
 
How do you fast track Agentic automation use cases discovery?
DianaGray10
 
Agentic AI lifecycle for Enterprise Hyper-Automation
Debmalya Biswas
 
Designing_the_Future_AI_Driven_Product_Experiences_Across_Devices.pptx
presentifyai
 
Agentforce World Tour Toronto '25 - MCP with MuleSoft
Alexandra N. Martinez
 
Newgen 2022-Forrester Newgen TEI_13 05 2022-The-Total-Economic-Impact-Newgen-...
darshakparmar
 
Mastering ODC + Okta Configuration - Chennai OSUG
HathiMaryA
 
COMPARISON OF RASTER ANALYSIS TOOLS OF QGIS AND ARCGIS
Sharanya Sarkar
 
Transcript: Book industry state of the nation 2025 - Tech Forum 2025
BookNet Canada
 
Agentforce World Tour Toronto '25 - Supercharge MuleSoft Development with Mod...
Alexandra N. Martinez
 
“Squinting Vision Pipelines: Detecting and Correcting Errors in Vision Models...
Edge AI and Vision Alliance
 
Future-Proof or Fall Behind? 10 Tech Trends You Can’t Afford to Ignore in 2025
DIGITALCONFEX
 
[Newgen] NewgenONE Marvin Brochure 1.pdf
darshakparmar
 
SIZING YOUR AIR CONDITIONER---A PRACTICAL GUIDE.pdf
Muhammad Rizwan Akram
 
Bitcoin for Millennials podcast with Bram, Power Laws of Bitcoin
Stephen Perrenod
 
From Sci-Fi to Reality: Exploring AI Evolution
Svetlana Meissner
 
Book industry state of the nation 2025 - Tech Forum 2025
BookNet Canada
 
What’s my job again? Slides from Mark Simos talk at 2025 Tampa BSides
Mark Simos
 
The Project Compass - GDG on Campus MSIT
dscmsitkol
 
Ad

Python for IoT, A return of experience

  • 1. Python for IoT A return of experience Alexandre Abadie, Inria
  • 2. Outline What IoT are we talking about ? The usual protocols for IoT Pyaiot, connecting objects to the web How we built Pyaiot Lessons learned Conclusion
  • 3. What IoT are we talking about ? The Internet of Things today
  • 5. Low-end devices ⇒ adapted protocols are required
  • 6. Outline What IoT are we talking about ? ⇒ The usual protocols for IoT Pyaiot, connecting objects to the web How we built Pyaiot Lessons learned Conclusion
  • 7. Usual protocols for IoT: CoAP Core WG at IETF specifications (2010) RFC 7252 Similar to HTTP REST: GET/PUT/POST/DELETE + OBSERVE Works on UDP with small payload overhead More information at http://coap.technology/ source: https://fr.wikipedia.org/wiki/CoAP
  • 8. CoAP: available implementations in Python 3 available implementations: TxThings: Twisted based, Python 2 & 3 https://github.com/mwasilak/txThings Aiocoap: asyncio based, Python 3 only https://github.com/chrysn/aiocoap CoaPthon: Threading based, Python 2 & 3 https://github.com/Tanganelli/CoAPthon Implementations exist for other languages: http://coap.technology/impls.html
  • 9. Usual protocols for IoT: MQTT Based on publication/subscriptions to topics pattern Topics have a path form: this/is/a/topic MQTT v3.1.1 is an OASIS standard MQTT Sensor Network (MQTT-SN): adapted for constrained devices source: https://dev.to/kenwalger/overview-of-the-mqtt-protocol
  • 10. MQTT: available implementations in Python 2 available implementations: Paho-mqtt: threading based, considered as the reference implementation https://pypi.python.org/pypi/paho-mqtt HBMQTT: asyncio based https://github.com/beerfactory/hbmqtt
  • 11. Outline What IoT are we talking about ? The usual protocols for IoT ⇒ Pyaiot, connecting objects to the web How we built Pyaiot Lessons learned Conclusion
  • 12. Why Pyaiot? Need for a web application able to communicate with contrained devices ⇒ but constrained devices cannot use usual web protocols
  • 13. Why Pyaiot? Need for a web application able to communicate with contrained devices ⇒ but constrained devices cannot use usual web protocols Need for multi-site support ⇒ but constrained devices cannot be exposed directly to the web
  • 14. Why Pyaiot? Need for a web application able to communicate with contrained devices ⇒ but constrained devices cannot use usual web protocols Need for multi-site support ⇒ but constrained devices cannot be exposed directly to the web Heterogeneous protocol support ⇒ various IoT protocols exist
  • 15. General guidelines Open-Source and simple design⇒ can be deployed by anyone https://github.com/pyaiot/pyaiot
  • 16. General guidelines Open-Source and simple design⇒ can be deployed by anyone https://github.com/pyaiot/pyaiot Multiprotocol: CoAP, MQTT, etc ⇒ interoperability
  • 17. General guidelines Open-Source and simple design⇒ can be deployed by anyone https://github.com/pyaiot/pyaiot Multiprotocol: CoAP, MQTT, etc ⇒ interoperability Modular ⇒ extensible
  • 18. General guidelines Open-Source and simple design⇒ can be deployed by anyone https://github.com/pyaiot/pyaiot Multiprotocol: CoAP, MQTT, etc ⇒ interoperability Modular ⇒ extensible Bi-directionnal and real time access to nodes ⇒ reactive
  • 19. General guidelines Open-Source and simple design⇒ can be deployed by anyone https://github.com/pyaiot/pyaiot Multiprotocol: CoAP, MQTT, etc ⇒ interoperability Modular ⇒ extensible Bi-directionnal and real time access to nodes ⇒ reactive No constraint regarding the backend language ⇒ let's choose Python!
  • 20. General guidelines Open-Source and simple design⇒ can be deployed by anyone https://github.com/pyaiot/pyaiot Multiprotocol: CoAP, MQTT, etc ⇒ interoperability Modular ⇒ extensible Bi-directionnal and real time access to nodes ⇒ reactive No constraint regarding the backend language ⇒ let's choose Python! Pyaiot targets contrained nodes running RIOT: https://riot-os.org
  • 21. Pyaiot overview Permanent web showcase for RIOT available at http://riot-demo.inria.fr
  • 22. Pyaiot: The web dashboard
  • 23. Outline What IoT are we talking about ? The usual protocols for IoT Pyaiot, connecting objects to the web ⇒ How we built Pyaiot Lessons learned Conclusion
  • 25. Pyaiot services Gateways are clients running in private networks Nodes are kept isolated from Internet Messages exchanged in JSON format Works with low-end devices (RIOT) and high-end devices (Python)
  • 26. Technical choices Web dashboard developed with Vue.js   http://vuejs.org Service applications based on Tornado framework with: HTTP server Websocket server and client Aiocoap for CoAP protocol support HBMQTT for MQTT protocol support
  • 27. Technical choices Web dashboard developed with Vue.js   http://vuejs.org Service applications based on Tornado framework with: HTTP server Websocket server and client Aiocoap for CoAP protocol support HBMQTT for MQTT protocol support ⇒ All python packages are asyncio based/compatible ⇒ simplify integration
  • 28. The MQTT gateway in detail MQTT-SN is required for low-end device ⇒ a MQTT to MQTT-SN gateway/broker is required No implementation in Python ⇒ let's go for mosquitto.rsmb
  • 29. The MQTT gateway in detail MQTT-SN is required for low-end device ⇒ a MQTT to MQTT-SN gateway/broker is required No implementation in Python ⇒ let's go for mosquitto.rsmb Node/Gateway subscribe/publish to topic publish/subscribe to topics gateway//discover node/check node//resources node//
  • 30. Outline What IoT are we talking about ? The usual protocols for IoT Pyaiot, connecting objects to the web How we built Pyaiot ⇒ Lessons learned Conclusion
  • 31. Using asyncio Easy to read asynchronous programming language
  • 32. Using asyncio Easy to read asynchronous programming language Asyncio new syntax available with Python >= 3.5
  • 33. Using asyncio Easy to read asynchronous programming language Asyncio new syntax available with Python >= 3.5 ... but Python 3.4.2 available on Raspbian @asyncio.coroutine def my_coroutine(): my_long_call() yield from my_coroutine() # wait until done asyncio.get_event_loop().create_task(my_coroutine) # scheduled in ioloop asyncio.ensure_future(my_coroutine) # scheduled in ioloop, requires python 3.4.4
  • 34. Using asyncio Easy to read asynchronous programming language Asyncio new syntax available with Python >= 3.5 ... but Python 3.4.2 available on Raspbian @asyncio.coroutine def my_coroutine(): my_long_call() yield from my_coroutine() # wait until done asyncio.get_event_loop().create_task(my_coroutine) # scheduled in ioloop asyncio.ensure_future(my_coroutine) # scheduled in ioloop, requires python 3.4.4 with python 3.5 new syntax: async def my_coroutine(): my_long_call() await my_coroutine() # wait until done asyncio.ensure_future(my_coroutine) # scheduled in ioloop
  • 35. The benefits of Python Develop fast, even with complex things
  • 36. The benefits of Python Develop fast, even with complex things Can run on any high-end device : from a Raspberry PI to a Cloud server
  • 37. The benefits of Python Develop fast, even with complex things Can run on any high-end device : from a Raspberry PI to a Cloud server Off-the-shelf packages for IoT available: Aiocoap, HBMQTT
  • 38. The benefits of Python Develop fast, even with complex things Can run on any high-end device : from a Raspberry PI to a Cloud server Off-the-shelf packages for IoT available: Aiocoap, HBMQTT ⇒ Python is adapted to IoT
  • 39. Conclusion Widely used protocol in IoT is MQTT Adapted protocols are required for constrained devices (microcontrollers) ⇒ CoAP, MQTT-SN
  • 40. Conclusion Widely used protocol in IoT is MQTT Adapted protocols are required for constrained devices (microcontrollers) ⇒ CoAP, MQTT-SN We easily built an application following the initial requirements ⇒ Pyaiot: https://github.com/pyaiot/pyaiot
  • 41. Conclusion Widely used protocol in IoT is MQTT Adapted protocols are required for constrained devices (microcontrollers) ⇒ CoAP, MQTT-SN We easily built an application following the initial requirements ⇒ Pyaiot: https://github.com/pyaiot/pyaiot Asyncio made things simpler... after some headaches
  • 42. Conclusion Widely used protocol in IoT is MQTT Adapted protocols are required for constrained devices (microcontrollers) ⇒ CoAP, MQTT-SN We easily built an application following the initial requirements ⇒ Pyaiot: https://github.com/pyaiot/pyaiot Asyncio made things simpler... after some headaches Pyaiot is still work in progress... even if it works pretty well