मैं कई खिड़कियां है पीसी मेरे घर में कोडी चलने वाले. मैं उद्देश्यों की एक श्रृंखला के लिए SmartThings करने के लिए उन्हें कनेक्ट करने के लिए करना चाहता था. वहाँ विभिन्न बातें आप चाहते हैं कार्यक्षमता के आधार पर कि किया जा सकता है.
सबसे पहले मैं डाल करने के लिए सक्षम होने के लिए करना चाहता था मेरी पीसी to sleep and wake them up again via a button in SmartThings. मैं इस हासिल किया, although the process is quite a long one to set up. मैं विस्तार में यह नीचे हूँ.
Next I wanted to be able to control Kodi remotely via smartthings. This is reasonably straight-forward to set up, फिर मैं विस्तार से नीचे
अंततः, I wanted to get the status of a PC in SmartThings. This is so that when a PC goes to sleep I can use a routine in smartthings to turn off a power adapter with the home cinema amplifiers plugged in. I originally looked at doing this with an energy saving “smart” socket, but most of these have been discontinued and the reviews of them are mixed at best. Using SmartThings seemed a more reliable way to achieve the same thing, with the added benefit that I can override the behaviour at any time from the convenient of my phone.
भाग एक: एक पीसी की नींद को नियंत्रित करना
I followed the (गहराई में नहीं) article on the SmartThings forum written by rontalley. This took a bit of time to figure out as many of the things required I hadn’t used before, but it wasn’t as tricky as I’d expect. I’ll give a more detailed version below.
Note — you will need the target PC to have a fixed local आईपी पता (usually in the format 192.168.x.x) and you will also need to know the MAC address of the network connection it uses. If you don’t know how to find these then you’re not really the kind of user this guide is aimed at — you do need a bit of technical knowledge to do this kind of tinkering with SmartThings.
1. WOL साथ पीसी विन्यास करें
- Hold the windows key and R to open the run menu
- devmgmt.msc और Enter दबाएं
- Expand ‘network adapters’
- Double click on the network adapter yo use to connect to your network — this will need to be either a wired ethernet connection or a wireless card built in (नहीं एक यूएसबी वाईफ़ाई कार्ड). In my case this was “Realtek PCIe जीबी Ethernet Connection” on 1 PC and “Intel Ethernet Connection” on another
- Click on the “Power Management” tab
- सुनिश्चित करें कि सभी 3 बॉक्स टिक कर रहे हैं, फिर ठीक क्लिक करें और बंद डिवाइस प्रबंधक
2. पीसी आप नियंत्रित करना चाहते पर घटना भूत स्थापित करें
- डाउन लोड EventGhost
- Install EventGhost on the PC you want to control. The default settings are all ok to use. सेटअप रन के अंत में EventGhost
- Create a new file (the white file button at the top left) and then use “File, Save As” to save it somewhere convenient (probably in My documents)
- Right Click on “AutoStart” and select “Add Plugin”
- Scroll to the bottom of the list and select “WebServer” and click OK
- Change the Event Prefix to ST. Do not create a username or password
- I changed the port as I already had something running on Port 80. आप बंदरगाह बदलने के लिए या छोड़ सकते हैं, लेकिन अगर आप को बदलने यह क्या आप इसे करने के लिए बदल का नोट बनाएँ.
- ओके पर क्लिक करें, and then when the Windows Firewall prompt appears, अनुमति दें क्लिक करें.
- Click Cancel to reject the offer to add the “Configuration Tree” actions
- Right click on “AutoStart” again, this time select “Create Macro”
- Expand “system” and then “power management”
- Select “Stand By” (or “Hibernate Computer” if that is what you prefer your PC to do)
- ओके पर क्लिक करें, और पुन: ठीक क्लिक करें अगले शीघ्र पर (without choosing force close all programs)
- अब फ़ाइल सहेज. लगभग हम (लेकिन काफी नहीं) finished with it
- फाइल पर जाएं, विकल्प
- टिक पहले 2 विकल्प (run on startup and minimise to tray) और ठीक क्लिक करें
- Leave EventGhost for now and go on to the next stage.
3. Install the Custom SmartThings Smart App “Send Events to EventGhost” in the SmartThings IDE
- Login to the SmartThings IDE अमेरीका या अमेरिका & यूके
- Click on “My SmartApps”
- Click on the green button “+ New SmartApp”
- Click on “From Code”
- एक नया ब्राउज़र टैब खोलें और करने के लिए जाना GitHub code for Send-Events-to-EventGhost
- Click on the “Raw” button to view the raw code
- Copy and paste the code into the SmartApp creation form on the other tab you still have open
- Click “Create”
- Then Click “Save”, and finally “Publish”.
4. SmartThings IDE में एक आभासी स्विच बनाएं
- Still in the SmartThings IDE (from the previous step) click on “My Devices”
- Click the Green “+ New Device”
- Give your device a sensible name and label — I used the same for each — using the name and location for the PC I wanted to control
- Change the type to “Virtual Switch”
- Give your device a unique network name — I used the format “vs-###” where ### was the computer name
- Select your Home location for Location and select your SmartThings Hub (हम में से ज्यादातर केवल है 1) that you want to control the switch from for the Hub
- Make sure version is set to published
- Leave group and zigbee ID blank
- Click “Create”
5. Set the switch to send the “off” signal to event ghost via the Smart App
- Open the SmartThings app on your mobile device
- Go to Automation and click on “+ Add a SmartApp”
- Scroll down to “My Apps” at the bottom of the list
- Select “Send Events to EventGhost”
- प्रवेश करें आईपी address of the PC you wanted to control (यह एक निश्चित होना चाहिए आईपी)
- से पोर्ट बदलना 80 if you changed the port in the EventGhost webserver creation earlier, otherwise leave it at 80
- Click on the “Switches” option and select the name of the virtual switch you created and then press “Done”
- Click “Save” and you should see “Successfully added…” shown in green
- Switch back to “My Home” in the SmartThings app and toggle the switch that you created on and off
- Go back to the PC you wish to control and look at the “log” on the left hand side of “EventGhost”. You should see a couple of entries that show your switch toggle activity in SmartThings — mine were listed as “ST.ST.CompName.switch.off []” and “ST.ST.CompName.switch.on []"
- हम सोने के लिए पीसी जब हम बंद करने के लिए स्विच को चालू रखना चाहते हैं, so we need the entry “ST.ST.CompName.switch.off []"
- Drag and drop the “ST.ST.CompName.switch.off []” from the log onto the “Stand By” entry in the main panel
- Save the EventGhost file again
- Now try the button in SmartThings on your mobile device. When you toggle the switch to “off” the PC should go to sleep! You’ve completed the first part of the operation. बाकी यहाँ से आसान हो जाएगा.
6. अपने SmartThings के लिए सेटअप webCoRE
- मैं इस पर आधारित है official guide which is well worth looking at if you have any problems
- You will need a GitHub account (मुक्त) इसलिए यदि आप पहले से ही एक नहीं है, तो पर जाएं GitHub and create one, इसमे केवल कुछ सेकंड्स लगते हैं
- अगर (मेरे जैसा) आप यूरोपीय संघ में हैं या यूके then yo uneed to activate GitHub integration for your SmartThings IDE.
के लिए जाओ इस लिंक and follow the instructions to link your GitHub account to SmartThings - हो जाने के बाद (या पहले से सेट अप किया गया) log into the SmartThings IDE अमेरीका या अमेरिका & यूके
- Click on “My SmartApps”
- Click on “Settings” and then click on “Add new repository” in the window that appears
- Use the following details for the repository: Owner= ady624; Name= webCoRE; शाखा = मास्टर
- Click “save”
- Next click the button “Update from Repo” and select “webCoRE (master)"
- Tick ONLY the “webCoRE” option (not the other 3 विकल्प), and tick the “publish” button and click “Execute Update”
- Click on “Update from Repo” again, and select “webCoRE (master)” again
- Tick the remaining 3, tick “publish” again, and click “Execute Update” again
- Click on the “edit properties” button (के अधिकार 2 buttons) next to the webCoRE smart app in the list
- Scroll down and click on “OAuth” to expand the OAuth options
- Click on “Enable OAuth in Smart App” and then click “Update”
- Now go to the SmartThings app on your mobile device
- Click on “MarketPlace” at the bottom and then select “Smart Apps” at the top
- Scroll down to “My Apps” and select “webCoRE” (not the dashboard, storage or piston)
- Follow the setup wizard, including choosing a password
- Give webCoRE access to the virtual switch you created earlier when you get to the devices to control choices.
You can also select any other devices you might want to control web webCoRE - Now click on the “Automation” tab in the SmartThings App
- Scroll down until you find webCoRE and click on “Dashboard”
- Enter the password you created in the webCoRE setup
- To make webCoRE easier to use we are going to access it via the browser on your PC…
- In the automation tab click on webCoRE again, but this time select “Register a browser”
- अपने पीसी खुला पर dashboard.webcore.co and enter the code shown on your SmartThings App
- Now you have webCoRE set up we can use it to send a WOL signal
7. Create a webCoRE piston to send a WOL signal when the switch it toggled to “on”
- In the webCoRE Dashboard, बाएं हाथ की ओर पर, click on “+ New Piston”
- Select “Create a blank piston”
- सेट अपने लेखक का नाम, and give the piston a sensible name (e.g. साल) and click “Create”
- In the code view window click on “+ add a new statement”
- Click on “Add an if” and select “Add a Condition”
- Change “what to compare” to “physical device” and then change “nothing selected” to the name of the virtual switch you created earlier. Change the final box to “switch”
- Leave the next box set to “any interaction”
- Set the box “what kind of comparison” to “changes to” and set the value to “on”
- Click the “add” button. आप कोड का एक छोटा सा जोड़ दिया गया है देखेंगे.
- आगामी, click on the section of code that says “then” and click on “Add an action”
- Leave the “devices” box set to “location” and click “add a task”
- in the “Do” list, scroll down and select the “Wake a LAN device” option
- In the “value” field enter the MAC address of the PC you want to control. प्रारूप xx का प्रयोग करें:xx:xx:xx:xx:xx:xx:xx
- Click the “Add” button
- Now click the “Save” button at the top right of the webCoRE Dashboard to save your code
- You should now be able to use the switch in your SmartThings app to wake your PC from sleep mode as well as putting it to sleep. We finally have the basic functionality we wanted! Try putting the PC to sleep and waking it up with the switch. रुकिए 20+ seconds between each operation to give the PC chance to respond or the button can get out of sync with the real state of the PC. We’ll do some more work next to keep the button always in sync with the status of the PC.
8. हमेशा-चालू पीसी पर HostPinger स्थापित करें
- To keep the switch always in sync with the real condition of the PC we ‘ping’ the PC from another device which needs to be always on. I have a server which I have used for this purpose, but you could use a Raspberry Pi. This guide will focus on using a Windows PC, लेकिन आप उपयोग कर सकते हैं guide by the STHostPinger app author to do this with other devices.
- Download STHostPinger.exe from GitHub (EXE V2.zip) and extract it to a convenient location on the “always on” PC
- Modify the config.config file that comes with STHostPinger.exe to include the आईपी address of the PC that your virtual switch controls
- Change the check interval if you wish — I changed mine to 10 seconds from the default of 30
- Keep the config file open as we need 3 more settings for it once we have set up the smartapp
- Login to the SmartThings IDE अमेरीका या अमेरिका & यूके and click on “My SmartApps”
- Click on “Settings” and then click on “Add new repository” in the window that appears
- Use the following details for the repository: Owner= jebbett; Name= STHostPinger; शाखा = मास्टर
- Click “save”
- Next click the button “Update from Repo” and select “STHostPinger (master)"
- एकमात्र विकल्प टिक, and tick the “publish” button and click “Execute Update”
- Click on the “edit properties” button (के अधिकार 2 buttons) next to the STHostPinger smart app in the list
- Scroll down and click on “OAuth” to expand the OAuth options
- Click on “Enable OAuth in Smart App” and then click “Update”
- Now click on “My Device Handlers”
- Next click the button “Update from Repo” and select “STHostPinger (master)"
- एकमात्र विकल्प टिक, and tick the “publish” button and click “Execute Update”
- Go to the SmartThings app on your mobile device
- Click on Automation at the bottom right, and then scroll down and select “Add a SmartApp”
- Scroll down and choose “My Apps”
- Choose HostPinger, enter the name of the PC you want to monitor, the आईपी पीसी आप निगरानी करना चाहते का पता,
change the “Turn this device on/off with status” and select the virtual switch you created earlier. देरी मैंने पाया के लिए मैं करने के लिए डिफ़ॉल्ट को परिवर्तित करने के लिए आवश्यक 30 सेकंड रिबूट से बचने के लिए पीसी सोने के लिए सीधे जा रहा. Once set click “Save” - Open the HostPinger smartapp from the automation menu, scroll down and turn on debug logging and click Save to close the smartapp
- Switch back to the SmartThings IDE and select the “live logging” menu
- Reopen the HostPinger smartapp on your mobile device
- Switch back to the IDE and you should see that several events have appeared in the live log. These will include some information called “AppId”, “accessToken” and the IDE entity (अमेरिका या यूरोपीय संघ). आप इस जानकारी की जरूरत है
- In the config.config file that you were editing earlier you need to enter the 3 bits of information from the live log. The IDE entity will look something like this: “https://graph-eu01-euwest1.api.smartthings.com”. The other 2 प्रविष्टियों रूप XXXXXXXXXXXX-XXXXXXXX-XXXXXXXXXXXX में होगा
- अपने config.config फ़ाइल में इन प्रविष्टियों को कॉपी करके उसे बचाने के. Now run the STHostPinger.exe and you should see a command prompt style window. It should display the status of the PC you want to monitor as either online or offline, and hopefully this will match what the PC is actually doing.
- Your virtual switch should now accurately show the status of your PC, no matter how it was switched on or off. You can test this by turning the PC and making sure it shows as “on” on the switch in the SmartThings App. अब पीसी के लिए जाने के लिए और यह पूरी तरह से बंद कर देते हैं (यह दीवार पर बंद कर देते हैं). अब, use the switch in the SmartThings App to turn the PC on. Of course the PC can’t turn on because it is off at the wall. The switch should say “turning on” for 10–15 seconds, and afterwards should go back to saying “off”. If this works the pinger service has turned the button back to off correctly.
भाग बी: कोडी को नियंत्रित करना
I tried a couple of different Smart Apps for SmartThings, but found one was easier to set up and did what I needed. फिर, I followed a guide on the SmartThings forum, this time written by the author of the smartapp called “Kodi for SmartThings Beta".
1. SmartThings आईडीई में स्मार्ट एप्लिकेशन और डिवाइस हैंडलर स्थापित करें
Use the same principles as for the first stage, add the custom smart app and device handler and then configure.
- Login to the SmartThings IDE अमेरीका या अमेरिका & यूके and click on “My SmartApps”
- Click on “Settings” and then click on “Add new repository” in the window that appears
- Use the following details for the repository: Owner= iamcanadian2222; नाम = ST-कोडी; शाखा = मास्टर
- Click “save”
- Next click the button “Update from Repo” and select “ST-Kodi (master)"
- एकमात्र विकल्प टिक, and tick the “publish” button and click “Execute Update”
- Now click on “My Device Handlers”
- Next click the button “Update from Repo” and select “ST-Kodi (master)"
- एकमात्र विकल्प टिक, and tick the “publish” button and click “Execute Update”
2. सक्षम करें एचटीटीपी कोडी का नियंत्रण
- अपने पीसी पर कोडी लोड
- Open System settngs
- Navigate to the “Services” option
- में UPnP टैब, turn on “Allow remote control via UPnp”
- In the “Web server” tab, turn on “Allow remote control via एचटीटीपी"
3. SmartThings एप्लिकेशन के माध्यम से smartapp कॉन्फ़िगर
- Open the SmartThings App on your mobile device
- Click on SmartApps at the bottom right
- Scroll down to the bottom to “My Apps”
- Select “Kodi (पूर्व में XBMC)"
- The automatic setup should find your Kodi box, जब यह है, उसका चयन करें और पूर्ण क्लिक करें
- Click “Done” a second time to finish the setup
- A device will appear in “My Home”, यह दिखाना चाहिए क्या कोडी मशीन कर रही है. इस पर क्लिक करें मीडिया नियंत्रणों का एक सेट प्राप्त करने के लिए
भाग सी: सॉकेट बंद करने के लिए जब पीसी निष्क्रिय हो जाती है SmartThings दिनचर्या का उपयोग करना
एक बार ऊपर 2 guides were complete it was very easy to create a SmartThings routine to monitor the status of the PC and turn off sockets when it is off, and turn on sockets when it is on.
1. SmartThings दिनचर्या बनाएं
- Open the SmartThings app on your mobile device
- Click on the “automation” tab at the bottom and then select the “Routines” tab at the top
- Click “Add a routine”
- अपनी दिनचर्या को कोई नाम दें
- दूसरी स्क्रीन में, select the “turn off these lights or switches” and set the smartplug you want to turn off
- Next click on “Automatically perform…” and then select “Something turns on or off”
- In the next menu click on “Which?” and select the virtual switch you created for your PC. Change “On” to “Off”
for the “Turns” option, फिर सहेजें पर क्लिक, उसके बाद फिर से बचाने के लिए क्लिक करें. अब आप सूचीबद्ध अपनी दिनचर्या देखना चाहिए - Create a second routine to turn the smartplug back on when the virtual switch is turned on
इसके लिए धन्यवाद. I found rontalley’s original article a few weeks ago, and also struggled with the level of detail that was or wasn’t provided. Your arrangement just works, and well arranged so I can see which things are doing which. I’ve now got my PC going to sleep when I’m not in my office, and waking back up as soon as I walk back in. With a Smart Plug as well, all the peripherals power down in sync!
हाय वहाँ, this article was really helpful for me. आप लोगों को धन्यवाद