This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from PyP100 import PyP110 | |
import json | |
from pprint import pprint | |
import pymongo | |
with open("/home/pi/.mongo_uri.txt") as f: | |
uri = f.readline().strip() | |
mongoclient = pymongo.MongoClient(uri) | |
tapoplugs = { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import aiohttp | |
import pysmartthings | |
import pymongo | |
import json | |
import asyncio | |
from pprint import pprint | |
import datetime | |
with open("/home/pi/.smartthing_token") as f: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from phue import Bridge | |
from pprint import pprint | |
import pymongo | |
b = Bridge("192.168.1.214") | |
# If the app is not registered and the button is not pressed, press the button and call connect() (this only needs to be run a single time) | |
b.connect() | |
# Get the bridge state (This returns the full dictionary that you can explore) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import requests | |
from pprint import pprint | |
import json | |
import pymongo | |
with open("/home/pi/.mongo_uri.txt") as f: | |
uri = f.readline().strip() | |
mongoclient = pymongo.MongoClient(uri) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[ | |
{$limit:1}, | |
{$set: { x : {$range:[-144,0]}, y : {$range:[-120,0]} }}, | |
{$unwind :"$x"}, | |
{$unwind: "$y"}, | |
{$set : { r: {$add: [{$divide:["$x",8000]},-0.73]}, i: {$add:[{$divide:["$y",8000]},0.15]}}}, | |
{$set : { c : { $reduce : { input: {$range:[0,300]}, initialValue : { r:0,i:0,it:0 }, in : | |
{ $cond : { if: { $lt:["$$value.r",4]}, then: { it:{$add:["$$value.it",1]}, | |
r: {$add:[{$subtract:[{$pow:["$$value.r",2]}, {$pow:["$$value.i",2]} ]},"$r"]}, | |
i: {$add: [{$multiply:[2,"$$value.r","$$value.i"]},"$i"]} } ,else: "$$value"}}}}}}, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
$let: { | |
vars: { | |
targetdoc: { | |
$max: { | |
$filter: { | |
input: "$location_lookup_targettemps", | |
cond: { | |
$gte: ["$$this.to", "$miltime"] | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
$set: { | |
miltime: { | |
$add: [{ | |
$minute: "$date" | |
}, { | |
$multiply: [{ | |
$hour: "$date" | |
}, 100] | |
}] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
$concat: ["Until ", { | |
$cond: [{ | |
$lt: ["$to", 1000] | |
}, "0", ""] | |
}, { | |
$toString: "$to" | |
}] | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
_id: ObjectId("6218cae28a77eb66ed8b372b"), | |
room: 'GamesRoom', | |
to: 900, | |
target: 17 | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[{ | |
$sort: { | |
date: -1 | |
} | |
}, { | |
$group: { | |
_id: "$location", | |
currentTemp: { | |
$first: "$temp" | |
} |