This is the forum archive of Homey. For more information about Homey, visit the Official Homey website.
The Homey Community has been moved to https://community.athom.com.
This forum is now read-only for archive purposes.
The Homey Community has been moved to https://community.athom.com.
This forum is now read-only for archive purposes.
Closed Official CommunityApp
[App] PowerShell CLI for Homey (v0.1.3)
GeurtDijker
Member
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.
Initialize the PowerShell CLI for Homey
Open your PowerShell or PowerShell ISE, and load the module:C:\Homey> Import-Module HomeyPSCLIConnect 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.3To export as much info from Homey I could find to the Export path defined with Connect-Homey use the following:
PS> Export-HomeyConfigLook 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"
Warning:
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!!
FAQ:
- 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: https://forum.athom.com/discussion/2086
- Q: I have found a bug / a feature request! A: See you on GitHub https://github.com/Dijker/nu.dijker.HomeyPSCLI/issues
Download
Download using the App Store or go to the Github repository for the most recent version.
Tagged:
This discussion has been closed.
Comments
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:Example:
- Debug-HomeyAppVariableUsage "nl.bevlogenheid.countdown"
- Debug-HomeyAppVariableUsage "net.i-dev.betterlogic"
(Thanks to MartijnDeRhoter)
0.0.4 Various fixes version (20161012) [Published]
0.0.3 First github published version (20161009)
0.0.1 First version created local (20161005)
Known Problems
Edit: by digging up your PS module, I got close:
But that gets me
Would that be a BetterLogic thing or is my PS line wrong? @Uranday, does BL allow this?
Edit:
When borrowing code, copy/paste and don't type
If my script doesn't crash it already exports all BL Vars to a Json File.
Line https://github.com/Dijker/nu.dijker.HomeyPSCLI/blob/master/settings/HomeyPSCLI/HomeyPSCLI.psm1#L538-Lundefined does an export from two apps BL and Countdown.
You can find it in the function Export-HomeyAppsVar where I do a
So if you want all BL or countdown Vars just call
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
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.
Thanks!
It should be:
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 https://github.com/athombv/homey/issues/1384 )
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 )
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
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?
I want to export the collected data from the different devices, to use with PowerBI.
here:
https://community.athom.com/t/powershell-cli-for-homey-v0-1-3/311