Selenium Script for ADT Pulse

Posted on
Sat Jul 25, 2020 11:34 am
ryanbuckner offline
Posts: 1080
Joined: Oct 08, 2011
Location: Northern Virginia

Selenium Script for ADT Pulse

Since there's no open API for ADT Pulse, I wrote a short Selenium script to disarm my alarm each morning. It's flawed, I know, butI thought I'd share in case someone wants to improve it with error handling and better security:

Note: you'll need to download the chrome selenium webdriver exe and place it in the path you declare below

Code: Select all
from selenium import webdriver
from selenium.webdriver.common.by import By
import time

boolSuccess = False
strSuccessMsg = ""
pulseUrl = 'https://portal.adtpulse.com/myhome/17.0.0-71/summary/summary.jsp'
usr = 'xxxxxx@gmail.com'
pwd = 'xxxxxxx'


# indigo.variable.updateValue(1788108465, value="False")

# path to the Chrome webdriver
driver = webdriver.Chrome(executable_path='/Library/Application Support/Perceptive Automation/Python2-includes/chromedriver')
driver.get(pulseUrl);
time.sleep(5)  # Let the user actually see something!

# Login
login_box = driver.find_element_by_name('usernameForm')
login_box.send_keys(usr)

# Login
pwd_box = driver.find_element_by_name('passwordForm')
pwd_box.send_keys(pwd)

# Password
submit_ = driver.find_element_by_name("signin")
submit_.click()
time.sleep(5)

indigo.server.log("logged in")

# click the Disarm button if it exists
messages = driver.find_elements_by_class_name("p_boldNormalTextLarge");
for x in messages:
    if (x.text.split()[0] == "Armed"):
        indigo.server.log("logged in. disarming...")
        driver.find_element_by_id("security_button_0").click()
        strSuccessMsg = "Disarm button pressed"
        boolSuccess = True
        break
    elif (x.text.split()[0] == "Disarmed."):
        #indigo.server.log("Alarm is disarmed. arming...")
        strSuccessMsg = "Alarm is already disarmed"
        # use this space to arm in future
    else:
        strSuccessMsg = "Message: " + x.text
        boolSuccess = False

time.sleep(5)

indigo.server.log(strSuccessMsg)

driver.close()  # close the focus window


Page 1 of 1

Who is online

Users browsing this forum: No registered users and 6 guests