home-assistant / core

:house_with_garden: Open source home automation that puts local control and privacy first.
https://www.home-assistant.io
Apache License 2.0
73.64k stars 30.79k forks source link

Telegram Bot services.yaml is incorrect making it impossible to speciufy target #128950

Open Mithras opened 3 weeks ago

Mithras commented 3 weeks ago

The problem

https://github.com/home-assistant/core/blob/dev/homeassistant/components/telegram_bot/services.yaml#L17 specifies target as object which is incorrect as expected value is actually an int or an array of ints.

What version of Home Assistant Core has the issue?

2024.10.3

What was the last working version of Home Assistant Core?

No response

What type of installation are you running?

Home Assistant Container

Integration causing the issue

telegram_bot

Link to integration documentation on our website

https://www.home-assistant.io/integrations/telegram_bot/

Diagnostics information

AppDeemon app:

        await self.call_service("telegram_bot/send_message",
                                target=123456789,
                                message="test", 
                                return_result=True)

Result:

{'id': 48, 'type': 'result', 'success': False, 'error': {'code': 'invalid_format', 'message': "expected a dictionary for dictionary value @ data['target']. Got ['123456789']"}, 'ad_status': 'OK', 'ad_duration': 0.0007150173187255859}

Example YAML snippet

No response

Anything in the logs that might be useful for us?

No response

Additional information

No response

home-assistant[bot] commented 3 weeks ago

telegram_bot documentation telegram_bot source

Mithras commented 3 weeks ago

It's incorrect for years: https://github.com/home-assistant/core/commit/d37a3cded059d0cde95eb5826ebf42a0e03f97dd but something has changed that now calling service with mismatched data type is throwing an error.

thomasdelaet commented 1 week ago

in services.yaml target is defined as object selector. That should accept both list and dictionary as far as I can see. not sure why it's not working then and what changed suddenly

thomasdelaet commented 1 week ago

I've been looking into websocket_api and telegram_bot components but can't seem to find a change that would trigger such an error