All Projects → dersimn → owrtwifi2mqtt

dersimn / owrtwifi2mqtt

Licence: other
Using your OpenWRT Router's Wifi to detect if a person's smartphone is still in/near the apartment and publish via MQTT

Programming Languages

shell
77523 projects
javascript
184084 projects - #8 most used programming language

Projects that are alternatives of or similar to owrtwifi2mqtt

SenseoWifi
Wifi'ify the Senseo coffee maker. Circuit and firmware for an internal Senseo hack to monitor and control the daily coffee brew (via MQTT) ☕️📶
Stars: ✭ 73 (+4.29%)
Mutual labels:  openhab, openhab2, mqtt-smarthome
openhab-grafana
JavaScript utilities and examples for using Grafana with openHAB
Stars: ✭ 47 (-32.86%)
Mutual labels:  openhab, openhab2
nuimo-openhab-python
Use your Nuimo as a UI for openHAB!
Stars: ✭ 16 (-77.14%)
Mutual labels:  openhab, openhab2
Openwrt Pcap dnsproxy
Pcap_DNSProxy for OpenWrt/LEDE
Stars: ✭ 204 (+191.43%)
Mutual labels:  openwrt
Xfrp
xfrps&frp client for openwrt&LEDE
Stars: ✭ 205 (+192.86%)
Mutual labels:  openwrt
Drcom Gdut Hc5661a Openwrt
在Dr.COM下使用路由器上校园网WIFI(以广东工业大学、极路由1S HC5661A、OpenWrt为例)
Stars: ✭ 245 (+250%)
Mutual labels:  openwrt
NueXini Packages
Packages for OpenWrt【每日更新luci-app OpenWrt Packages】
Stars: ✭ 269 (+284.29%)
Mutual labels:  openwrt
Evmongoose
DEPRECATED. Evmongoose is an asynchronous, event(libev) based multi-protocol embedded networking library with functions including TCP, HTTP, WebSocket, MQTT and much more. It's based on mongoose and libev implementation and it's support Lua API.
Stars: ✭ 199 (+184.29%)
Mutual labels:  openwrt
ct-frontend
Frontend Demo for Cucumber Tony API
Stars: ✭ 20 (-71.43%)
Mutual labels:  openwrt
Ddns Scripts aliyun
OpenWrt/LEDE DDNS support for aliyun (阿里云)
Stars: ✭ 224 (+220%)
Mutual labels:  openwrt
Sierra Wireless Modems
EM7565/EM7455/MC7455 - Modem Configuration
Stars: ✭ 217 (+210%)
Mutual labels:  openwrt
Opkg Upgrade
List and install OpenWRT / LEDE opkg upgradable packages
Stars: ✭ 215 (+207.14%)
Mutual labels:  openwrt
Lede
Lean's OpenWrt source
Stars: ✭ 19,062 (+27131.43%)
Mutual labels:  openwrt
Lime Packages
OpenWrt packages composing LibreMesh meta-firmware for wireless mesh networking
Stars: ✭ 204 (+191.43%)
Mutual labels:  openwrt
wrt-hisicam
OpenWrt based HiSilicon`s System-On-a-Chip ip camera firmware
Stars: ✭ 21 (-70%)
Mutual labels:  openwrt
Luci Wrtbwmon
Bandwidth tracker for OpenWRT that uses wrtbwmon
Stars: ✭ 201 (+187.14%)
Mutual labels:  openwrt
homebridge-wifipresence
Detect presence in the room via wifi
Stars: ✭ 39 (-44.29%)
Mutual labels:  presence
Windowsspyblocker
WindowsSpyBlocker 🛡️ is an application written in Go and delivered as a single executable to block spying and tracking on Windows systems.
Stars: ✭ 2,913 (+4061.43%)
Mutual labels:  openwrt
Django Netjsonconfig
Configuration manager for embedded devices, implemented as a reusable django-app
Stars: ✭ 213 (+204.29%)
Mutual labels:  openwrt
Openwrt Trojan
trojan and its dependencies for OpenWrt
Stars: ✭ 236 (+237.14%)
Mutual labels:  openwrt

A simple shell script to detect presence of Wifi devices (smartphones, tablets, Amazon Dash Buttons, ..) and post the results via MQTT. This information can be processed in Homeautomation Systems like OpenHAB to turn down the heating when everyone left the appartment.

Installation

Install the MQTT client

Install the packages

  • mosquitto-client
  • coreutils-nohup

with either luci or opkg.

Get the script

Download

opkg update && opkg install libustream-openssl
wget -O /usr/bin/presence_report https://raw.githubusercontent.com/dersimn/owrtwifi2mqtt/master/presence_report && chmod u+x /usr/bin/presence_report

Copy with SCP

Use SCP to copy the presence_report script to /usr/bin/presence_report on the target device. Call chmod u+x /usr/bin/presence_report to allow script execution.

Add the script to rc.local

Place the following lines

nohup /usr/bin/presence_report event 192.168.1.2 >/dev/null 2>&1 &
nohup /usr/bin/presence_report lastseen 192.168.1.2 >/dev/null 2>&1 &

inside the /etc/rc.local file before the exit 0. You can to this via command-line or via LuCI in System -> Startup -> Local Startup. The script will be executed after reboot.

If you are running more than one OpenWRT Router and want to collect data from both, you can specify an own base topic for each with:

MQTT_BASETOPIC="owrtwifi2" nohup /usr/bin/presence_report event 192.168.1.2 >/dev/null 2>&1 &
MQTT_BASETOPIC="owrtwifi2" nohup /usr/bin/presence_report lastseen 192.168.1.2 >/dev/null 2>&1 &

ENV variables for configuration are:

  • MQTT_BASETOPIC: owrtwifi
  • MQTT_STATUS_TOPIC: $MQTT_BASETOPIC/status/mac-
  • MQTT_MAINTENANCE_TOPIC: $MQTT_BASETOPIC/maintenance
  • MQTT_USER
  • MQTT_PASSWORD
  • MQTT_ID: $MQTT_BASETOPIC

Usage

After installation the following topics will be published for each WiFi device, using the lowercase MAC address:

owrtwifi/status/mac-00-00-00-00-00-00/lastseen/iso8601

Payload contains the timestamp when the device was seen in an ISO 8601 (and OpenHAB) compatible format, like this: 2017-08-25T19:29:57+0200

owrtwifi/status/mac-00-00-00-00-00-00/lastseen/epoch

Unix epoch in seconds

owrtwifi/status/mac-00-00-00-00-00-00/event

Message will be new or del and is sent right after the device connected/disconnected to/from WiFi.

Additionally the DHCP name (if available) from /tmp/dhcp.leases will be published to

owrtwifi/status/mac-00-00-00-00-00-00/dhcp-name

Credits

Original idea and script from Jupiter "belikh" Belic. Suggestion to use iw event from Tom "tomdee" Denham, merging these two scripts into one for easier installation by afreof.
This script follows Oliver "owagner" Wagner's architectural proposal for an mqtt-smarthome.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].