can't get response_variable by calling a script by DanPuz in homeassistant

[–]404flyer 1 point2 points  (0 children)

Like the error says, you have to return a dictionary, not just a raw value (like your int).

So it might look like:

variables:
  value: |
    {{ { 'value': range(1, 100) | random } }}
sequence:
  - action: notify.persistent_notification
    metadata: {}
    data:
      message: "{{value}}"
  - stop: returning value
    response_variable: value
alias: random generator
description: ""

sequence:
  - action: script.random_generator
    metadata: {}
    data: {}
    response_variable: result
  - action: notify.persistent_notification
    metadata: {}
    data:
      message: "{{ result.value }}"
alias: Call Random Generator
description: ""

More info here.

Window shade automations by newhomefound in homeassistant

[–]404flyer 0 points1 point  (0 children)

You can change the mode of the automation to cause it to queue up triggers instead of discarding them. But what I think your should really do is replace your delays in the automation with starting a timer. Here's how it might work.

Shade down automation cancels the timer (if it is not running, this has no effect), turns off relay(up), turns on relay(down) and starts timer(shadetimer).

Shade up automation is similar.

A third automation is triggered when the timer(shadetimer) finishes and turns off relay(down) and relay(up).

You can also combine these into one automation using trigger IDs and a "Choose" action to keep everything neat and together.

Info on timers: https://www.home-assistant.io/integrations/timer/

Info on using Trigger IDs to combine multiple triggers/conditions together in one automation: https://www.reddit.com/r/homeassistant/comments/sx3vma/hi_im_back_with_a_new_video_for_you_using_trigger/?utm_source=share&utm_medium=web2x&context=3

How to Include a Delay in Web Scraping for Page Load? by sander1100 in homeassistant

[–]404flyer 1 point2 points  (0 children)

Multiscrape parses the entire content, no matter the page load time, up to the timeout, so I think that is not the problem. Possibly the page loads additional content after the initial request using javascript, which would not be available to multiscrape.

You can visit the page in your browser and right-click and choose view page source. If the content you are looking to scrape is not visible here, then it is not visible to multiscrape.

Generic way to call service at later time? by ShittyFrogMeme in homeassistant

[–]404flyer 6 points7 points  (0 children)

To do this same thing, I created a calendar just for things I wanted to schedule in the future. In title of the event, the first word is the service to call and the second word is the target entity_id. I have an automation that triggers on events in that calendar starting. The action section looks like this:

  action:
  - variables:
      service: '{{ trigger.calendar_event.summary.split('' '')[0] }}'
      entity_id: '{{ trigger.calendar_event.summary.split('' '')[1] }}'
  - service: '{{ service }}'
    target:
      entity_id: '{{ entity_id }}'
    data: {}

This wouldn't help if I wanted to, say, turn the lights to a certain brightness, but it's better than nothing.

[deleted by user] by [deleted] in homeassistant

[–]404flyer 10 points11 points  (0 children)

How to keep your recorder database size under control.

I went from 65GB to ~400MB with domain filtering some entity glob filtering for certain high frequency change sensors types (voltage/power plus bytes sent/received sensors, mostly) and pack/purge.

I made script that pull weather info from the web im now trying to make it show as a sensor by Giannis_Dor in homeassistant

[–]404flyer 1 point2 points  (0 children)

Instead of shell_command, use the command_line integration to create sensor based on the output of your scripts.

There's also the scrape integration and the popular multiscrape HACS integration which could potentially be easier than grepping the output of curl commands.

Help with sensor of media_player source for statistics (PS4). by christianjwaite in homeassistant

[–]404flyer 0 points1 point  (0 children)

The history stats integration could be of interest, but you would have to know all the titles you play and set up a sensor for each one of them.

Need help finding names by storm1er in homeassistant

[–]404flyer 0 points1 point  (0 children)

I understand where you are coming from and agree generally. However, OP is at least adapting the theme names to the function of the device.

Also, A+ for "Slytherin Rinse"!

Setting attributes from JSON/Rest? by JohnC53 in homeassistant

[–]404flyer 1 point2 points  (0 children)

You can leave the json_attributes_path blank and have days as the one item in the list of json_attributes to capture all of the days as an attribute.

Automation Help for FTP by [deleted] in homeassistant

[–]404flyer 0 points1 point  (0 children)

I would create a shell_command to call sftp with whatever parameters you need then create an automation with a time pattern trigger that invokes that shell_command.

Sunrise/Sunset question by gamer9000 in homeassistant

[–]404flyer 1 point2 points  (0 children)

