Skip to content

Instantly share code, notes, and snippets.

View elvenpath's full-sized avatar

Vlad Jula-Nedelcu elvenpath

  • MFQ Media
  • Bucharest
View GitHub Profile
blueprint:
name: Offline detection for Z2M devices with last_seen
description: Regularly test all sensors with 'lqi' unit of measurement (linkquality Z2M sensors) to detect
offline and if so execute an action.
domain: automation
input:
hours:
name: Hours not seen
description: Sensors not seen this amount of time are assumed to be offline.
default: 24
<?php
$files = array_slice($argv, 1);
foreach ($files as $file) {
$picture = file_get_contents($file);
$size = getimagesize($file);
// base64 encode the binary data, then break it into chunks according to RFC 2045 semantics
$base64 = chunk_split(base64_encode($picture));