Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Templating hold action fails (iOS companion) #125

Open
erkr opened this issue May 1, 2024 · 8 comments
Open

Templating hold action fails (iOS companion) #125

erkr opened this issue May 1, 2024 · 8 comments

Comments

@erkr
Copy link

erkr commented May 1, 2024

Thanks for the great card. I use it a lot. Today I ran into an issue. When I template the Hold_action it doesn’t work, but same template in tap_action works fine!!
Noticed this on my iPhone using the iOS companion app, that is configured to use safari (will report back for other browsers):

The example that works fine with tap_action but fails using hold_action (this is intended to be used with Nmap device trackers):

hold_action: |
  {% set ip = state_attr(config.entity, 'ip') %}
  {% if ip %}
    { "action": "url", "url_path": "http://{{ip}}", }
  {% else %}
    { "action": "more-info" }
  {% endif %}
@ildar170975
Copy link

Cannot reproduce with a bit different code:

type: entities
entities:
  - input_boolean.test_boolean
  - type: custom:template-entity-row
    entity: sun.sun
    hold_action: >-
      {% set ip = 'google.com' -%}
      {%- if is_state('input_boolean.test_boolean','on') -%}
        { "action": "url", "url_path": "http://{{ip}}" }
      {%- else -%}
        { "action": "more-info" }
      {%- endif %}

image

@erkr
Copy link
Author

erkr commented May 2, 2024

@ildar170975 thanks for verifying! Can you please tell on which platform/browsers/mobile app you tested?!

So it is browser specific. I now verified myself on some platforms:

Working:

  • On my windows PC both with Chrome and edge
  • iPhone Edge
  • Samsung Android 12 comp app

Not working:

  • iOS companion app (iPhone)
  • Full Kiosk on a android 8 tablet
  • iPhone Safari browser

Best Eric

@ildar170975
Copy link

I tested in Chrome & Win.
Have iOS companion app (iOS 15.x), but have not tested there. Will try to do it a bit later.

@erkr
Copy link
Author

erkr commented May 4, 2024

Have iOS companion app (iOS 15.x), but have not tested there. Will try to do it a bit later.

Any update on this 😉

@ildar170975
Copy link

ildar170975 commented May 4, 2024

Sorry for a delay, iPad Air 2 with iOS 15.x simply does not show dashboards with 2024.5 ))))
That is why I am a bit stuck here )))

@erkr
Copy link
Author

erkr commented May 4, 2024

Too bad, sorry to hear that. Thanks for replying

@ildar170975
Copy link

ildar170975 commented May 4, 2024

Managed to get iPad to work, hold on...

iPad Air 2, iOS 15.x:

type: entities
entities:
  - input_boolean.test_boolean
  - type: custom:template-entity-row
    entity: sun.sun
    hold_action: >-
      {% set ip = 'google.com' -%}
      {%- if is_state('input_boolean.test_boolean','on') -%}
        { "action": "url", "url_path": "http://{{ip}}" }
      {%- else -%}
        { "action": "more-info" }
      {%- endif %}

If condition is TRUE or FALSE - hold_action does nothing.
So, the issue is confirmed.

@erkr
Copy link
Author

erkr commented May 4, 2024

@ildar170975 Thanks!!!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants