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.
Install-Module -Name PoshHomeAssistant -Scope CurrentUser
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
If you like this blog or find it useful for you, you are welcome to comment on it. You are also welcome to share this blog, so that more people can participate in it. If the images used in the blog infringe your copyright, please contact the author to delete them. Thank you!