Tag Archives: raspberry pi

streaming from a raspberry-pi picamera to homeassistant

rpi

raspivid -rot 180 -t 0 -n --width 640 --height 480 -o - | cvlc stream:///dev/stdin --sout '#standard{access=http,mux=ts,dst=:8090}' :demux=h264

home assistant

camera:
 - platform: ffmpeg
   input: http://192.168.0.145:8090

You will need to install vlc-nox in the rpi, in single cpu version it really slow, do it before you go to sleep.

Un petit script python qui m’envoie des mails quand le RER est malade

Un petit script tout moche python qui m’envoie des mails quand le RER est malade, lancé avec une crontab aux horaires qui m’intéressent, et voilà!

#!/usr/bin/python
# -*- coding: utf-8 -*-

import time
now = time.ctime()


# RATP API part
## c'est la partie magique, merci Pierre!
import requests
r = requests.get("http://api-ratp.pierre-grimaud.fr/data/trafic/rer")
data = r.text
print(data)

import json
parsed_json = json.loads(data)
if parsed_json["trafic"] == "perturbation":
  print(parsed_json["perturbations"])
  mailbody = parsed_json["perturbations"]

  ## mail part
  import subprocess
  import smtplib
  import email.utils
  from email.mime.text import MIMEText

  recipients = "qqn@mail.com,joe@example.net"
  # Create the message
  msg = MIMEText(str(mailbody))
  msg['To'] = recipients
  msg['From'] = "noreply-rapt@whateversnmpworkshere.fr"
  msg['Subject'] = "RERB status -- " + now

  server = smtplib.SMTP('smtp.example.net')
  log = server.set_debuglevel(True) # show communication with the server
  try:
      server.sendmail(msg["From"], msg["To"].split(","), msg.as_string())
  finally:
      server.quit()
  #print(log)

installing #salt-minion on a #raspberrypi


vim /etc/apt/sources.list

add this repository:

deb http://debian.saltstack.com/debian wheezy-saltstack main


wget -O - http://debian.saltstack.com/debian-salt-team-joehealy.gpg.key|apt-key add -
apt-get update
apt-cache policy salt-minion
apt-get install salt-minion

et voilà!

ffmeg with #HEVC support on the #raspberrypi

as root:
* add deb-multimedia repository “deb http://www.deb-multimedia.org/ testing main non-free
howto here
* apt-get install libsdl1.2-dev libfaac-dev libx264-dev (libs, codecs and stuff)
* apt-get install mercurial cmake cmake-curses-gui build-essential yasm (tools to retrieve & build ffmpeg)

as user:
* hg clone https://bitbucket.org/multicoreware/x265
* cd x265/build/linux

./make-Makefiles.bash
make

as root:

make install

git clone git://git.videolan.org/ffmpeg.git (you need to have git installed)
cd ffmpeg
./configure –enable-libfaac –enable-libx264 –enable-gpl –enable-nonfree –enable-libx265 –enable-ffplay –enable-pic
make
make install