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

I can't get this to work #6

Closed
RedNo7 opened this issue Feb 25, 2024 · 23 comments
Closed

I can't get this to work #6

RedNo7 opened this issue Feb 25, 2024 · 23 comments

Comments

@RedNo7
Copy link

RedNo7 commented Feb 25, 2024

Firstly I think this is a fantastic idea! 👍

I cannot, however get it to work.

I've added the repository installed via HACS, add the extra_module_url, added www\secret-taps.yaml, reset the front-end cache on my iPhone but I cannot get it to work.

Here is my yaml

frontend:
  extra_module_url:
    - /hacsfiles/home-assistant-secret-taps/home-assistant-secret-taps-plugin.js?v1.0.1
enabled: true
profiles:
  - user:
      - James
      - iPad
    secrets:
      - taps:
          - tap
          - double-tap
          - tap
        action: call-service
        service: input_boolean.turn_on
        data:
          entity_id: input_boolean.kiosk_mode
  - admin: true
    secrets:
      - taps:
          - tap
          - double-tap
          - tap
        action: call-service
        service: input_boolean.turn_on
        data:
          entity_id: input_boolean.kiosk_mode

I've tried variations eg:

        action: call-service
        service: input_boolean.turn_on
        data:
          target:
            entity_id: input_boolean.kiosk_mode

But it doesn't work. Is there anything obvious I have got wrong?

@elchininet
Copy link
Owner

elchininet commented Feb 25, 2024

Hi @RedNo7,

First of all, try to check if there are any errors in the logs.
If there are no errors, first try with a simpler configuration instead of a complex one, remove all the user filters and add just one profile with a very simple secret (e.g. ["tap", "tap"]) enable the notification parameter and check if it si triggered, if it works start to add more complexity, more complex secrets and more filters.

Later I‘ll try with my partner‘s device (an iPhone), I have only tested it with a MacBook Pro, an Android phone and an Android tablet.

Let me know your results.

Regards

Edit:

This will not work by the way, your previous configuration is OK, do not add target because it is not needed:

action: call-service
  service: input_boolean.turn_on
  data:
    target:
      entity_id: input_boolean.kiosk_mode

@elchininet
Copy link
Owner

I've added the repository installed via HACS, add the extra_module_url, added www\secret-taps.yaml, reset the front-end cache on my iPhone but I cannot get it to work.

Don‘t forget to restart Home Assistant.

Later I‘ll try with my partner‘s device (an iPhone), I have only tested it with a MacBook, an Android phone and an Android tablet.

Tested on the iOS device of my partner and it also works.

Just take into account the speed at which you are trying to tap, maybe you are too fast or too slow, these are the parameters to recognise the taps:

  • Maximum press time in ms: 250
  • Maximum time in ms between multiple taps: 300
  • Maximum time between taps secuences in ms: 1000 (this can be changed with the threshold parameter)

Try to slow down a bit if you are going too fast or try to speed it up if you are going too slow, I am sure that you will find the spot quickly. But first we need to be sure that the plugin is loaded correctly.

IOS

@RedNo7
Copy link
Author

RedNo7 commented Feb 25, 2024

Hi!

Thanks for replying!

I have no relevant errors in my logs.
I did start and I cleared the front-end cache.
I changed the secret to tap, tap and set notification: true, I get no notification so perhaps the plugin is not loading.

@elchininet
Copy link
Owner

elchininet commented Feb 25, 2024

Hi @RedNo7,
Yes, the first thing to check is if the plugin is loaded and that it is installed properly.
Check that the relevant files are in the www/community/home-assistant-secret-taps/ folder. It is hard to test from the App, could you check that it is working in a computer browser first?
Regards

@elchininet
Copy link
Owner

Hey @RedNo7,
Did you have time to check the installation and test it in a desktop browser?

@RedNo7
Copy link
Author

RedNo7 commented Feb 26, 2024

Hi there - sorry, no it's been pretty busy. I hope to try it later this week. I'll let you know!

@RedNo7
Copy link
Author

RedNo7 commented Mar 4, 2024

Hi,

The debug* option has been helpful.

I can see the following so it is picking ups the taps but the service-call is not working:

home-assistant-secret-taps: tap » double-tap » tap
home-assistant-secret-taps: checking if there is a scret with the previous event stack
home-assistant-secret-taps: secret found, executing secret
home-assistant-secret-taps: secret executed!
home-assistant-secret-taps: { (home-assistant-secret-taps-plugin.js, line 1)
    "taps": [
        "tap",
        "double-tap",
        "tap"
    ],
    "action": "call-service",
    "service": "input_boolean.turn_on",
    "data": {
        "entity_id": "input_boolean.kiosk_mode"
    }
}

edit: typo* and added extra log lines

@RedNo7
Copy link
Author

RedNo7 commented Mar 4, 2024

btw, do I need to restart if I change the contents of secret-taps.yaml? (I have been restarting up until now).

