This is the forum archive of Homey. For more information about Homey, visit the Official Homey website.

The Homey Community has been moved to

This forum is now read-only for archive purposes.
Closed Official CommunityApp

[App] PowerShell CLI for Homey (v0.1.3)

GeurtDijkerGeurtDijker Member
edited July 2018 in Apps

PowerShell CLI for Homey [Official Thread]

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!!


  1. 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.
  2. Q: So I download the psm1/psd1 files from Github and follow this instructions, will that work? A: Yes that should work! 
  3. 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...
  4. Q: I have an other question.....    A: See you on the forum:
  5. Q: I have found a bug / a feature request!  A: See you on GitHub


Download using the App Store or go to the Github repository for the most recent version.


  • GeurtDijkerGeurtDijker Member
    edited November 2016

    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)

  • GeurtDijkerGeurtDijker Member
    edited November 2016

    Known Problems

    • User that have problems to connect to their Homey Local using the * 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 brouw ...
  • edited October 2016
    Quick question, how can I connect to my Homey using Invoke-WebRequest? I need to get the list of BL variables that live behind

    Edit: by digging up your PS module, I got close:

    Invoke-WebRequest -Uri -Headers @{"Authorization"="Bearer biglongsecretnumber"} -ContentType "application/json"

    But that gets me

    Invoke-WebRequest : {"status":500,"result":"invalid_token"}
    At line:1 char:1
    + Invoke-WebRequest -Uri ...
    + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
        + CategoryInfo          : InvalidOperation: (System.Net.HttpWebRequest:HttpWebRequest) [Invoke-WebRequest], WebException
        + FullyQualifiedErrorId : WebCmdletWebResponseException,Microsoft.PowerShell.Commands.InvokeWebRequestCommand

    Would that be a BetterLogic thing or is my PS line wrong? @Uranday, does BL allow this?


    When borrowing code, copy/paste and don't type :smile: 

    $bearerToken = "biglongtoken"
    $Headers = @{"Authorization"="Bearer $bearerToken"} 
    $ContentType = "application/json"
    $cloudID = "mycloudid"
    $CloudHostname = "$"
    $CloudLocalHostname = "$"

    $BLVariables = Invoke-WebRequest -Uri "http://$CloudLocalHostname/api/app/net.i-dev.betterlogic/ALL" -Headers $Headers -ContentType $ContentType

  • @MartijnDeRhoter ;
    If my script doesn't crash it already exports all BL Vars to a Json File. 

    Line does an export from two apps BL and Countdown. 

    You can find it in the function Export-HomeyAppsVar where I do a 
        $_HomeyUriGetAppVar = "$_HomeysProtocol`://$_HomeysConnectHost/api/manager/settings/app/$AppUri/variables"

    So if you want all BL or countdown Vars just call
    $returnvarcountdown = Export-HomeyAppsVar 'nl.bevlogenheid.countdown'
    $returnvarbl = Export-HomeyAppsVar 'net.i-dev.betterlogic'
  • Interesting finding after looking at the export in the backupfolder: have some zwave node id's that i can not find in the gui..... :/
  • Maybe some old devices that have been deleted already?
  • @MartijnDeRhoter ;
    If my script doesn't crash it already exports all BL Vars to a Json File. 

    Line does an export from two apps BL and Countdown. 

    You can find it in the function Export-HomeyAppsVar where I do a 
        $_HomeyUriGetAppVar = "$_HomeysProtocol`://$_HomeysConnectHost/api/manager/settings/app/$AppUri/variables"

    So if you want all BL or countdown Vars just call
    $returnvarcountdown = Export-HomeyAppsVar 'nl.bevlogenheid.countdown'
    $returnvarbl = Export-HomeyAppsVar 'net.i-dev.betterlogic'
    Excellent, thanks - I'll give that a try. I'll also spend some time investigating my export error, but time is somewhat scarce at the moment :smile: 

  • Just to inform you, 
    HomeyPSCLI is updated in the store to 0.0.5. 
    If your Homey has a version installed it will probably update itself. 
    If you run
    Connect-Homey it will update its Module files local,

    Version History 
  • @GeurtDijker - I'm trying to import two sets of AppsVars (my device got wiped), and luckily I made a full export a few days earlier. However, when I try to do an Import-HomeyAppsVar, I get this:

    PS M:\HomeyExport\June\Apps\net.i-dev.betterlogic> Import-HomeyAppsVar -AppUri HTTP:// -JSONFile .\Vars-Homey-net.i-dev.betterlogic-v1.3.0-rc.11-20170606101554.json
    Warning: App not installed!

    I'm guessing the URI isn't right, since the app is definitely installed :)

    Also, is there any way you know to import the exported device info? I sooo don't fancy re-adding all those things manually.

  • Hi @MartijnDeRhoter

    It should be: 
     Import-HomeyAppsVar -AppUri net.i-dev.betterlogic -JSONFile .\Vars-Homey-net.i-dev.betterlogic-v1.3.0-rc.11-20170606101554.json

     net.i-dev.betterlogic or nl.bevlogenheid.countdown as AppUri  (only those two I have tested )

    I have tested to import RF (433) KAKU / Homey Easy devices, that works, but All Devices get a new GUID. (See
    As Flows refer to the GUID  all flows are broken and need to be re-linked to devices. 
    It could be possible to script and build a link-table to do that...

    As this probably only works for RF devices and maybe some more (but NOT with secure devices as Z-Wave and i Think Zigbee) it is still very incomplete as backup-restore.

    Therefore I still only  only Export the most and import some datasets, but definitely do not provide a backup. 

    Maybe I will look into that again, but as it will always be very incomplete (Missing Z-wave and Zigbee and probably all other secure devices  and all Community specific App-Devices ) I don't think I will release anything soon.
    If that comes all effort in building a solution around all current restrictions would be useless

    It is in Athoms .... benefit ? to have a Stable Homey without chances to get corruption. Importing could get strange results and things not working.  I know how a lot of users are, they export and import and if it doesn't work create a Issue at GitHub but forget to mention they tried to restore, to let Athom fix things caused by PeBKaC. 

    I Hope Athom would come soon with a real backup-restore solution also for the Secure devices.

    (an believe me, I really would like to make a backup of my Production to restore to the DEV Homey )
  • Thanks for the help @GeurtDijker, just being able to import those variables and the countdown ones saves me a lot of time. I'll go ahead and import the flows and manually re-add my devices.

    And yes, I agree on the import-with-a-different-guid bit of your answer. It would be good to get some form of cloud backup from Athom though, regardless of being on the experimental channel. I guess some Homeys will break at some point :)

  • hi @GeurtDijker, thanks for this. pardon me if this is a silly question -  Is it possible to use this to change an app's variable in HomeyManager.Settings ?
  • Hi,
    Sorry I missed your message,
    I haven't created a special function in HomeyPSCLI yet but everything that can be done from the WebAPI can  be done from PowerShell. 

    I am not very active with HomeyPSCLI  at the moment, 

    Do you have a specific use case?
  • Is it possible this way to export the Insight information.
    I want to export the collected data from the different devices, to use with PowerBI.
  • JPeJPe Member
    edited May 2018
    @htilburgs ;  You can download the Insight-information in .csv format by hovering over the three white points of the device and capability of your choice and select "Download":

  • This forum discussion is closed and continued at the new Community forum 
This discussion has been closed.