2023.7: Responding services

I think it could be further simplified, by proper definition of input_text in the first place. So I can imagine something like:

input_text:
  volumio_2_description:
    name: Volumio_2 Album Description
  state: 'not yet updated'
  attributes:
    album_description: "Initial value"
    album_title: "{{ state_attr('media_player.volumio_2', 'media_album_name') }}"
    artist_name: "{{ state_attr('media_player.volumio_2', 'media_artist') }}"
    song_title: "{{ state_attr('media_player.volumio_2', 'media_title') }}"
    album_art: "{{ state_attr('media_player.volumio_2', 'entity_picture') }}"

This way state and album_description attribute could be set by respective services and other attributes would be templated and as such could not be changed by service.
Moreover, this logic could be applied to any type of entity, that is user defined (sensors and helpers).

Good point, I will prepare a fix for that. I had already added a “Configured” label a couple of days ago but looks like that did not make it into the release. That would already help in your use-case, but I will add dedicated “nothing found” labels to make it even clearer.

EDIT: Clearly show if there are no ignored or disabled integrations by spacegaier ¡ Pull Request #17251 ¡ home-assistant/frontend ¡ GitHub

Hi Guys

Upgraded to 2023.7.1 from 2023.6.5 last night. Since then the RAINBIRD integration is not loading - I also tried to remove/uninstall the rainbird integration to set it up again but also not able to remove/uninstall it. Tried searching for a solution but nothing came up - anybody else experiencing issues with the rainbird integration ?

Restarted several times but no luck.

Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/setup.py", line 215, in _async_setup_component
    component = integration.get_component()
                ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/loader.py", line 813, in get_component
    ComponentProtocol, importlib.import_module(self.pkg_path)
                       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/importlib/__init__.py", line 126, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "<frozen importlib._bootstrap>", line 1204, in _gcd_import
  File "<frozen importlib._bootstrap>", line 1176, in _find_and_load
  File "<frozen importlib._bootstrap>", line 1147, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 690, in _load_unlocked
  File "<frozen importlib._bootstrap_external>", line 940, in exec_module
  File "<frozen importlib._bootstrap>", line 241, in _call_with_frames_removed
  File "/usr/src/homeassistant/homeassistant/components/rainbird/__init__.py", line 4, in <module>
    from pyrainbird.async_client import AsyncRainbirdClient, AsyncRainbirdController
  File "/usr/local/lib/python3.11/site-packages/pyrainbird/async_client.py", line 22, in <module>
    from aiohttp_retry import RetryClient, RetryOptions, JitterRetry
ImportError: cannot import name 'RetryOptions' from 'aiohttp_retry' (/usr/local/lib/python3.11/site-packages/aiohttp_retry/__init__.py)

when trying to remove the integration:

Logger: aiohttp.server
Source: components/rainbird/__init__.py:4
First occurred: 10:27:19 (2 occurrences)
Last logged: 11:51:30

Error handling request
Traceback (most recent call last):
  File "/usr/local/lib/python3.11/site-packages/aiohttp/web_protocol.py", line 433, in _handle_request
    resp = await request_handler(request)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/aiohttp/web_app.py", line 504, in _handle
    resp = await handler(request)
           ^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/aiohttp/web_middlewares.py", line 117, in impl
    return await handler(request)
           ^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/components/http/security_filter.py", line 85, in security_filter_middleware
    return await handler(request)
           ^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/components/http/forwarded.py", line 227, in forwarded_middleware
    return await handler(request)
           ^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/components/http/request_context.py", line 28, in request_context_middleware
    return await handler(request)
           ^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/components/http/ban.py", line 80, in ban_middleware
    return await handler(request)
           ^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/components/http/auth.py", line 236, in auth_middleware
    return await handler(request)
           ^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/components/http/view.py", line 148, in handle
    result = await handler(request, **request.match_info)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/components/config/config_entries.py", line 87, in delete
    result = await hass.config_entries.async_remove(entry_id)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/config_entries.py", line 1089, in async_remove
    await entry.async_remove(self.hass)
  File "/usr/src/homeassistant/homeassistant/config_entries.py", line 581, in async_remove
    component = integration.get_component()
                ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/loader.py", line 813, in get_component
    ComponentProtocol, importlib.import_module(self.pkg_path)
                       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/importlib/__init__.py", line 126, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "<frozen importlib._bootstrap>", line 1204, in _gcd_import
  File "<frozen importlib._bootstrap>", line 1176, in _find_and_load
  File "<frozen importlib._bootstrap>", line 1147, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 690, in _load_unlocked
  File "<frozen importlib._bootstrap_external>", line 940, in exec_module
  File "<frozen importlib._bootstrap>", line 241, in _call_with_frames_removed
  File "/usr/src/homeassistant/homeassistant/components/rainbird/__init__.py", line 4, in <module>
    from pyrainbird.async_client import AsyncRainbirdClient, AsyncRainbirdController
  File "/usr/local/lib/python3.11/site-packages/pyrainbird/async_client.py", line 22, in <module>
    from aiohttp_retry import RetryClient, RetryOptions, JitterRetry
