Homey Community Forum

PowerShell CLI for Homey (v0.1.3)

PowerShell CLI for Homey [Official Thread]

continuation of the Old forum discussion here: https://forum.athom.com/discussion/2086/app-powershell-cli-for-homey-v0-1-3

Download below the Powershell Module files to manage Homey from your Windows PowerShell Command Line.
Read the installation instructions on the Settings page of the App.

Get your Bearer token from the Browser and your Homeys IP address or CloudID from: Homey Settings System
Initialize the PowerShell CLI for Homey
Open your PowerShell or PowerShell ISE, and load the module:

C:\Homey>  Import-Module HomeyPSCLI` 
Connect to Homey:
PS> Connect-Homey -Bearer "Deaf001000bad1000effe000hace000215c001" -CloudID "Deaf010bad10effe0hace021" -ExportPath "C:\Homey\Backup" -WriteConfig
PS> Get-HomeyPendingUpdate -Verbose -InstallPendingUpdate
No Updates available...
Version : 0.10.3

To export as much info from Homey I could find to the Export path defined with Connect-Homey use the following:
PS> Export-HomeyConfig
Look at the files and folder structure after running this command.
Each Flow is exported to a JSON file in it’s folder. If you can read JSON, you can document all flows in seconds and review older or lost flows and configurations.

Some Examples:

PS> Get-HomeyFlows  | Where-Object { $_.title -eq "StopMic" }
PS> Get-HomeyFlows  | Where-Object { $_.broken -eq $true } | ConvertTo-Json |  ConvertFrom-Json | FT -Property id, title, broken

PS C:\Homey> Get-HomeyFlows  | Where-Object { $_.title -eq "New Flow" }  

Key        Value                               
---        -----                               
id         a13f6703-a770-4620-8c93-4ea7e824b6b5
title      New Flow                            
enabled    True                                
folder     False                               
order      11                                  
broken     False                               
trigger    False                               
conditions {}                                  
actions    {}                                  
PS> Remove-HomeyFlow  -ID  "a13f6703-a770-4620-8c93-4ea7e824b6b5"

This scripts make it possible to import some of the exported information, fe flows and BetterLogic variables. Possibly you break something in Homey when you import across different Homeys, different firmware versions or after importing edited information.

Using the import functions incorrectly can cause serious, system-wide problems that may require you to factory reset your Homey, restore firmware or even buy a new Homey to correct them. The Creator of the App and Athom cannot guarantee that any problems resulting from the use of these scripts can be solved. Use this tool at your own risk.

The Creator of the App and Athom are not responsible!!

Q: What does this App do? A: Nothing (yet)! It shows this Page to tel you How to user HomeyPSCLI / PowerShell end provides the downloads of the two files.
Q: So I download the psm1/psd1 files from Github and follow this instructions, will that work? A: Yes that should work!
Q: Why should I install this app? A: I like to inform you in the notification center to update you scripts next time I update the app. Maybe the next version will support auto updating so you only have to update the scripts yourself once…
Q: I have an other question… A: See you on the forum: PowerShell CLI for Homey (v0.1.3)
Q: I have found a bug / a feature request! A: See you on GitHub https://github.com/Dijker/nu.dijker.HomeyPSCLI/issues
Download using the App Store or go to the Github repository for the most recent version.

Version History:

0.0.5 Various fixes and new functions (20161109) [Submitted]

  • Fixed bug where Export would hang / take long
  • Export only new information to existing ExportPath (incremental export, if JSON file is not changed no new duplicate files are created)

New Commandleds:

  • Read-HomeyRFuC [-F433] [-F868] [[-FilePath] <String>] [-Append] [[-Timeout] <Int16>] [<CommonParameters>]
  • Debug-HomeyAppVariableUsage [[-ApplicationName] <string>]
  • Debug-HomeyAppVariableUsage “nl.bevlogenheid.countdown”
  • Debug-HomeyAppVariableUsage “net.i-dev.betterlogic”
    (Thanks to MartijnDeRhoter)
  • Get-HomeyReboot -Verbose

0.0.4 Various fixes version (20161012) [Published]

  • First Run works without Hanging
  • Illegal chars filterd from flow,folder,zone and devicenames
  • Flow and folder recursive paths work now

0.0.3 First github published version (20161009)

0.0.1 First version created local (20161005)

Known Problems

  • User that have problems to connect to their Homey Local using the *.homeylocal.com dns name. I will change that!
  • Installed on a clean Windows PC? First run your iexplore.exe , PowerShell isn’t capable of using http (Invoke-WebRequest) anyway you need it to download your favorit brouwser …

WOW nice. Posh cmdlets for Homey. Thanks, hier ga ik eens snel induiken :slight_smile:

Thanks, this was my first working with Homey,
but I am not sure that I am going to upgrade the App for 2.0 as this still uses the bearer token and old API
so this will not work on Homey’s upgraded to v2.0…