Coder Social home page Coder Social logo

fw-monitor-control's Introduction

monitor-control.py

Funktion

Schaltet per Taster oder HTTP Request den Monitor in der Fahrzeughalle an oder aus.

Einrichtung: Skript als Service in Raspberry Pi OS ausführen

Voraussetzungen

  • Der Fernseher muss immer vor der Stromversorgung an den Raspberry Pi angeschlossen werden.
  • Alle HDMI-CEC-Steueroptionen müssen am Fernseher aktiviert sein.
  • In den Sperr-Optionen des Fernsehers sollten über den Hotel-Modus alle Eingangsquellen, außer der FF-Agent Monitor, gesperrt werden (Standard Passwort zum entsperren: 0000).
    (Das ist wichtig, um zu gewährleisten, dass nach einem Neustart aller Systeme die richtige Quelle im Fernseher gewählt ist.)

Funktionierende Umgebung

  • Raspberry Pi OS 10 (buster) auf einem Pi Zero W
  • Python 3.7
  • python-cec 0.2.8

Installation

  1. Python Modul python-cec mit Abhängigkeiten installieren:

    sudo apt install libcec-dev build-essential python3-dev && pip3 install cec
    
  2. Repository nach /usr/bin klonen:

    sudo git clone https://github.com/gersko/fw-monitor-control /usr/bin/fw-monitor-control
    
  3. Service erstellen:

    sudo nano /lib/systemd/system/monitor-control.service
    

    Inhalt von monitor-control.service:

    [Unit]
    Description=Monitor Control
    
    [Service]
    Type=simple
    ExecStart=/usr/bin/python3 /usr/bin/fw-monitor-control/monitor-control.py
    User=pi
    
    [Install]
    WantedBy=multi-user.target
    
  4. Systemctl Daemon aktualisieren:

    sudo systemctl daemon-reload
    
  5. Service aktivieren:

    sudo systemctl enable monitor-control
    
  6. Service starten:

    sudo systemctl start monitor-control
    
  7. HDMI Hotplug aktivieren:
    Dazu folgende Zeile in /boot/config.txt entkommentieren:

    hdmi_force_hotplug=1
    

Bedienung

Monitor per Taster steuern

Um den Monitor an-/auszuschalten zieht man, bei Verwendung eines Pi Zeros, mit dem Taster GPIO 18 auf GND. Wenn ein anderes Board verwendet wird, muss evtl. der GPIO Pin im Skript angepasst werden.

Monitor per HTTP Request steuern

Der Monitor ebenso über folgende HTTP Requests gesteuert werden:

Monitor anschalten:

   GET http://<ip-address>:8080/monitor?turn=on

Monitor ausschalten:

   GET http://<ip-address>:8080/monitor?turn=off

Monitor Status abfragen:

   GET http://<ip-address>:8080/monitor?state

Troubleshooting Hilfe: Der cec-client

Der cec-client ist Teil von cec-utils, einer Library, mit der CEC-fähige Monitore/Fernseher gesteuert werden können.

Installation von cec-utils:

sudo apt install cec-utils

Eine Auswahl von wichtigen Befehlen:

Aktion Befehl
An echo on 0 | cec-client -s -d 1
Aus echo standby 0 | cec-client -s -d 1
Bildschirm Status echo pow 0 | cec-client -s -d 1
Nach verfügbaren Geräten suchen echo scan | cec-client -s -d 1
Alle Befehle anzeigen echo h | cec-client -s -d 1

fw-monitor-control's People

Contributors

gersko avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.