from flask_restful import Resource
from ..devices import PowerPlug, HueLamp
from ..sensors import State


class Party(Resource):

    actions = {
        "plugs": {
            "default": True,
            "title": "Turn plugs on",
            "config": {
                "plug-ids": ["main-lamp", "plasma-lamp", "starwars-lamp", "desk"]
            }
        },
        "hue": {
            "default": True,
            "title": "Turn Hue on",
            "config": {
                "ids": [1]
            }
        }
    }

    def get(self):
        return self.actions

    def put(self):
        print("=== PARTY ===")

        State().put("party")

        # PLUGS ON
        for plug in self.actions["plugs"]["config"]["plug-ids"]:
            PowerPlug().put(plug, "on")

        # HUE ON
        for id in self.actions["hue"]["config"]["ids"]:
            HueLamp().put(id, "on")


0be63bf775310b3867544fe94da5f5f3b4426ecb
<mask token>


class Party(Resource):
    <mask token>
    <mask token>

    def put(self):
        print('=== PARTY ===')
        State().put('party')
        for plug in self.actions['plugs']['config']['plug-ids']:
            PowerPlug().put(plug, 'on')
        for id in self.actions['hue']['config']['ids']:
            HueLamp().put(id, 'on')

<mask token>


class Party(Resource):
    <mask token>

    def get(self):
        return self.actions

    def put(self):
        print('=== PARTY ===')
        State().put('party')
        for plug in self.actions['plugs']['config']['plug-ids']:
            PowerPlug().put(plug, 'on')
        for id in self.actions['hue']['config']['ids']:
            HueLamp().put(id, 'on')

<mask token>


class Party(Resource):
    actions = {'plugs': {'default': True, 'title': 'Turn plugs on',
        'config': {'plug-ids': ['main-lamp', 'plasma-lamp', 'starwars-lamp',
        'desk']}}, 'hue': {'default': True, 'title': 'Turn Hue on',
        'config': {'ids': [1]}}}

    def get(self):
        return self.actions

    def put(self):
        print('=== PARTY ===')
        State().put('party')
        for plug in self.actions['plugs']['config']['plug-ids']:
            PowerPlug().put(plug, 'on')
        for id in self.actions['hue']['config']['ids']:
            HueLamp().put(id, 'on')

from flask_restful import Resource
from ..devices import PowerPlug, HueLamp
from ..sensors import State


class Party(Resource):
    actions = {'plugs': {'default': True, 'title': 'Turn plugs on',
        'config': {'plug-ids': ['main-lamp', 'plasma-lamp', 'starwars-lamp',
        'desk']}}, 'hue': {'default': True, 'title': 'Turn Hue on',
        'config': {'ids': [1]}}}

    def get(self):
        return self.actions

    def put(self):
        print('=== PARTY ===')
        State().put('party')
        for plug in self.actions['plugs']['config']['plug-ids']:
            PowerPlug().put(plug, 'on')
        for id in self.actions['hue']['config']['ids']:
            HueLamp().put(id, 'on')

from flask_restful import Resource
from ..devices import PowerPlug, HueLamp
from ..sensors import State


class Party(Resource):

    actions = {
        "plugs": {
            "default": True,
            "title": "Turn plugs on",
            "config": {
                "plug-ids": ["main-lamp", "plasma-lamp", "starwars-lamp", "desk"]
            }
        },
        "hue": {
            "default": True,
            "title": "Turn Hue on",
            "config": {
                "ids": [1]
            }
        }
    }

    def get(self):
        return self.actions

    def put(self):
        print("=== PARTY ===")

        State().put("party")

        # PLUGS ON
        for plug in self.actions["plugs"]["config"]["plug-ids"]:
            PowerPlug().put(plug, "on")

        # HUE ON
        for id in self.actions["hue"]["config"]["ids"]:
            HueLamp().put(id, "on")

