Skip to content

Commit

Permalink
Add script to ATVMonitor
Browse files Browse the repository at this point in the history
  • Loading branch information
bbdoc committed Dec 7, 2022
1 parent 469de69 commit 5a1c927
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
2 changes: 1 addition & 1 deletion wh_receiver/sql/tables.sql
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ CREATE TABLE IF NOT EXISTS `ATVMonitor` (
`deviceName` varchar(50) COLLATE utf8mb4_unicode_ci NOT NULL,
`issue` varchar(100) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
`action` varchar(100) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
PRIMARY KEY (`deviceName`)
`script` varchar(100) COLLATE utf8mb4_unicode_ci DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

CREATE TABLE IF NOT EXISTS `version` (
Expand Down
7 changes: 4 additions & 3 deletions wh_receiver/start_whreceiver.py
Original file line number Diff line number Diff line change
Expand Up @@ -91,13 +91,14 @@ def webhook():
deviceName = validate_string(request.json["deviceName"])
issue = validate_string(request.json["issue"])
action = validate_string(request.json["action"])
script = validate_string(request.json["script"])

insert_stmt_monitor = (
"INSERT INTO ATVMonitor (timestamp, deviceName, issue, action)"
"VALUES ( %s, %s, %s, %s )"
"INSERT INTO ATVMonitor (timestamp, deviceName, issue, action, script)"
"VALUES ( %s, %s, %s, %s, %s )"
)

data_monitor = ( str(timestamp), str(deviceName), str(issue), str(action) )
data_monitor = ( str(timestamp), str(deviceName), str(issue), str(action), str(script) )

try:
connection_object = connection_pool.get_connection()
Expand Down

0 comments on commit 5a1c927

Please sign in to comment.