2023.7: Responding services

Not sure why it’s being characterized as “trickery”.

What petro suggested leverages the strengths of a Trigger-based Template Sensor, namely the ability to set its state, and/or attributes, to whatever you want via any kind of trigger. In other words, the example is using a Trigger-based Template Sensor the way it’s meant to be used.

The example ‘publishes’ the data via a custom event:

      - event: chatgpt_response
        event_data:
          entity_id: "{{ trigger.entity_id }}"
          response: "{{ chatgpt.response.speech.plain.speech }}"

The Trigger -based Template Sensor ‘subscribes’ to the custom event and receives the data (via trigger.event.data.response):

      - platform: event
        event_type: chatgpt_response
        event_data:
          entity_id: media_player.volumio_2

The Trigger-based Template Sensor uses the received data to set the value of one of its attributes. Easy-peasy (and that value survives a restart).


FWIW, what petro suggested is something I first discovered from these examples by CentralCommand and TheFes:

It’s a pattern I have also employed to fulfill other applications that require storing a value in a sensor’s attribute (with and without the use of custom events). Examples:

Message Queue

Last Ten Motion Detectors

Bad Shutdown Sensor

Song History

It’s a useful design pattern and far from being ‘trickery’.


Your proposed new service call, input_text.set_attribute, would probably need to be called multiple times, once for each attribute you wanted to set … unless it supported setting multiple attributes at once. Here’s a mockup of what the service call could look like:

service: input_text.set_attribute
target:
  entity_id: "input_text.{{ trigger.to_state.object_id }}"
data:
   attribute: album_description
   state: "{{ chatgpt.response.speech.plain.speech }}"

The main difference is that creating an Input Text is admittedly easier than a Trigger-based Template Sensor. Unless there’s an existing Feature Request, feel free to post a request for this new service call.

5 Likes

It does filter them from the log gui, not homeassistant.log

Hmm, this is not mentioned in Docs.

Reolink Cameras, using picture-entity lovelace pages is no longer working correctly.

The picture entities take 4-10 seconds if not timeout completely to display the camera. 2023.6.3. the images loaded immediately. Upgraded to 2023.7.1 and this problem started. On the one page I have with 5 cameras on it, it takes a good 20 seconds for most of them to come up and 1 or 2 have a broken image - sometimes 30 seconds later the broken ones will fill in. It then will often miss refresh updates or timeout while you watch it.

Back down to 2023.6.3 and it works perfectly again.

Live versions of the cameras using WebRTC gets the cameras in live real-time instantly.

It’s only the 10 second refresh picture-entity card that is causing this only seemingly on reolink cameras. (I use picture entity for weather radar and other refreshing images, and they still work and refresh perfectly) …

Hmm.

Dave

No you’re right but that’s what happens for me. The loader messages appear in the log file but not in the gui

I believed the whole Logger integration is about managing the way the Log file is processed.
Not about “which part of Log is to be displayed in UI”.

@Holdestmade would you mind to continue this discussion here?

They never were in the log Ui…
And ofc we were talking homeassistant.log in the first place ( or at least that’s what I took for being the issue at hand in Ildars post)

On the particular initial loader, let me quote

quote

There are only a few at the very top. Is that much of a concern?

in any case, if you review the logs, you’ll see that the logger finishes setup after the initial homeassistant.loader messages:

2022-07-01 11:54:49 WARNING (SyncWorker_5) [homeassistant.loader] We found a custom integration pyscript which has not been t
2022-07-01 11:54:49 INFO (MainThread) [homeassistant.setup] Setup of domain logger took 0.0 seconds

so I suspect that you cannot filter those messages

end quote

then this explains the issue with “loader”.

Yes. For some more background on how to filter using those regex expressions see Regular expression: What is correct syntax for the new logger filter on Google TTS where Petro helps out a lot

Also mark Ludeeus’ words on Loader :wink:

Can anyone do a small test for me?
Starting from 2023.7 I see some really strange behaviour - but I wonder is it only me or anyone else.
Please add this card and see what happens:

        type: grid
        cards:
          - type: history-graph
            hours_to_show: 12
            entities:
              - entity: zone.home

Hey I’m also seeing this error that HA cannot connect or determine the Envoy model. I was using the integrated Envoy method. I cannot find any HACS custom integration though (I probably don’t know how to). But I would like to know which one you are using, I found in another thread that there seem to be multiple different custom integrations.
Thanks a lot

I am seeing my browser and the Android app become essentially unresponsive on my dashboard that contains history cards. I think the 2023.7 release broke history cards somehow.

My guess is this is because of grid.
Have you tested with my card?

Because mainly history-graphs work OK in my setup.
Hmm, there are also some new issues related to “history-graph + custom card with canvas” on a same view (one, two, three).

1 Like

I put your card in a blank dashboard, same behavior - “Loading state data…” forever, and unresponsive. Same thing I’m seeing on my main dashboard that has those cards.

1 Like

Thank you one more time for testing!

So far I got 3 observations for 2023.7:

  1. Demo integration became inconsistent.
  2. “Image” entity does not accept “/local/…” path.
  3. A simple card may hang a page.
1 Like

Is there a way to look at my dashboard YAML without opening it? I want to see if I am using grid in those instances.

I managed to bypass a hanging page using this:

  1. Select a page which definitely do not contain “bad code” and then input this address in browser, this will take to this working page (have to do this since the 1st page was hanging in my case):
http://192.168.0.100:8123/NAME_OF_DASHBOARD/ADDRESS_OF_PAGE?edit=1
  1. Then go to “Raw configuration editor” and then use “search”.

Can’t even get that far. As soon as the dashboard opens, even in edit mode, it’s unresponsive.

Because the page you trying to open contains “bad code”.
Is it a graph inside grid?
You need to open a page w/o these things.

Seems I just shared a virus and soon it will capture all smart homes…

I am, but I need to see the code on the “bad” page to confirm that it has these grids. I can’t see the code because I can’t open the page, even in edit mode. Where is the code stored? Can I get to it from the terminal?