Compare commits

..

No commits in common. "c693d30394f4a27ccf709897e014621c73e92f3c" and "43535d0a950a998d71d5683db0fa94d070f0ec2a" have entirely different histories.

4 changed files with 4 additions and 60 deletions

1
export/.gitignore vendored
View File

@ -23,4 +23,3 @@ yarn-debug.log*
yarn-error.log* yarn-error.log*
image.png image.png
data/

View File

@ -3,48 +3,17 @@ import time
from selenium import webdriver from selenium import webdriver
from selenium.webdriver.chrome.options import Options from selenium.webdriver.chrome.options import Options
from selenium.webdriver.common.by import By from selenium.webdriver.common.by import By
from selenium.webdriver.chrome.service import Service
from selenium.common.exceptions import NoSuchElementException
from webdriver_manager.chrome import ChromeDriverManager
ser = Service('/usr/lib/chromium-browser/chromedriver')
chrome_options = Options() chrome_options = Options()
chrome_options.add_argument('--headless') chrome_options.add_argument('--headless')
chrome_options.add_argument('start-maximized')
chrome_options.add_argument('--no-sandbox') chrome_options.add_argument('--no-sandbox')
driver = webdriver.Chrome(service=ser, options=chrome_options) driver = webdriver.Chrome('/usr/lib/chromium-browser/chromedriver', options=chrome_options)
driver.get('https://sensors.dns.t0.vc') driver.get('https://sensors.dns.t0.vc')
time.sleep(3) time.sleep(3)
driver.execute_script("return document.getElementsByClassName('menu')[0].remove();") element = driver.find_element(By.ID, 'Solar_Power')
graphs = [ with open('image.png', 'wb') as f:
'Solar_Power', f.write(element.screenshot_as_png)
'Living_Room_Air',
'Outside_Temperature',
'Bedroom_Temperature',
'Nook_Temperature',
'Misc_Temperature',
'Nook_Thermostat',
'Gas_Usage',
'Water_Usage',
'Living_Room_Lux',
]
for graph in graphs:
print('Capturing', graph, 'graph...')
try:
element = driver.find_element(By.ID, graph)
except NoSuchElementException:
print('Graph not found, skipping.')
continue
driver.execute_script('arguments[0].scrollIntoView({block: "center"});', element)
with open('/home/tanner/sensors/export/data/{}.png'.format(graph), 'wb') as f:
f.write(element.screenshot_as_png)
driver.close() driver.close()
print('done.')

View File

@ -1,24 +0,0 @@
async-generator==1.10
attrs==22.1.0
certifi==2022.6.15
cffi==1.15.1
charset-normalizer==3.1.0
cryptography==37.0.4
h11==0.13.0
idna==3.3
outcome==1.2.0
packaging==23.1
pycparser==2.21
pyOpenSSL==22.0.0
PySocks==1.7.1
python-dotenv==1.0.0
requests==2.28.2
selenium==4.8.3
sniffio==1.2.0
sortedcontainers==2.4.0
tqdm==4.65.0
trio==0.21.0
trio-websocket==0.9.2
urllib3==1.26.11
webdriver-manager==3.8.6
wsproto==1.1.0