Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- class ZoneController:
- def __init__(self, name, number, description, gpio, enabled, running, running_manually, mcp, notifications, sms, pb, email):
- self.zone_name = name
- self.zone_number = number
- self.description = description
- self.gpio = gpio
- self.enabled = enabled
- self.running = running
- self.running_manually = running_manually
- self.mcp = mcp
- self.notifications = notifications
- self.sms = sms
- self.pb = pb
- self.email = email
- @classmethod
- def read_config(cls, zone_name):
- with engine.begin() as conn:
- stmt = select([zones]).where(zones.c.zone_name.in_(zone_name))
- return [
- cls(
- name=row[zones.c.zone_name],
- number=row[zones.c.zone_number],
- description=row[zones.c.description],
- gpio=row[zones.c.gpio],
- enabled=row[zones.c.enabled],
- running=row[zones.c.running],
- running_manually=row[zones.c.running_manually],
- mcp=row[zones.c.mcp],
- notifications=row[zones.c.notifications],
- sms=row[zones.c.sms],
- pb=row[zones.c.pb],
- email=row[zones.c.email]
- )
- for row in conn.execute(stmt).fetchall()
- ]
Advertisement
Add Comment
Please, Sign In to add comment