@RedNo7
Copy link
Author

RedNo7 commented Mar 4, 2024

I switched notification: true and get this error whenever I taps executes - it's inline with my logs, but that entity_id is correct.
Screenshot 2024-03-04 at 12 04 58

@elchininet
Copy link
Owner

elchininet commented Mar 4, 2024

I can see the following so it is picking ups the taps but the service-call is not working:

That's great, that means that the taps are working but it is failing to call the service. We need to figure it out why.

btw, do I need to restart if I change the contents of secret-taps.yaml? (I have been restarting up until now).

No, it doesn't need a restart, only if you change the configuration.yaml it needs a restart.

I switched notification: true and get this error whenever I taps executes - it's inline with my logs, but that entity_id is correct.

Let‘s try to find what is happening, go to Developer tools > Services, change it to yaml mode and execute this:

service: input_boolean.turn_on
target:
  entity_id: input_boolean.kiosk_mode

And let me know if it works.

@RedNo7
Copy link
Author

RedNo7 commented Mar 4, 2024

huh. It's just started working - no idea why.

@elchininet
Copy link
Owner

huh. It's just started working - no idea why.

Are the taps working now?

@RedNo7
Copy link
Author

RedNo7 commented Mar 4, 2024

Yes, but only on the desktop (not on my iPhone).

Then I turned debug and notification off and it stopped working on the desktop again.

I am restarting and clearing the cache (desktop and iPhone) after any chnage so not really sure what iOS going on, tbh.

@elchininet
Copy link
Owner

elchininet commented Mar 4, 2024

Yes, but only on the desktop (not on my iPhone).

Then I turned debug and notification off and it stopped working on the desktop again.

I am restarting and clearing the cache (desktop and iPhone) after any chnage so not really sure what iOS going on, tbh.

I really don‘t know what could be happening. Try to delete the Companion App cache in the app settings.

@elchininet
Copy link
Owner

Then I turned debug and notification off and it stopped working on the desktop again.

These options are not related to the funcionality itself, they are just extras to log stuff, it should not make any difference.

@RedNo7
Copy link
Author

RedNo7 commented Mar 4, 2024

Try to delete the Companing App cache in the app settings.
I do this after every change & restart.

These options are not related to the funcionality itself, they are just extras to log stuff, it should not make any difference.
It didn't. My mistake and sorry for that bad steer. I made another change which meant it worked or doesn't work.

  • input_boolean.toggle works
  • input_boolean.turn_on does not work

I can systematically make it work / not work by making changing .toggle with turn_on. I had assumed that because input_boolean.toggle worked, they would both work.

OK, so 100% working on the desktop but only with input_boolean.toggle.

Also, this is one of the reasons that It was never working on the iPhone - as, when I got it working with input_boolean.toggle on the desktop, I changed it to input_boolean.turn_on to try on the iPhone.

So the iPhone now also works, but it is hit and miss for me. The exact same sequence of taps (from a speed point of view) will now always work on the desktop and only sometimes work on the iPhone. I assume that I am on the threshold of speed (sometimes under, sometimes over).

@RedNo7
Copy link
Author

RedNo7 commented Mar 4, 2024

OK, it's working most of the time. If I tap softly on the iPhone it seems wot work much better. 👍

Thanks for your patience!

@RedNo7 RedNo7 closed this as completed Mar 4, 2024
@elchininet
Copy link
Owner

elchininet commented Mar 4, 2024

I can systematically make it work / not work by making changing .toggle with turn_on. I had assumed that because input_boolean.toggle worked, they would both work.

It doesn‘t make much sense, could you try to reproduce it on the Develper tools > Services tab?

So the iPhone now also works, but it is hit and miss for me. The exact same sequence of taps (from a speed point of view) will now always work on the desktop and only sometimes work on the iPhone. I assume that I am on the threshold of speed (sometimes under, sometimes over).

Try to make it slower, real taps with fingers tend to be faster than with a touchpad/mouse. Slow your taps a bit and you will find the sweet spot.

Let‘s try to focus on why turn_on is not working for you. Make some tests in the dev tools to see if you have the same there.

@RedNo7
Copy link
Author

RedNo7 commented Mar 4, 2024

will do - but later today - thanks!

@RedNo7 RedNo7 reopened this Mar 4, 2024
@elchininet
Copy link
Owner

Hi @RedNo7,
Did you have time to test it?
Regards

@RedNo7
Copy link
Author

RedNo7 commented Mar 14, 2024

I’m so sorry. I got it working with ‘toggle’ and forgot to test turn_on. I’ll try to get to it this weekend. Thanks for your continued interest!

@elchininet
Copy link
Owner

Hi @RedNo7,
When you get some time to check this, open a new issue related to the turn_on service.
Closing this one.
Regards

@RedNo7
Copy link
Author

RedNo7 commented Mar 28, 2024

Yes, absolutely. Thanks for your patience.

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