- Punto de partida
- Una Raspberry pi con raspbian y PHP
- Jeedom
- Cuenta de pushetta
- Procedimiento
- Se usa el plugin Script, creando un nuevo elemento de tipo script que contendrá un pequeño codigo php para el envío del mensaje:
$channel = 'AQUI EL NOMBRE DE CANAL DE PUSHETTA';
$apikey = 'AQUI LA API KEY DE PUSHETTA';
$message = 'Puerta abierta';
$data = array(
'body' => $message,
'message_type' => 'text/plain');
$ch = curl_init("http://api.pushetta.com/api/pushes/$channel/");
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($data));
curl_setopt($ch, CURLOPT_HTTPHEADER, array('Content-Type: application/json', "Authorization: Token $apikey"));
curl_exec($ch);
?>
No hay comentarios:
Publicar un comentario