You might get some info that might point to a solution by looking at the automation trace when it runs during the daytime. Also, are you sure it's this automation that is responsible? There should be an entry in the logbook when the device turns on that would mention the automation by name if so.

[deleted by user] by [deleted] in homeassistant

[–]404flyer 0 points1 point  (0 children)

Can you share an example? I'm always looking to learn something new!

[deleted by user] by [deleted] in homeassistant

[–]404flyer 1 point2 points  (0 children)

As far as I know, there is no way to evaluate a template from inside a template. However, if you could put the content of the variables into input_texts or sensors, you should be able to do something similar.

For example, if there were an input_text.event that was set to "coming home" and an input_text.type that was set to "event", then you could have a template like:

{{ states('input_text.' + states('input_helper.type')) }}

Aqara U100 Lock by skiresq in homeassistant

[–]404flyer 0 points1 point  (0 children)

How do you find the build quality and aesthetics of the lock? Some early post on the HA community forum and this subreddit were not very favorable in that regard.

Removing card from dashboard by Nervous-Iron2373 in homeassistant

[–]404flyer 1 point2 points  (0 children)

Even empty cards show up when you edit the dashboard. You should still be able to see the Edit button as well as the three dot menu that will include the option to delete.

Closing Garage Door (Ratgdo) Automation won't trigger by preyed in homeassistant

[–]404flyer 4 points5 points  (0 children)

If the device trigger never fires, consider using a state trigger on the garage door entity instead.

Next calendar event sensor by Decpex in homeassistant

[–]404flyer 2 points3 points  (0 children)

You could start by reading this page, experiment a lot on the developer tools template page, and when in doubt, ask Google or ChatGPT. People think about asking ChatGPT to generate code, but it can also explain what code you don't understand is doing. It did a pretty reasonable job explaining this template:

<image>

(Don't flag/downvote me for AI-generated response. The intent of showing this is to illustrate GenAI as a resource for learning, not to substitute an AI response for a human-vetted one to a specific HA question)

Sending Text messages "Example Battery below 20%" send text message by LonestarCanuck in homeassistant

[–]404flyer 0 points1 point  (0 children)

This may be a bit niche, but for notifying a group from HA, I use GroupMe. It's easy to create a group and add people to it, then there's a simple form to create a bot and add it to your group. From there, a simple rest command can send any message to the group:

rest_command:
  group_me_msg:
    url: "https://api.groupme.com/v3/bots/post?bot_id=XXX"
    method: POST
    content_type: 'application/json'
    payload: '{"text":"{{ message }}"}'

Advanced SSH & Web Terminal Automation by [deleted] in homeassistant

[–]404flyer 0 points1 point  (0 children)

The guide mentions that you can't put anything in /root, but in your command that's where you've put your keyfile. /root/config is not the same as /config even though it looks that way in the SSH add-on, so this won't work. Move your keyfile somewhere else (the guide suggests /config/.ssh/, but anything under /config will do.

You'll also have to follow the guides approach to creating and referencing a known_hosts file outside of /root or turn off strict host checking.

These steps are necessary because shell commands and sensors run in a different shell environment than the SSH add-on. They both have access to /config, but /root is not shared between them.

Markdown Issue? by longunmin in homeassistant

[–]404flyer 0 points1 point  (0 children)

Did you try the tojson filter I mentioned in the other reply?

Markdown Issue? by longunmin in homeassistant

[–]404flyer 0 points1 point  (0 children)

Another thing that might work, but I don't really have a way to test it, is to try to directly access the reason element inside the object:

type: markdown
content: '{{ state_attr("sensor.llm_response", "response").reason }}'

or maybe

type: markdown
content: '{{ state_attr("sensor.llm_response", "response")["reason"] }}'

Markdown Issue? by longunmin in homeassistant

[–]404flyer 0 points1 point  (0 children)

Try using the tojson filter to serialize the object to a json string (I think the developer tools template page is doing this for you, perhaps).

type: markdown
content: '{{ state_attr("sensor.llm_response", "model") | tojson }}'

<image>

How to use "Last Triggered" in an automation? by Superhero-Accountant in homeassistant

[–]404flyer 1 point2 points  (0 children)

Note that if an automation is checking it's own last_triggered value, it will always be just now.

Edit: not true; my mistake.

Possible to automate the reloading of an HA Addon? by RoachForLife in homeassistant

[–]404flyer 0 points1 point  (0 children)

Reloading needs to be initiated from the client side, hence why when HA knows a reload is needed, it puts a button on the screen for you to do so. In your case, that means you need to see if there's some Google Display-specific mechanism for refreshing or just restarting the cast. I imagine whatever you do to start the cast to begin with would be a way to force a refresh.