From 132addb162e0acb09a9edb11469b5d3c603dc9e9 Mon Sep 17 00:00:00 2001 From: Mark Cotton Date: Wed, 9 Aug 2023 14:16:13 -0600 Subject: [PATCH] Removing Jupyter playground from repo --- Playground.ipynb | 395 ----------------------------------------------- 1 file changed, 395 deletions(-) delete mode 100644 Playground.ipynb diff --git a/Playground.ipynb b/Playground.ipynb deleted file mode 100644 index 11d5e44..0000000 --- a/Playground.ipynb +++ /dev/null @@ -1,395 +0,0 @@ -{ - "cells": [ - { - "cell_type": "markdown", - "id": "d4582341", - "metadata": {}, - "source": [ - "# EagleEyev3 Playground\n", - "\n", - "To make this playground work, it is easier to read the `access_token` off the filesystem but you can always run the example server `python server.py` to go thorugh the Oauth2 flow. By default it will save the `access_token` into a file named `.lazy_login`. The module looks for that file and tries reading t" - ] - }, - { - "cell_type": "markdown", - "id": "8355d241", - "metadata": {}, - "source": [ - "## Import Module" - ] - }, - { - "cell_type": "code", - "execution_count": 1, - "id": "1394471a", - "metadata": {}, - "outputs": [ - { - "name": "stderr", - "output_type": "stream", - "text": [ - "INFO:root:Using EagleEyev3 version 0.0.4\n" - ] - } - ], - "source": [ - "from EagleEyev3 import *\n", - "from settings import config\n", - "\n", - "logging.info(f\"Using EagleEyev3 version {EagleEyev3.__version__}\")" - ] - }, - { - "cell_type": "code", - "execution_count": 2, - "id": "486a2537", - "metadata": {}, - "outputs": [], - "source": [ - "een = EagleEyev3(config)" - ] - }, - { - "cell_type": "markdown", - "id": "51b8b66e", - "metadata": {}, - "source": [ - "## Adjust Log Level" - ] - }, - { - "cell_type": "code", - "execution_count": 3, - "id": "06d91db2", - "metadata": {}, - "outputs": [], - "source": [ - "import logging\n", - "logger = logging.getLogger()\n", - "#logger.setLevel('DEBUG')\n", - "#logger.setLevel('INFO')\n", - "logger.setLevel('WARN')\n", - "#logger.setLevel('ERROR')\n", - "#logger.setLevel('CRITICAL')" - ] - }, - { - "cell_type": "markdown", - "id": "0311109c-869c-4190-97c1-a6e717a8eeba", - "metadata": {}, - "source": [ - "## Who am I" - ] - }, - { - "cell_type": "code", - "execution_count": 8, - "id": "8d40a4e4", - "metadata": {}, - "outputs": [], - "source": [ - "een.access_token = \"eyJraWQiOiI2ODYxYjBjYS0wZjI2LTExZWQtODYxZC0wMjQyYWMxMjAwMDIiLCJ0eXAiOiJKV1QiLCJhbGciOiJSUzI1NiJ9.eyJzdWIiOiJjYWZlZGVmMiIsImF1ZCI6InZtcy5hcGkiLCJpc3MiOiJ2bXMuYXV0aC52MSIsInZtc19hY2NvdW50IjoiMDAwMjgyMDEiLCJleHAiOjE2OTA0MzM2MDMsImlhdCI6MTY4OTgyODgwMywianRpIjoiMTIzYmYwZmVmMDk0MDFlZmM0MWYxODhjODVhMGY3MTAiLCJjbGllbnRfaWQiOiIzMmRhYzMzMDY0OWI0ODI3OWY5Y2FjYzJiNmY1N2FlNSIsInZtc19jbHVzdGVyIjoiYzAxMiJ9.O3vQ4B8jRmxKIfTUzMWKVhTCecsyG3J5ARR1yrYDjero3cor1cMyVTdaUwn_pe_vWAVL4je3H2NY0nNlMHIBDbVzfIa8LqPzWfawylQN4-258gixeyjWw1vRUf99hrQXEBa4cTUvi_p7bzyARt8EPOnDczfyAx31r5z3Rt6l21kAe0uCuzCZ4W7VhbWLD9tPADBRnKb6fiS_ZA6U9DpMMWXwT1hnEBklbKOUlsi30r9AQNFGVcL_159OTde0K031LHnyRPv3LnRyXzjZpkaY9zsR--1hq_nCgNipdk42R0rePCF-hw-J0oGpj-vAsHqKadkHgy6cKsqMoE1am1kuKQ\"" - ] - }, - { - "cell_type": "code", - "execution_count": 11, - "id": "543dae39", - "metadata": {}, - "outputs": [ - { - "data": { - "text/plain": [ - "{'success': True,\n", - " 'response_http_status': 200,\n", - " 'data': {'httpsBaseUrl': {'hostname': 'api.c012.eagleeyenetworks.com',\n", - " 'port': 443}}}" - ] - }, - "execution_count": 11, - "metadata": {}, - "output_type": "execute_result" - } - ], - "source": [ - "een.get_base_url(cascade=True)" - ] - }, - { - "cell_type": "code", - "execution_count": 12, - "id": "e14e2be5-a5f9-4b8c-ae60-76c61cb61b8b", - "metadata": {}, - "outputs": [ - { - "data": { - "text/plain": [ - "'Mark Cotton - mcotton@mcottondesign.com'" - ] - }, - "execution_count": 12, - "metadata": {}, - "output_type": "execute_result" - } - ], - "source": [ - "f\"{een.current_user['firstName']} {een.current_user['lastName']} - {een.current_user['email']}\"" - ] - }, - { - "cell_type": "code", - "execution_count": 13, - "id": "4ef47ae2-a010-4b7e-87f6-3dbf0a047e16", - "metadata": {}, - "outputs": [ - { - "data": { - "text/plain": [ - "'eyJraWQiOiI2ODYxYjBjYS0wZjI2LTExZWQtODYxZC0wMjQyYWMxMjAwMDIiLCJ0eXAiOiJKV1QiLCJhbGciOiJSUzI1NiJ9.eyJzdWIiOiJjYWZlZGVmMiIsImF1ZCI6InZtcy5hcGkiLCJpc3MiOiJ2bXMuYXV0aC52MSIsInZtc19hY2NvdW50IjoiMDAwMjgyMDEiLCJleHAiOjE2OTA0MzM2MDMsImlhdCI6MTY4OTgyODgwMywianRpIjoiMTIzYmYwZmVmMDk0MDFlZmM0MWYxODhjODVhMGY3MTAiLCJjbGllbnRfaWQiOiIzMmRhYzMzMDY0OWI0ODI3OWY5Y2FjYzJiNmY1N2FlNSIsInZtc19jbHVzdGVyIjoiYzAxMiJ9.O3vQ4B8jRmxKIfTUzMWKVhTCecsyG3J5ARR1yrYDjero3cor1cMyVTdaUwn_pe_vWAVL4je3H2NY0nNlMHIBDbVzfIa8LqPzWfawylQN4-258gixeyjWw1vRUf99hrQXEBa4cTUvi_p7bzyARt8EPOnDczfyAx31r5z3Rt6l21kAe0uCuzCZ4W7VhbWLD9tPADBRnKb6fiS_ZA6U9DpMMWXwT1hnEBklbKOUlsi30r9AQNFGVcL_159OTde0K031LHnyRPv3LnRyXzjZpkaY9zsR--1hq_nCgNipdk42R0rePCF-hw-J0oGpj-vAsHqKadkHgy6cKsqMoE1am1kuKQ'" - ] - }, - "execution_count": 13, - "metadata": {}, - "output_type": "execute_result" - } - ], - "source": [ - "een.access_token" - ] - }, - { - "cell_type": "markdown", - "id": "a22ff6c2", - "metadata": {}, - "source": [ - "## Get Cameras" - ] - }, - { - "cell_type": "code", - "execution_count": 14, - "id": "bb457850", - "metadata": {}, - "outputs": [], - "source": [ - "ret = een.get_list_of_cameras()" - ] - }, - { - "cell_type": "code", - "execution_count": 15, - "id": "c43f1db1", - "metadata": {}, - "outputs": [ - { - "data": { - "text/plain": [ - "[✅ [1001423e] - ATM & Wine,\n", - " ✅ [10090759] - Benny Camera,\n", - " ✅ [100d8666] - Cash Register,\n", - " ✅ [1002f1d0] - FR test,\n", - " ✅ [10012735] - Fuel Dock,\n", - " ✅ [100b7b3b] - Max Camera,\n", - " ✅ [10009a85] - R2D2,\n", - " ✅ [1002584c] - Safe]" - ] - }, - "execution_count": 15, - "metadata": {}, - "output_type": "execute_result" - } - ], - "source": [ - "[i for i in een.cameras if i.is_online()]" - ] - }, - { - "cell_type": "code", - "execution_count": 16, - "id": "f4c6fe67", - "metadata": {}, - "outputs": [ - { - "data": { - "text/plain": [ - "[]" - ] - }, - "execution_count": 16, - "metadata": {}, - "output_type": "execute_result" - } - ], - "source": [ - "[i for i in een.cameras if not i.is_online()]" - ] - }, - { - "cell_type": "markdown", - "id": "8c140aaf-766f-4255-94ef-199d17cbc7a6", - "metadata": {}, - "source": [ - "## Getting list of Events" - ] - }, - { - "cell_type": "code", - "execution_count": 17, - "id": "74e78ee1-33b8-4a88-9d23-cd6281603a5b", - "metadata": {}, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "2023-07-20T00:32:07.243-05:00 2023-07-19T18:32:07.243-05:00\n" - ] - } - ], - "source": [ - "print(een.time_now(), een.time_before())" - ] - }, - { - "cell_type": "code", - "execution_count": 18, - "id": "c84c30dd-4b7c-415b-8e6f-e77de70d1924", - "metadata": { - "scrolled": true - }, - "outputs": [], - "source": [ - "for i in range(0,4):\n", - " ts = een.time_now()\n", - "\n", - " for cam in een.cameras:\n", - " blah = cam.get_list_of_events(end_timestamp=een.time_before(ts=ts, hours=(6*i)), \\\n", - " start_timestamp=een.time_before(ts=ts, hours=(6*(i+1))) )" - ] - }, - { - "cell_type": "code", - "execution_count": 19, - "id": "13809cc7-9ec2-4e15-9495-e64feaecca6d", - "metadata": {}, - "outputs": [ - { - "data": { - "text/plain": [ - "5" - ] - }, - "execution_count": 19, - "metadata": {}, - "output_type": "execute_result" - } - ], - "source": [ - "len(een.cameras[2].events['status'])" - ] - }, - { - "cell_type": "code", - "execution_count": 20, - "id": "67d4f79b-2b43-4bdb-9068-28ac9d8d921c", - "metadata": {}, - "outputs": [ - { - "data": { - "text/plain": [ - "0" - ] - }, - "execution_count": 20, - "metadata": {}, - "output_type": "execute_result" - } - ], - "source": [ - "len(een.cameras[0].events['motion'])" - ] - }, - { - "cell_type": "code", - "execution_count": 25, - "id": "c7513a23", - "metadata": {}, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "[1008d090] Benny Camera [10090759]\n", - "[1008d090] FR test [1002f1d0]\n", - "[1008d090] Max Camera [100b7b3b]\n", - "[1008d090] R2D2 [10009a85]\n" - ] - } - ], - "source": [ - "for cam in [i for i in een.cameras if i.bridge_id]:\n", - " print(f\"[{cam.bridge_id}] {cam.name} [{cam.id}]\")" - ] - }, - { - "cell_type": "code", - "execution_count": 22, - "id": "8be8d503-b46d-4ba7-884e-2c21c3987129", - "metadata": {}, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "FR test - 2023-07-20T01:22:47.515+00:00 - bridgeOffline \n", - "FR test - 2023-07-19T23:32:08.348+00:00 - online \n", - "R2D2 - 2023-07-19T19:38:42.286+00:00 - bridgeOffline \n", - "R2D2 - 2023-07-19T17:32:10.875+00:00 - online \n" - ] - } - ], - "source": [ - "for cam in [i for i in een.cameras if i.bridge_id]:\n", - " for i in cam.events['status']:\n", - " print(f\"{cam.name} - {i['startTimestamp']} - {i['data'][0]['newStatus']['connectionStatus']} \")" - ] - }, - { - "cell_type": "code", - "execution_count": null, - "id": "1cebbb4e-4c4e-4ab0-9627-251eb812b2f1", - "metadata": {}, - "outputs": [], - "source": [] - }, - { - "cell_type": "code", - "execution_count": null, - "id": "d8a69185-54cc-4c74-9c9b-a807e601be83", - "metadata": {}, - "outputs": [], - "source": [] - } - ], - "metadata": { - "kernelspec": { - "display_name": "Python 3 (ipykernel)", - "language": "python", - "name": "python3" - }, - "language_info": { - "codemirror_mode": { - "name": "ipython", - "version": 3 - }, - "file_extension": ".py", - "mimetype": "text/x-python", - "name": "python", - "nbconvert_exporter": "python", - "pygments_lexer": "ipython3", - "version": "3.11.3" - } - }, - "nbformat": 4, - "nbformat_minor": 5 -}