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

text and keyboard input #38

Open
Ganime422 opened this issue Mar 2, 2023 · 5 comments
Open

text and keyboard input #38

Ganime422 opened this issue Mar 2, 2023 · 5 comments

Comments

@Ganime422
Copy link

hello

is there a way to send keyboard input and text? so for example instead of using the arrows on the TV, I would just write the text i need using a keyboard and the characters would be sent to the tv.

thanks

@iOS090Bravo
Copy link

@Ganime422
Have you configured it yet?

@exiva
Copy link
Owner

exiva commented Mar 31, 2023

Does the app support doing that?

@kbrown01
Copy link

Yes. You can use ASCII Decimal codes and key_command. For example, this in my setup will (in Home Assistant) take a textbox and send each "letter" as the ord ASCII code:

alias: Execute Vizio Search
sequence:
  - repeat:
      sequence:
        - service: rest_command.vizio_processkey
          data:
            ip: 192.168.1.232
            port: "7345"
            auth: XXXXXXXXXX
            codeset: "0"
            code: |
              {{ repeat.item | ord }}
      for_each: |
        {{ states("input_text.vizio_search") | list }}
fields: {}
mode: single
icon: mdi:search-web

The command is built like this:

vizio_processkey:
  url: 'https://{{ ip }}:{{ port }}/key_command/'
  method: put
  content_type: "application/json"
  headers:
    AUTH: '{{ auth }}'
  payload: '{"KEYLIST": [{"CODESET": {{ codeset | int }},"CODE": {{ code | int }},"ACTION":"KEYPRESS"}]}'
  verify_ssl: false

It could be better, like I culd build an array for KEYLIST and send all the keys but it is very fast as is.

So let's say you want to search for "Hot Ones" ... this code in Home Assistant takes that string and converts every letter to it's ASCII equivalent (i.e. "a" = 97) and sends that key stroke. It loops for the entire length of the string and sends all the keys.

@keyur-Dev
Copy link

Can you provide some code snippet for reference?
Also, which value should be passed to the codeset and code? give example.

@kun510
Copy link

kun510 commented May 8, 2024

Convert to ASCII code then pass in code and give codeset = 0
sample: text = A, code = 65 code set = 0
link ASCII: https://blog.28tech.com.vn/c-bang-ma-ascii
then pass the API key command

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

6 participants