HASS.Agent: Windows client to receive notifications, use commands, sensors, quick actions and more!

Thanks. Tell me, is it possible to output the name of the game without exe? If so, how do I do it?

Not through the WMIQuery (at least not to my knowledge). You could make a template sensor off the one created by HassAgent. Curious as to why you would need it to report without the exe though.

In fact, it does not matter, it’s just possible to clarify the details or not. I need this to run presets on WLED. Some game has started and a preset for coolers is being launched

Here is a time-bound video, so that you don’t watch all the videos, but only the right part, where the preset for coolers is launched when the game starts

i tried all day to send a notification with image per called script and dont got it working.
the notification is sent, but without image.
Looks like its not able to use a template for the image in the action.

  action:
  - service: script.1655549409115
    data:
      title: '{{ camera_name }}'
      message: '{{ label }} - {{ direction }}'
      data:
        image: http://192.168.7:70:5000/api/events/{{trigger.payload_json['after']['id']}}/thumbnail.jpg

        image: http://192.168.1.222:8123/api/frigate/notifications/{{trigger.payload_json['after']['id']}}/thumbnail.jpg

if i call the script from dev tools using the same yaml with replaced {{texts}} it works.
I use the script to allow users to deactivate notifiations.

'1655549409115':
  alias: Frigate Nachricht PC - Self Selected
  sequence:
  - choose:
    - conditions:
      - condition: state
        entity_id: input_boolean.notify_pc_test
        state: 'on'
      sequence:
      - service: notify.hass_agent_test
        data:
          title: '{{ title }}'
          message: '{{ message }}'
          data: '{{ data }}'

whats wrong with data: '{{ data }}'?

I don’t use WLED so I don’t know how it integrates but a simple automation in HA that is triggered on the game sensor should allow you “activate” pretty much anything else integrated in HA.
eg.
If gamessensor=gow.exe then activate gow red lighting scheme
If gamessensor=haloinfinite.exe then activate halo blue lighting scheme

Almost so :grinning: , but as I wrote above, there is no special difference, whether there is an exe or not, it doesn’t matter, you can just specify the names of games in presets in this form HaloInfinite.exe

The sensor of the game itself is specified in the trigger and when the trigger is triggered, a command is sent to WLED as is and will launch a preset with the name HaloInfinite.exe

service: select.select_option
data:
  option: '{{ states("sensor.pc_livingroom_name_running_game") }}'
target:
  entity_id: select.pc_livingroom_preset

when the game is turned off, it starts

service: select.select_option
data:
  option: Static 01
target:
  entity_id: select.pc_livingroom_preset

Very nice, also very informative to learn about value templates!

Thanks for sharing, I’ve added a link to the new version to the docs.

Thanks @stephack, added to the WMI examples.

Hi @vajdum,

Could you please check what the logs say? You can open the logs folder here:

If there’s nothing relevant, enable extended logging, restart and try again.

HASS.Agent is probably receiving an URL that it can’t (or isn’t allowed to) reach. The goal is to send an URL, like http://192.168.1.1/image.jpg, which HASS.Agent will then download and show.

You could also try setting a variable first, like this example:

notification_test:
  alias: Notification Test
  variables:
    image: |
      {%- set image = "http://hass.local:8123" + state_attr("camera.garden","entity_picture") %}
      {{ image }}
  sequence:
  - service: notify.hass_agent_test
    data:
      title: Test
      message: "This is a test message with an image."
      data:
        image: "{{ image }}"
  mode: single
  icon: mdi:bell

So I’m just starting to mess with HASS.agent and my HA. I’m trying to set an automation to fire and one of the conditions would be that my headphones are the primary audio, rather than my desktop speakers. Any suggestion on how I would create that entity?

Hi @Peter_Uhl,

Start by making an ‘Audio’ sensor in HASS.Agent, this is a multivalue sensor so it’ll add a bunch of new sensors to your device in HA. The one you want is: sensor.your_pc_name_audio_default_device. It’ll contain the name of your default audio device.

You can then use it as a condition for your automation, something like this:

condition:
  condition: state
  entity_id: sensor.your_pc_name_audio_default_device
  state: "The Name Of Your Audio Device"

Haven’t tested it, but should work - let me know if it doesn’t!

If you want an intro into what HASS.Agent can do, you can use this doc:

https://hassagent.readthedocs.io/en/latest/introduction/

And optionally this intro for commands:

https://hassagent.readthedocs.io/en/latest/commands/command-basics/

Do you know what the condition of the state would be. If my “default audio device” is the desktop speakers, what condition would I set it to, to recognize when the audio device are my headphones

That depends on what it’s called. Just see what value the sensor has for the activated device. For instance, when I enabled my (usb) headset, this is what I get:

image

And when I set it back to speakers, it becomes this:

image

Ok I’ll give it a try, Thanks!

Alright, let me know if you need more info :slight_smile:

I’ve observed that when using Spotify on my home network and casting to any other device other than my Win10 computer, the computer’s media player entity, created through HASS Agent, is acting as if the computer is playing the music when it isn’t. I’m assuming it has to do with Spotify being open on my computer and showing me the “Listening on X speaker” and giving me the ability to control the music on that other device.

Unfortunately, this breaks the intended purpose for this media player entity in my scripts as it’s not a source of truth of whether the particular computer is playing music. Not sure if this is adjustable at HASS agent, but just putting it out there. Thanks!

Interesting, I’ll see if I can determine that somehow, thanks for letting me know :slight_smile:

Really nice run through by Lewis at Everything Smart Home

4 Likes

Yea it’s awesome! Love his accent as well :slight_smile:

I have some issues with MQTT.

If I use the local IP 192.168.1.147 then it works fine.
But if I use my nabu casa URL then it fails to connect:


I have tried with both TLS and without. What am I missing here?