ImportError: cannot import name 'RetryOptions' from 'aiohttp_retry' (/usr/local/lib/python3.11/site-packages/aiohttp_retry/__init__.py)

The example is like a Template Input Text, but with an existing service call (input_text.set_value) and a new service call.

It’s a hybrid of a helper whose state can be set with a service call but its attributes are set via templates or a new service call. My feeling is that it’s for this reason the development team wouldn’t accept this feature request.

1 Like

has anyone found a way to add the new Assist action to any other card than core button and apparently new Mushroom?

    - type: custom:button-card
      name: Assist
      tap_action:
        action: assist

does nothing but briefly show the menu

since the action is not a service registered in the services to call, it’s a bit unclear if and if how we should be able to do so (using yaml or the UI):

    - type: custom:button-card
      name: Assist
      tap_action:
        action: call-service
        service: assist

obviously does not work. It might be the custom card would require an update for this, but given the fact the other tap actions are available as a service, this might even be considered a core bug? Ofc, it could also indicate a new direction, away from the current services/actions… not sure so please have a look

It would not.

As a side note, I’m fairly sure there is a volunteer developer working on an easier solution to this response → event → template sensor process.

2 Likes

We wrote a blog post to explain how custom cards developer can use the new hass-action event.

As far I know, only official card and mushroom supports it for now but I have no doubt others custom cards will support it in the near future.

2 Likes

Yes, red = unsafe and green = safe. There were many discussions about state color in the past few months.
We end up by allowing user to override every default state color using theme variable so everyone can define their own rules : Home Assistant Frontend - Home Assistant.

Feel free to use these themes variables to set every color your want :

  • --state-lock-jammed-color
  • --state-lock-locked-color
  • --state-lock-pending-color
  • --state-lock-unlocked-color
7 Likes

Yeap… not being developer and not knowing how alll the internals of HA work, it is just wishfull thinking of user…
Anyhow it is good to know that it can be achieved other way, even if it is a bit more complex. But nothing impossible with help of this community!

Are you referring to this ‘request for comment’?

Interesting to see if it’s accepted; might be redirected to the Architecture repo for debate.

That appears to be the route he decided to go, it was discussed on discord. A few options were tossed out, we will see if that gets accepted.

EDIT: that does seem to solve the problem. IIRC I proposed a new trigger type, this just adds to any trigger which seems to be a better approach.

So I still don’t understand script response as I have not had a chance to play with it yet but is it possible to do something like write your own function?

e.g. call scrip “geometric mean”, pass it two or more values have the script do some calculation and return a result?

Well, you can’t actually respond yet from a script. I mean, you can with a custom event, but it’s not the same.

I wouldn’t be surprised if this is added sometime in the future.

Yes, that would be a goal.

1 Like

You can respond from a script, just use the stop action

1 Like

Nice, I missed that

Based on the documentation I missed that @crzynik pointed out…

add_five:
  variables:
    value_plus_five: >
      {{ {'value': value + 5} }}
  sequence:
  - stop: "returning value + 5"
    response_variable: value_plus_five

I believe you’d just call the script like this as well.

- service: script.add_five
  data:
    value: 3
  response_variable: result

and you’d access the result in a later on variable/template

You’d have to inspect the result to see if it adds any other layers to the response value. I’d guess it does not, I’d have to check otherwise. I.e. {{ result.value }} would return 8

3 Likes

I don’t have this issue in Home Assistant 2023.7.1

I have this weird issue with my Energy dashboard ever since I’ve updated to 2023.7.x. Don’t really understand what is going on.

I have added the following sensor with my energy dashboard:

image

This is a template sensor with the following code:

- sensor:
      - name: "solarmanlocal_production_daily"
        state: "{{ states('sensor.solarmanlocal_solar_today')}}"
        unit_of_measurement: kWh
        device_class: energy
        state_class: total_increasing
        unique_id: solarmanlocal_production_daily

The sensor.solarmanlocal_solar_today abiously presents the same 39 kwh.

Settings in dashboard:

image

Now the error:

Over the past days it reports really high numbers:

image

While I wish this would be true, it isn’t. It acutally is 39kWh.

The erro is always in the morning:

image

What is there to investigate? I don’t understand where to look.

I was staring at something similar yesterday. It’s happened a handful of times. No restarts or reload around these times: just this seemingly random spike in energy. My panels can only produce about 4kWp, so it’s practically impossible to get this amount of solar.

This is from my energy dashboard. Note the two peaks of 15kWh and 20kWh respectively with a total consumption of over 40kWh for yesterday.

This is the same data plotted with a stats card, grouped by day showing the correct total of about 16kWh.

As you can see here the raw power sensors have no such anomalies.

Just updated to this release and got this in log:

2023-07-11 12:41:26.502 ERROR (MainThread) [homeassistant.components.media_player] The openhome platform for the media_player integration does not support platform setup. Please remove it from your config.

What does it means? I don’t have the openhome platform setup.
What to do?