commit e2d00b9eb939e91cc37486160490588db4ad1535 Author: Gianluca Romito Date: Wed Feb 24 08:15:59 2021 +0100 primo commit diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..857dc64 --- /dev/null +++ b/.gitignore @@ -0,0 +1,58 @@ +# Byte-compiled / optimized / DLL files +__pycache__/ +*.py[cod] +*$py.class + +# OSX useful to ignore +*.DS_Store +.AppleDouble +.LSOverride + +# Thumbnails +._* + +# Files that might appear in the root of a volume +.DocumentRevisions-V100 +.fseventsd +.Spotlight-V100 +.TemporaryItems +.Trashes +.VolumeIcon.icns +.com.apple.timemachine.donotpresent + +# Directories potentially created on remote AFP share +.AppleDB +.AppleDesktop +Network Trash Folder +Temporary Items +.apdisk + +# C extensions +*.so + +# Distribution / packaging +.Python +env/ +build/ +develop-eggs/ +dist/ +downloads/ +eggs/ +.eggs/ +lib/ +lib64/ +parts/ +sdist/ +var/ +*.egg-info/ +.installed.cfg +*.egg + +# IntelliJ Idea family of suites +.idea +*.iml +## File-based project format: +*.ipr +*.iws +## mpeltonen/sbt-idea plugin +.idea_modules/ diff --git a/2021-02-24 08_14_43-ESP_Easy.png b/2021-02-24 08_14_43-ESP_Easy.png new file mode 100644 index 0000000..53ff20d Binary files /dev/null and b/2021-02-24 08_14_43-ESP_Easy.png differ diff --git a/README.md b/README.md new file mode 100644 index 0000000..23380fd --- /dev/null +++ b/README.md @@ -0,0 +1,17 @@ +Wwebhook per telecamera. Progetto fatto per Angelo. +in pratica tramite ESP8266 (easyesp) se uno preme un bottone, sul PC esce in primo piano una finestra che mostra una IP cam. + +Il sito con lo schema +https://community.blynk.cc/t/problem-using-physical-4-buttons-using-nodemcu-esp8266-to-switch-relays/36361/3 + +La schermata non sempre viene in primo piano. Per questo usare https://efotinis.neocities.org/deskpins/ +Sembra che opencv non gestisca correttamente questa cosa (fatto varie prove) + +Rule su ESP: +---------------------- +On Bottone#State=1 do + SendToHTTP 192.168.123.102,5000,/webhook + endon +---------------------- + +per la config di "bottone" vedi png. \ No newline at end of file diff --git a/app.py b/app.py new file mode 100644 index 0000000..a2024e0 --- /dev/null +++ b/app.py @@ -0,0 +1,42 @@ +import os +import cv2 +from flask import Flask, request, Response +import win32gui +import win32con + +finestra = 0 # per capire se la finestra รจ gia aperta... + +# http://webcam-garage.romito.net/videostream.cgi +# http://admin:admin@192.168.123.1/cgi-bin/videostream.cgi?user=admin&pwd=admin +# per l'always on top https://efotinis.neocities.org/deskpins/ + +#print("Before URL") + + + + +def openwebcam(): + global finestra + if finestra == 0: + finestra = 1 + cap = cv2.VideoCapture('http://admin:smart24@webcam-garage.romito.net/videostream.cgi') + WindowName="Main View" + ret, frame = cap.read() + cv2.imshow(WindowName,frame) + text_color = (0,0,0) + while True: + ret, frame = cap.read() + cv2.putText(frame, "Premi q per uscire", (20,15), cv2.FONT_HERSHEY_PLAIN, 1.0, text_color, thickness=2) + cv2.imshow(WindowName,frame) + if cv2.waitKey(1) & 0xFF == ord('q'): + break + + cap.release() + cv2.destroyAllWindows() + finestra = 0 + +app = Flask(__name__) + +@app.route('/webhook', methods=['GET']) +def respond(): + openwebcam() \ No newline at end of file diff --git a/button setup.png b/button setup.png new file mode 100644 index 0000000..0901d0a Binary files /dev/null and b/button setup.png differ