MD500_Pilot

Untitled

May 30th, 2021
1,074
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 1.43 KB | None | 0 0
  1. class ZoneController:
  2.     def __init__(self, name, number, description, gpio, enabled, running, running_manually, mcp, notifications, sms, pb, email):
  3.         self.zone_name = name
  4.         self.zone_number = number
  5.         self.description = description
  6.         self.gpio = gpio
  7.         self.enabled = enabled
  8.         self.running = running
  9.         self.running_manually = running_manually
  10.         self.mcp = mcp
  11.         self.notifications = notifications
  12.         self.sms = sms
  13.         self.pb = pb
  14.         self.email = email
  15.  
  16.  
  17.     @classmethod
  18.     def read_config(cls, zone_name):
  19.         with engine.begin() as conn:
  20.             stmt = select([zones]).where(zones.c.zone_name.in_(zone_name))
  21.             return [
  22.                 cls(
  23.                     name=row[zones.c.zone_name],
  24.                     number=row[zones.c.zone_number],
  25.                     description=row[zones.c.description],
  26.                     gpio=row[zones.c.gpio],
  27.                     enabled=row[zones.c.enabled],
  28.                     running=row[zones.c.running],
  29.                     running_manually=row[zones.c.running_manually],
  30.                     mcp=row[zones.c.mcp],
  31.                     notifications=row[zones.c.notifications],
  32.                     sms=row[zones.c.sms],
  33.                     pb=row[zones.c.pb],
  34.                     email=row[zones.c.email]
  35.                 )
  36.                 for row in conn.execute(stmt).fetchall()
  37.             ]
Advertisement
Add Comment
Please, Sign In to add comment