[{"data":1,"prerenderedAt":581},["ShallowReactive",2],{"post:\u002F2010\u002F07\u002F16\u002Fisy-python-script-for-controlling-media-lights-via-xbmc\u002F":3},{"post":4,"newer":540,"older":550,"related":560,"series":579},{"id":5,"title":6,"body":7,"canonical":518,"categories":519,"date":521,"description":522,"extension":523,"featured":524,"hero":525,"image":525,"meta":526,"navigation":65,"path":527,"readingTime":35,"seo":528,"series":525,"seriesOrder":525,"sites":529,"source":531,"stem":532,"tags":533,"updated":537,"url":538,"__hash__":539},"blog\u002Fblog\u002F2010\u002F07\u002F16\u002Fisy-python-script-for-controlling-media-lights-via-xbmc.md","ISY Python Script for controlling media lights via xbmc",{"type":8,"value":9,"toc":516},"minimark",[10,21,501,504,512],[11,12,13,14,20],"p",{},"Here is a simple python script to use the REST code in the ISY (",[15,16,17],"a",{"href":17,"rel":18},"http:\u002F\u002Funiversal-devices.com",[19],"nofollow",") to control devices that are linked. I’m designing this script to be used inside a script for xbmc. here’s the first part of it. I recommend using scenes for the devicedim, deviceoff, and deviceon array, however you can use the individual devices as well in the array.",[22,23,28],"pre",{"className":24,"code":25,"language":26,"meta":27,"style":27},"language-python shiki shiki-themes github-dark","import urllib2\nimport urllib\nimport sys\n\ndevicedim = ['41941']\ndeviceoff = ['48839']\ndeviceon = ['62270']\nusername = 'admin'\npassword = 'admin'\n\ntopurl = 'http:\u002F\u002Fisy'\npassman = urllib2.HTTPPasswordMgrWithDefaultRealm()\npassman.add_password(None, topurl, username, password)\nauthhandler = urllib2.HTTPBasicAuthHandler(passman)\nopener = urllib2.build_opener(authhandler)\nurllib2.install_opener(opener)\n    \nif sys.argv[1] == 'playing':\n    for devicex in deviceoff:\n        theurl = 'http:\u002F\u002Fisy\u002Frest\u002Fnodes\u002F' + devicex + '\u002Fcmd\u002FDOF'\n        #normalize the URL\n        theurl = urllib.quote(theurl, safe=\"%\u002F:=&?~#+!$,;'@()*[]\")\n        print (theurl)\n        pagehandle = urllib2.urlopen(theurl)\n    for devicex in devicedim:\n        theurl = 'http:\u002F\u002Fisy\u002Frest\u002Fnodes\u002F' + devicex + '\u002Fcmd\u002FDON\u002F64'\n        #normalize the URL\n        theurl = urllib.quote(theurl, safe=\"%\u002F:=&?~#+!$,;'@()*[]\")\n        print (theurl)\n        pagehandle = urllib2.urlopen(theurl)\nelif sys.argv[1] == 'stopped':\n    for devicex in deviceon:\n        print (devicex)\n        theurl = 'http:\u002F\u002Fisy\u002Frest\u002Fnodes\u002F' + devicex + '\u002Fcmd\u002FDON'\n        #normalize the URL\n        theurl = urllib.quote(theurl, safe=\"%\u002F:=&?~#+!$,;'@()*[]\")\n        print (theurl)\n        pagehandle = urllib2.urlopen(theurl)\nelse:\n    print 'no state given'\n","python","",[29,30,31,44,52,60,67,86,101,116,127,137,142,153,164,177,188,199,205,211,235,250,272,279,301,310,321,333,351,356,373,380,389,408,420,428,446,451,468,475,484,492],"code",{"__ignoreMap":27},[32,33,36,40],"span",{"class":34,"line":35},"line",1,[32,37,39],{"class":38},"snl16","import",[32,41,43],{"class":42},"s95oV"," urllib2\n",[32,45,47,49],{"class":34,"line":46},2,[32,48,39],{"class":38},[32,50,51],{"class":42}," urllib\n",[32,53,55,57],{"class":34,"line":54},3,[32,56,39],{"class":38},[32,58,59],{"class":42}," sys\n",[32,61,63],{"class":34,"line":62},4,[32,64,66],{"emptyLinePlaceholder":65},true,"\n",[32,68,70,73,76,79,83],{"class":34,"line":69},5,[32,71,72],{"class":42},"devicedim ",[32,74,75],{"class":38},"=",[32,77,78],{"class":42}," [",[32,80,82],{"class":81},"sU2Wk","'41941'",[32,84,85],{"class":42},"]\n",[32,87,89,92,94,96,99],{"class":34,"line":88},6,[32,90,91],{"class":42},"deviceoff ",[32,93,75],{"class":38},[32,95,78],{"class":42},[32,97,98],{"class":81},"'48839'",[32,100,85],{"class":42},[32,102,104,107,109,111,114],{"class":34,"line":103},7,[32,105,106],{"class":42},"deviceon ",[32,108,75],{"class":38},[32,110,78],{"class":42},[32,112,113],{"class":81},"'62270'",[32,115,85],{"class":42},[32,117,119,122,124],{"class":34,"line":118},8,[32,120,121],{"class":42},"username ",[32,123,75],{"class":38},[32,125,126],{"class":81}," 'admin'\n",[32,128,130,133,135],{"class":34,"line":129},9,[32,131,132],{"class":42},"password ",[32,134,75],{"class":38},[32,136,126],{"class":81},[32,138,140],{"class":34,"line":139},10,[32,141,66],{"emptyLinePlaceholder":65},[32,143,145,148,150],{"class":34,"line":144},11,[32,146,147],{"class":42},"topurl ",[32,149,75],{"class":38},[32,151,152],{"class":81}," 'http:\u002F\u002Fisy'\n",[32,154,156,159,161],{"class":34,"line":155},12,[32,157,158],{"class":42},"passman ",[32,160,75],{"class":38},[32,162,163],{"class":42}," urllib2.HTTPPasswordMgrWithDefaultRealm()\n",[32,165,167,170,174],{"class":34,"line":166},13,[32,168,169],{"class":42},"passman.add_password(",[32,171,173],{"class":172},"sDLfK","None",[32,175,176],{"class":42},", topurl, username, password)\n",[32,178,180,183,185],{"class":34,"line":179},14,[32,181,182],{"class":42},"authhandler ",[32,184,75],{"class":38},[32,186,187],{"class":42}," urllib2.HTTPBasicAuthHandler(passman)\n",[32,189,191,194,196],{"class":34,"line":190},15,[32,192,193],{"class":42},"opener ",[32,195,75],{"class":38},[32,197,198],{"class":42}," urllib2.build_opener(authhandler)\n",[32,200,202],{"class":34,"line":201},16,[32,203,204],{"class":42},"urllib2.install_opener(opener)\n",[32,206,208],{"class":34,"line":207},17,[32,209,210],{"class":42},"    \n",[32,212,214,217,220,223,226,229,232],{"class":34,"line":213},18,[32,215,216],{"class":38},"if",[32,218,219],{"class":42}," sys.argv[",[32,221,222],{"class":172},"1",[32,224,225],{"class":42},"] ",[32,227,228],{"class":38},"==",[32,230,231],{"class":81}," 'playing'",[32,233,234],{"class":42},":\n",[32,236,238,241,244,247],{"class":34,"line":237},19,[32,239,240],{"class":38},"    for",[32,242,243],{"class":42}," devicex ",[32,245,246],{"class":38},"in",[32,248,249],{"class":42}," deviceoff:\n",[32,251,253,256,258,261,264,266,269],{"class":34,"line":252},20,[32,254,255],{"class":42},"        theurl ",[32,257,75],{"class":38},[32,259,260],{"class":81}," 'http:\u002F\u002Fisy\u002Frest\u002Fnodes\u002F'",[32,262,263],{"class":38}," +",[32,265,243],{"class":42},[32,267,268],{"class":38},"+",[32,270,271],{"class":81}," '\u002Fcmd\u002FDOF'\n",[32,273,275],{"class":34,"line":274},21,[32,276,278],{"class":277},"sAwPA","        #normalize the URL\n",[32,280,282,284,286,289,293,295,298],{"class":34,"line":281},22,[32,283,255],{"class":42},[32,285,75],{"class":38},[32,287,288],{"class":42}," urllib.quote(theurl, ",[32,290,292],{"class":291},"s9osk","safe",[32,294,75],{"class":38},[32,296,297],{"class":81},"\"%\u002F:=&?~#+!$,;'@()*[]\"",[32,299,300],{"class":42},")\n",[32,302,304,307],{"class":34,"line":303},23,[32,305,306],{"class":172},"        print",[32,308,309],{"class":42}," (theurl)\n",[32,311,313,316,318],{"class":34,"line":312},24,[32,314,315],{"class":42},"        pagehandle ",[32,317,75],{"class":38},[32,319,320],{"class":42}," urllib2.urlopen(theurl)\n",[32,322,324,326,328,330],{"class":34,"line":323},25,[32,325,240],{"class":38},[32,327,243],{"class":42},[32,329,246],{"class":38},[32,331,332],{"class":42}," devicedim:\n",[32,334,336,338,340,342,344,346,348],{"class":34,"line":335},26,[32,337,255],{"class":42},[32,339,75],{"class":38},[32,341,260],{"class":81},[32,343,263],{"class":38},[32,345,243],{"class":42},[32,347,268],{"class":38},[32,349,350],{"class":81}," '\u002Fcmd\u002FDON\u002F64'\n",[32,352,354],{"class":34,"line":353},27,[32,355,278],{"class":277},[32,357,359,361,363,365,367,369,371],{"class":34,"line":358},28,[32,360,255],{"class":42},[32,362,75],{"class":38},[32,364,288],{"class":42},[32,366,292],{"class":291},[32,368,75],{"class":38},[32,370,297],{"class":81},[32,372,300],{"class":42},[32,374,376,378],{"class":34,"line":375},29,[32,377,306],{"class":172},[32,379,309],{"class":42},[32,381,383,385,387],{"class":34,"line":382},30,[32,384,315],{"class":42},[32,386,75],{"class":38},[32,388,320],{"class":42},[32,390,392,395,397,399,401,403,406],{"class":34,"line":391},31,[32,393,394],{"class":38},"elif",[32,396,219],{"class":42},[32,398,222],{"class":172},[32,400,225],{"class":42},[32,402,228],{"class":38},[32,404,405],{"class":81}," 'stopped'",[32,407,234],{"class":42},[32,409,411,413,415,417],{"class":34,"line":410},32,[32,412,240],{"class":38},[32,414,243],{"class":42},[32,416,246],{"class":38},[32,418,419],{"class":42}," deviceon:\n",[32,421,423,425],{"class":34,"line":422},33,[32,424,306],{"class":172},[32,426,427],{"class":42}," (devicex)\n",[32,429,431,433,435,437,439,441,443],{"class":34,"line":430},34,[32,432,255],{"class":42},[32,434,75],{"class":38},[32,436,260],{"class":81},[32,438,263],{"class":38},[32,440,243],{"class":42},[32,442,268],{"class":38},[32,444,445],{"class":81}," '\u002Fcmd\u002FDON'\n",[32,447,449],{"class":34,"line":448},35,[32,450,278],{"class":277},[32,452,454,456,458,460,462,464,466],{"class":34,"line":453},36,[32,455,255],{"class":42},[32,457,75],{"class":38},[32,459,288],{"class":42},[32,461,292],{"class":291},[32,463,75],{"class":38},[32,465,297],{"class":81},[32,467,300],{"class":42},[32,469,471,473],{"class":34,"line":470},37,[32,472,306],{"class":172},[32,474,309],{"class":42},[32,476,478,480,482],{"class":34,"line":477},38,[32,479,315],{"class":42},[32,481,75],{"class":38},[32,483,320],{"class":42},[32,485,487,490],{"class":34,"line":486},39,[32,488,489],{"class":38},"else",[32,491,234],{"class":42},[32,493,495,498],{"class":34,"line":494},40,[32,496,497],{"class":172},"    print",[32,499,500],{"class":81}," 'no state given'\n",[11,502,503],{},"Usage:",[22,505,510],{"className":506,"code":508,"language":509,"meta":27},[507],"language-text","isy-medialights.py playing|stopped\n","text",[29,511,508],{"__ignoreMap":27},[513,514,515],"style",{},"html pre.shiki code .snl16, html code.shiki .snl16{--shiki-default:#F97583}html pre.shiki code .s95oV, html code.shiki .s95oV{--shiki-default:#E1E4E8}html pre.shiki code .sU2Wk, html code.shiki .sU2Wk{--shiki-default:#9ECBFF}html pre.shiki code .sDLfK, html code.shiki .sDLfK{--shiki-default:#79B8FF}html pre.shiki code .sAwPA, html code.shiki .sAwPA{--shiki-default:#6A737D}html pre.shiki code .s9osk, html code.shiki .s9osk{--shiki-default:#FFAB70}html .default .shiki span {color: var(--shiki-default);background: var(--shiki-default-bg);font-style: var(--shiki-default-font-style);font-weight: var(--shiki-default-font-weight);text-decoration: var(--shiki-default-text-decoration);}html .shiki span {color: var(--shiki-default);background: var(--shiki-default-bg);font-style: var(--shiki-default-font-style);font-weight: var(--shiki-default-font-weight);text-decoration: var(--shiki-default-text-decoration);}",{"title":27,"searchDepth":46,"depth":46,"links":517},[],"techcolumnist",[520],"scripts","2010-07-16T07:55:36Z","com) to control devices that are linked. I’m designing this script to be used inside a script for xbmc. here’s the first part of it.","md",false,null,{},"\u002Fblog\u002F2010\u002F07\u002F16\u002Fisy-python-script-for-controlling-media-lights-via-xbmc",{"title":6,"description":522},[530,518],"lasswell","both","blog\u002F2010\u002F07\u002F16\u002Fisy-python-script-for-controlling-media-lights-via-xbmc",[534,535,536],"isy","script","xbmc","2024-02-12T03:18:19Z","\u002F2010\u002F07\u002F16\u002Fisy-python-script-for-controlling-media-lights-via-xbmc\u002F","VRS3p34PjxIcTm1HkEFbBnoQq0ASnKakB-hhHM1MtfE",{"title":541,"description":542,"date":543,"url":544,"categories":545,"tags":547,"image":525,"readingTime":35,"canonical":518,"sites":549,"series":525,"seriesOrder":525},"SCOM: Alert Generating Rules vs Collection Rules","A quick Google search didn’t yield a quick explanation of this, so I’ll quickly describe the difference.","2010-09-15T12:45:11Z","\u002F2010\u002F09\u002F15\u002Fscom-alert-generating-rules-vs-collection-rules\u002F",[546],"engineering",[548],"scom",[530,518],{"title":551,"description":552,"date":553,"url":554,"categories":555,"tags":557,"image":525,"readingTime":35,"canonical":518,"sites":559,"series":525,"seriesOrder":525},"PowerShell: Schedule a URL into Maintenance Mode","Found a nice article about how to script a URL (or web application) into maintenance mode.","2010-07-07T14:53:54Z","\u002F2010\u002F07\u002F07\u002Fschedule-a-url-into-maintenance-mode\u002F",[546,556,520],"ps",[548,535,558],"powershell",[530,518],[561,550,571],{"title":562,"description":563,"date":564,"url":565,"categories":566,"tags":568,"image":525,"readingTime":35,"canonical":518,"sites":570,"series":525,"seriesOrder":525},"PowerShell: NetApp – Gather Volume Information","This is a simple script to gather volume information including dedupe schedule and autogrow settings.","2014-04-28T12:57:58Z","\u002F2014\u002F04\u002F28\u002Fpowershell-netapp-gather-volume-information\u002F",[567,556,520],"dotps",[569,558,535],"netapp",[530,518],{"title":572,"description":573,"date":574,"url":575,"categories":576,"tags":577,"image":525,"readingTime":35,"canonical":518,"sites":578,"series":525,"seriesOrder":525},"Script: Check for Orphaned HomeDirs","It seems no matter how much you try you cannot ever get those damned orphaned homedirs cleaned up. Well, this helps.","2009-07-07T19:49:43Z","\u002F2009\u002F07\u002F07\u002Fscript-check-for-orphaned-homedirs\u002F",[520],[535],[530,518],{"doc":525,"posts":580},[],1790223955362]