ActivityPub for Social IoT

Philippe Coval #ApConf2020

Sorry, your browser does not support SVG.

$ whois Phil Coval


  • Technology overview
  • Challenge:
    • how can IoT and Social web can interact
    • With privacy by design
  • Proofs of concept
  • Ideas

IoT from past…



  • UX: finger

IoT to present

  • From promises to reality:
    • Interoperability vs Silos ?
    • Privacy vs Security ?
  • Poor social interactions:
    • Home's devices are shared, though
      • among (privileged) users
      • through remotes or mobile apps

Ethical considerations

  • GDPR Article 25 conveys the key principles
    • privacy by design (& by default)
  • Opportunity for FLOSS projects:
    • Privacy is part of community's DNA
  • Challenge: Social+IoT with privacy
    • User and user's data centric
    • Decentralized and resilient

The Web as platform

  • WWW is transversal (URL+HTTP)
    • used to publish contents (HTML)
    • using a browser (runtime isolation)
      • Privacy features (and concerns)
    • Programmable
  • Social Web (2.0)
    • Link people (interactions, privacy matters)
  • Web Of Things (aka WoT)
    • Link devices (sensors, actuators)

The Fediverse

  • Use cases:
    • microbloging (mastodon, pleroma…)
    • media, music, video (peertube)
  • Decentralized architecture:
    • Federation is more ethical than
      • concentration of data or/and power
  • Use ActivityPub protocol (C/S+S/S APIs)
    • based on ActivityStreams' semantics

Web Of Things (WoT)



  • Mozilla IoT smart-home platform
    • with privacy by design
    • inspired by W3C WebOfThings (WoT)
  • Framework to build webthings (REST API)
    • Mozilla IoT schema (in JSON)
    • JS (Node or IoT.js), Python, Rust, C++…
  • Mozilla WebThings gateway
    • UI to control webthings from browser
    • Support addons

IoT meets social Web

  • Privacy By Design chalenges
    • Avoid data collection from outside (cloud)
      • like on social web ?
  • Data should stay home by default
    • Never go to cloud !
    • Remote control (per user)
  • User decide what goes out (not operator)
    • Only post "alert events" to Fediverse

Actuator demo


Mastodon from MCU

Fediverse WebThing

  • Then, Made a proxy to translate REST APIs:
    • from Mastodon (/statuses)
    • to WebThing (/properties/message)
  • Mastodon WebThing is a http server
    • powered by IoT.js JavaScript runtime
  • uses webthing-iotjs (JS module):

WebThings REST API

$ make -C mastodon-lite/example/webthing/ start
$ curl -s  http://localhost:8888/
{ ... 
  "properties": {
    "message": {
      "type": "string",
      "links": [ { ...
          "href": "/properties/message"
$ curl -s  http://localhost:8888/properties
{ "message": "<p>#AfConf2020 : #IoT meets #SocialWeb.</p>" }
$ curl -H "Content-Type: application/json" \
  -X PUT --data '{"message": "ping" }' \

WebThings' rules


Services as WebThings

  • No benefit to host ActivityPub device on MCU
    • Needless consumption for online services
    • Retarget to gateway's host: OK
  • WebThings Device limitation:
    • Needs to generate app token before
    • hardcoding creds in firmware
  • Or Rewrite as WebThing's Addon
    • To configure from browser

Gateway Add-ons

  • Adapters for other protocols:
    • ZigBee, ZWave, BLE
  • Plus mass products or DiY or web services
  • Currently 130 addons and growing community
  • API: Node.js, Python, RUST? …

ActivityPub Addon

  • Install package from addon repository
  • Configure credential from WebApp
  • Control as standalone WebThing
    • Actuator: Web Widget to set actuator value
    • Sensor: Listen to Mastodon's "timelines/home"
  • Automation using (limited) Rule engine
  • + properties "Follower" addon
    • from sensor input (latest status)
    • to actuator's LED matrix (sense hat for RPi)
    • Status: Work in progress

ActivityPub Adapter

📺 📺 📺

Contribs welcome


  • The WWW is decentralized and extensible
    • For social interactions using the Fediverse
    • For IoT devices using WoT
  • Mozilla WebThings SmartHome platform
    • can connect home devices in safe way
    • can also interact with online services
  • Install "ActivityPub addon" on Gateway:
    • Use Mastodon as a WebThing (RW)


Q&A, Thanks

Video Playback:


Created by Philippe Coval