Introducing Home Assistant CLI aka. hass-cli

Because it Awesome!
@maxandersen Thanks

2 Likes

Thanks for doing this, I love iT1

1 Like

Is Hass-cli different from hassio-cli, which is invoked with hassio rather than hass-cli?

Yes. Hass-cli is for homeassistant not hassio. That said eventually I could see us expose lot of what hassio does - at least for those things available via homeassistsant APIs.

1 Like

So i’am using hass-cli but i can only ‘list/get’ items and i dont see the options i see on your demo on https://asciinema.org/a/216235?autoplay=1&speed=1 i don’t see the option for example to do ‘hass-cli entity delete’

Am i missing something?

Which version are you using? When I installed this a few weeks ago, the version available on brew on Macos was one version behind the tip (0.5 vs. 0.6, I think), and it was missing a bunch of options.

Hi @Juliean_Galak, have you discovered any similar way of interacting with hassio?

its renamed to hass-cli state delete and yes, I should get the ascinema recording updated :slight_smile:

https://formulae.brew.sh/formula/homeassistant-cli is now at 0.7

haven’t yet found a way to automate updates of brew at release time - if anyone knows how I would love to get a contribution for making that happen!

I have a WIP on adding hassio-cli commands to hass-cli at https://github.com/home-assistant/home-assistant-cli/pull/276

but you can use https://github.com/home-assistant/hassio-cli to have hassio-cli and use it remotely.

haven’t yet found a way to automate updates of brew at release time - if anyone knows how I would love to get a contribution for making that happen!

Perhaps the kubernetes guys have a solution:

Either that or via the brew plugin for fastlane somehow?

The challenge is that for python based brew formulas you need to somehow manually update the dependency info; kubernetes is just a single binary thus its fairly simply to a brew update.

I’m not sure what you refer to with respect to brew plugin for fastlane ?

If you find a way to automatically update the homebrew formula to please open a PR as these days I now have the release of hass-cli down to just be me doing a git tag which triggers build and release to pyp and the docker containers. I would like brew would be automated in the same flow.

(I was thinking about Fastlane the build automation suite, and that they have a plugin for brew (/and cask).)

but maybe this:

Updating a Cask

Notice an application that’s out-of-date in Homebrew Cask? In most cases, it’s very simple to update it. We have a script that will ask for the new version number, and take care of updating the Cask file and submitting a pull request to us:

install and setup script - only needed once brew install vitorgalvao/tiny-scripts/cask-repair cask-repair --help # use to update <outdated_cask> cask-repair <outdated_cask>

If there is a more complicated change, or there is a case where cask-repair fails (for example, where a Cask uses a url do block or the language stanza), you can also follow the steps in Adding a Cask to do the same thing manually. Remember to update the version and shasum values.

Just wanted to say thanks for making hass-cli. It has solved a problem for me in renaming a pile of Z-Wave entity_ids that get automatically created with ugly names. See What is the preferred way to rename z-wave entities? for my BASH 1-liner to save me endless clicking and typing, one entity at a time…

2 Likes

Would someone please be kind enough to help me get started with Home Assistant CLI on Windows 10? I already have Python installed. It doesn’t look like the instructions were meant for Windows 10.
All I want to do is turn OFF (or ON) my appliance using a python script. …So I can just execute Toaster-ON.py to turn on my toaster, for example. Looking forward to some assistance.

1 Like

Hello, I am dead with trials. I want to run a service by hass-cli, but can not find proper format of the command. Lets say I have a tuya scene defined “both_yellow” that sets two lamps to yellow color. in Home-Assistant, I see the entity as scene.both_yellow. How do I run that scene from hass-cli please? Thank you very much, Jan

Solved it. The command line is

hass-cli service call --arguments entity_id=scene.both_yellow scene.turn_on

Just wanted to thank you @janbenes. Could not figure out how to do this and now I got my office light scenes to work via CLI! This was only place I found the answer :slight_smile:

For those people using this tool, it appears return UTC time for history queries, is that right?

I got one question that should be simple… How do I change my keyboard settings? I got a keyboard with a Belgian layout.