[new-user] How to trigger action from desktop pc?

Hello,

I’m super new to Home Assistant and it seems I’m somewhat lost. I’ve done a full HA install on a RPI4 with the RPI4 64bit image and I’ve managed to setup a conbee stick and control a zigbee rgb lamp. I’ve looked at the automations stuff in the dashboard.

Now, to get a better understanding of how things work I’m trying to achieve the following:

I want to change the light’s scene with a keyboard shortcut from my desktop pc (Ubuntu Linux) on the local network, presumably via a bash script or something similar.

But I can’t figure out where to start looking for ways to do this. This is partly because googling (combined) terms such as: ‘home assistant’ ‘bash’ ‘linux’ ‘ubuntu’ ‘script’ ‘ssh’ and so on return all kinds of obvious results that have nothing to do with what I’m trying to achieve.

So can you guys maybe point me in the right direction? Through what general concept/technique can this be done?

Cheers all!

You need some listener on your PC that connects to the Websocket API and calls service scene.turn_on.

Or you use an intermediate MQTT service along with an MQTT sensor.

Or a browser or the app with a dashboard that contains scenes in an Entities card for easy activation.

Why do you need to use a bash script to change the scene?

that’s pretty much what the lovelace dashboard UI is made for.

1 Like

Welcome!

I used this with good results on Ubuntu and MacOS command line:

https://github.com/home-assistant-ecosystem/home-assistant-cli

this would be an example of cli command to turn off the state of some HA entity:

$ hass-cli service call light.turn_off --arguments entity_id=light.small_bedroom

--or--

$ hass-cli state edit sensor.test --json='{ "state":"off"}'
1 Like

Thanks! I will soon look into this for sure!

Yes, the Lovelace Dashboard is really great indeed. I really like it!

In my post I believe I explained that I want to try this task as a way to learn about how things work in Home Assistant.

Awesome! This is exactly the type of awnser I was looking for and has put me back on track. I’ve briefly glanced at the Websocket API documentation and I’m confident that I’ll be able to cook something together starting there. Thank you.

Has anyone heard of a windows tool that lets the user create custom mqtt binary_sensors listening to keyboard shortcuts?

Is home-assistant-cli still the best option these days? I use HASS-Agent on my Windows install, but haven’t explored triggering Home Assistant actions from Linux (KDE/GNOME) until now that I got a new programmable keyboard and I can configure so many shortcuts.