๐Ÿ“ฆ dsymonds / plugmon

SmartPlug monitoring

โ˜… 1 stars โ‘‚ 0 forks ๐Ÿ‘ 1 watching
monitoringprometheus-exportersmartplug
๐Ÿ“ฅ Clone https://github.com/dsymonds/plugmon.git
HTTPS git clone https://github.com/dsymonds/plugmon.git
SSH git clone git@github.com:dsymonds/plugmon.git
CLI gh repo clone dsymonds/plugmon
David Symonds David Symonds Move discovery response to an exported type. 4f627a0 8 years ago ๐Ÿ“ History
๐Ÿ“‚ master View all commits โ†’
๐Ÿ“ inplug
๐Ÿ“„ ping.go
๐Ÿ“„ README.md
๐Ÿ“„ README.md

Plugmon

This is a monitoring exporter for a smart plug I own.

It works with the Watts Clever INPLUG, and exports data for use by Prometheus.

The protocol

Here are some notes about the protocol that I have reverse engineered so far.

(https://github.com/Diagonactic/Ankuoo was a good starting point.)

It operates using a custom protocol via UDP on port 80. My best guess why they use that port for a non-HTTP protocol is to make it more likely to get past firewalls.

If you send a broadcast UDP message with 48 bytes that look like this:

// These first 32 bytes will be echoed back.
	0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
	0x0a, 0x00, 0x00, 0x00, 0xe1, 0x07, 0x05, 0x0c,
	0x01, 0x06, 0x1d, 0x04, 0x00, 0x00, 0x00, 0x00,
	10, 0, 0, 2,  // your local IP
	portLo, portHi,  // your local UDP port, little endian
	0x00, 0x00,

	// dunno what the rest is for
	0x8c, 0xc1, 0x00, 0x00, 0x00, 0x00,
	0x06, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,

then INPLUGs on the network will respond back. See ping.go for some initial work on decoding that.