Android: Allow YAML mode for entering widget service data

Created on 14 Feb 2020  路  6Comments  路  Source: home-assistant/android

The current auto complete fields and the "Add Field" button when adding a widget work well for services with simple options. However, they don't work for services which have nested properties. For example, it isn't possible to create a widget which will make the equivalents of this service call:

service: notify.mobile_app_other_phone
data:
  message: "I have arrived."
  data:
    sticky: true
    actions:
      - action: confirm
         title: "OK"

Other, simpler, examples also don't work, such as:

service: light.turn_on
data:
  entity_id: light.test_light
  rgb_color: [255,0,0]

To allow this sort of thing it would be useful to be able to switch to YAML mode and enter the service data as YAML rather than via the fields.

enhancement stale widget

Most helpful comment

@dshokouhi I'd removed the template as I'd considered this a feature request rather than a bug report (maybe a feature request template is required). My app version is 1.7.2-128.

Here is a cropped screenshot (I cropped out some of the fields I wasn't using for size reasons) of what I tried with the light.turn_on service:

Screenshot_20200214_184935_io homeassistant companion android

I think the issue there was that rgb_color is actually a nested property, and should take an array of red, green, and blue values (which could be entered if YAML mode were implemented) rather than just a string.

All 6 comments

Please do not delete the issue template as all of the information is important. In this case knowing the app version you are using would be helpful.

Just now I tried to create a widget for light.turn_on and I used the autocomplete field to enter the entity ID and I also manually typed in 100 in brightness_pct and the widget worked appropriately. Are you seeing certain fields not working? It seems to be working as intended. If possible please share a screenshot of the widget creation screen too so we can see what you are entering.

I do see your point on nested properties though, that is indeed something that should be enhanced.

@dshokouhi I'd removed the template as I'd considered this a feature request rather than a bug report (maybe a feature request template is required). My app version is 1.7.2-128.

Here is a cropped screenshot (I cropped out some of the fields I wasn't using for size reasons) of what I tried with the light.turn_on service:

Screenshot_20200214_184935_io homeassistant companion android

I think the issue there was that rgb_color is actually a nested property, and should take an array of red, green, and blue values (which could be entered if YAML mode were implemented) rather than just a string.

Yea RGB should not be sent as a string like you said. The widget itself reads from services.yaml so when you use something like notify.mobile_app there are no values to provide so they must be entered manually, here YAML mode will work. When you use the light domain services we do have values but they should be sent appropriately. We may have the same issue with boolean values but would need to check that.

https://github.com/home-assistant/home-assistant/blob/dev/homeassistant/components/light/services.yaml

https://github.com/home-assistant/home-assistant/blob/dev/homeassistant/components/mobile_app/services.yaml

I will work on this as I work on implementing multiple selections in the autocomplete boxes. The two issues should be related.

@dshokouhi Everything is treated as a string right now, even ints. HA seems to be smart enough to parse them, but we should look at getting the app to send them correctly.

There hasn't been any activity on this issue recently. Due to the high number of incoming GitHub notifications, we have to clean some of the old issues, as many of them have already been resolved with the latest updates.
Please make sure to update to the latest Home Assistant version and check if that solves the issue. Let us know if that works for you by adding a comment 馃憤
This issue now has been marked as stale and will be closed if no further activity occurs. Thank you for your contributions.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

andriej picture andriej  路  4Comments

N-Schaef picture N-Schaef  路  5Comments

Anonym-tsk picture Anonym-tsk  路  3Comments

dshokouhi picture dshokouhi  路  3Comments

aleksandrov1995 picture aleksandrov1995  路  4Comments