Sytone's Ramblings

The occasional posts of a guy who plays with technology.

New PowerShell module for Home Assistant

2018-06-07 1 min read Home Automation

So after making the PowerShell script for Home Assistant I decided to spend a hour and pull it together to be a full module and push it up to GitHub. This is now in place and support just turning a switch entity on and off.

Installation

Install-Module -Name PoshHomeAssistant -Scope CurrentUser

Usage

Before you can use it set the configuration, this can be done with the following command, set the key and url to match your environment.

Set-HomeAssistantConfiguration -AccessKey "YourAccessKey" -BaseUrl "http://192.168.0.1:8123"

To turn a light on and off run the following commands, they will return the state of the related entities for you to use if needed.

Set-HomeAssistantSwitchState -Entity "switch.2studylamp" -State On
Set-HomeAssistantSwitchState -Entity "switch.2studylamp" -State Off

Related Article: Getting PowerShell to work with Home Assistant