Skip to content

OpenHAB Scenes

arch1v1st edited this page Nov 7, 2016 · 3 revisions

AlexaHA's config.js

// Mode/Scene names to Scene ID mappings
config.mode = {
    'house': {
        'off': '0',
        'work': '1',
        'dinner': '2',
        'party': '3',
        'bed': '4',
        'away': '5',
        'panic': '6',
        'relax': '7',
        'gaming': '8',
        'theater': '9',
        'shower': '10',
        'wake up': '11',
        'TV': '12'
    },
    'lighting': {
        'all off': '0',
        'all on': '1',
        'focus': '2',
        'energize': '3',
        'relax': '4',
        'party': '5',
        'night light': '6',
        'bed time': '7',
        'love shack': '8',
        'lava': '9'
    },
    'security': {
        'off': '0',
        'sleep': '1',
        'home': '2',
        'away': '3'
    }    
};

OpenHAB .items:

/* SCENES */
Number Scene_House                              "Scene"                         <colorwheel>
Number Scene_Lighting                           "Scene (Lighting)"              <colorwheel>
Number Scene_Security                           "Scene (Security)"              <colorwheel>

OpenHAB .sitemap:

Selection item=Scene_House label="Scene" mappings=[0="Off", 1="Work", 2="Dinner", 3="Party", 4="Bed", 5="Away", 6="Panic", 7="Chillax", 8="Gaming", 9="Theatre", 10="Shower", 11="Wakeup", 12="TV"]

OpenHAB .rules:

rule "Activate Scene Bed"
when
        Item Scene_House received command 4
then
        //say("Bedtime scene, goodnight")
        sendCommand(Light_GF_Bed_Lamp, ON)
        sendCommand(Light_GF_Bed_Lamp, "80,1,1")
        sendCommand(Light_GF_Bath_Ceiling, ON)
        sendCommand(Light_GF_Bath_Ceiling, "80,1,1")
        sendCommand(Light_GF_Office_Desk,OFF)
        sendCommand(Light_GF_Office_Floor,OFF)
        sendCommand(Light_GF_Dining_Lamp,OFF)
        sendCommand(Light_GF_Dining_Floor,OFF)
        sendCommand(Light_GF_Great_Lamp,OFF)
        sendCommand(Light_GF_Kitchen_Strip1,OFF)
        sendCommand(Light_GF_Kitchen_Strip2,OFF)
        sendCommand(Light_GF_Kitchen_Strip3,OFF)
        sendCommand(Light_GF_Living_Floor,OFF)
        sendCommand(Light_GF_Living_Iris,OFF)
        sendCommand(Light_GF_Living_Strip,OFF)
        sendCommand(Scene_Security_Cameras,1)
end
Clone this wiki locally