Partage
  • Partager sur Facebook
  • Partager sur Twitter

Recuprer l'API d'un boutton Android

    14 avril 2024 à 17:16:15

    Avec Home assistant, j'essaie de prendre le contrôle de mon Smartphone depuis mon ordinateur. J'ai déjà réussi à faire de très belles choses. Voici un exemple en images.

    Cependant, je rencontre actuellement un problème. Voici un exemple de mes commandes qui me permettent de valider des choses sur mon téléphone.


    type: custom:stack-in-card
    title: Appels & SMS
    cards:
      - type: horizontal-stack
        cards:
          - type: entities
            entities:
              - entity: input_text.callnumber
                icon: mdi:dialpad
          - type: custom:button-card
            icon: mdi:trash-can
            tap_action:
              action: call-service
              service: input_text.set_value
              data:
                value: ''
              target:
                entity_id: input_text.callnumber
            styles:
              card:
                - width: 40px
                - height: 40px
                - color: '#44739e'
      - type: horizontal-stack
        cards:
          - type: entities
            entities:
              - entity: input_text.smstext
                icon: mdi:text
          - type: custom:button-card
            icon: mdi:trash-can
            tap_action:
              action: call-service
              service: input_text.set_value
              data:
                value: ''
              target:
                entity_id: input_text.smstext
            styles:
              card:
                - width: 40px
                - height: 40px
                - color: '#44739e'
      - type: horizontal-stack
        cards:
          - type: markdown
            content: >-
              Message de : {{state_attr('sensor.redmi_last_notification' ,
              'android.title')}}
              {{states('sensor.redmi_last_notification')}}           
      - type: horizontal-stack
        cards:
          - type: custom:button-card
            name: '1'
            tap_action:
              action: call-service
              service: script.1708615679662
              service_data:
                number: '1'
            styles:
              card:
                - width: 40px
                - height: 40px
                - color: '#44739e'
          - type: custom:button-card
            name: '2'
            tap_action:
              action: call-service
              service: script.1708615679662
              service_data:
                number: '2'
            styles:
              card:
                - width: 40px
                - height: 40px
                - color: '#44739e'
          - type: custom:button-card
            name: '3'
            tap_action:
              action: call-service
              service: script.1708615679662
              service_data:
                number: '3'
            styles:
              card:
                - width: 40px
                - height: 40px
                - color: '#44739e'
          - type: custom:button-card
            name: '4'
            tap_action:
              action: call-service
              service: script.1708615679662
              service_data:
                number: '4'
            styles:
              card:
                - width: 40px
                - height: 40px
                - color: '#44739e'
          - type: custom:button-card
            name: '5'
            tap_action:
              action: call-service
              service: script.1708615679662
              service_data:
                number: '5'
            styles:
              card:
                - width: 40px
                - height: 40px
                - color: '#44739e'
          - type: custom:button-card
            name: '6'
            tap_action:
              action: call-service
              service: script.1708615679662
              service_data:
                number: '6'
            styles:
              card:
                - width: 40px
                - height: 40px
                - color: '#44739e'
          - type: custom:button-card
            icon: mdi:phone-cancel
            color: red
            tap_action:
              action: call-service
              service: script.1708615554191
            styles:
              card:
                - width: 40px
                - height: 40px
                - color: '#44739e'
          - type: custom:button-card
            icon: mdi:microphone
            color: white
            tap_action:
              action: call-service
              service: notify.mobile_app_redmi
              data:
                message: command_launch_app
                data:
                  package_name: com.google.android.apps.accessibility.voiceaccess
            styles:
              card:
                - width: 40px
                - height: 40px
                - color: '#44739e'
          - type: custom:button-card
            icon: mdi:comment
            color: white
            tap_action:
              action: call-service
              service: notify.mobile_app_redmi
              data:
                message: command_launch_app
                data:
                  package_name: com.google.android.apps.messaging
            styles:
              card:
                - width: 40px
                - height: 40px
                - color: '#44739e'
          - type: custom:button-card
            icon: mdi:google-assistant
            color: white
            tap_action:
              action: call-service
              service: notify.mobile_app_redmi
              data:
                message: command_activity
                data:
                  intent_action: android.intent.action.VOICE_COMMAND
            styles:
              card:
                - width: 40px
                - height: 40px
                - color: '#44739e'
          
      - type: horizontal-stack
        cards:
          - type: custom:button-card
            name: '7'
            tap_action:
              action: call-service
              service: script.1708615679662
              service_data:
                number: '7'
            styles:
              card:
                - width: 40px
                - height: 40px
                - color: '#44739e'
          - type: custom:button-card
            name: '8'
            tap_action:
              action: call-service
              service: script.1708615679662
              service_data:
                number: '8'
            styles:
              card:
                - width: 40px
                - height: 40px
                - color: '#44739e'
          - type: custom:button-card
            name: '9'
            tap_action:
              action: call-service
              service: script.1708615679662
              service_data:
                number: '9'
            styles:
              card:
                - width: 40px
                - height: 40px
                - color: '#44739e'
          - type: custom:button-card
            name: '*'
            tap_action:
              action: call-service
              service: script.1708615679662
              service_data:
                number: '*'
            styles:
              card:
                - width: 40px
                - height: 40px
                - color: '#44739e'
          - type: custom:button-card
            name: '0'
            tap_action:
              action: call-service
              service: script.1708615679662
              service_data:
                number: '0'
            styles:
              card:
                - width: 40px
                - height: 40px
                - color: '#44739e'
          - type: custom:button-card
            name: '#'
            tap_action:
              action: call-service
              service: script.1708615679662
              service_data:
                number: '#'
            styles:
              card:
                - width: 40px
                - height: 40px
                - color: '#44739e'
          - type: custom:button-card
            icon: mdi:phone
            color: green
            tap_action:
              action: call-service
              service: script.1708615643818
            styles:
              card:
                - width: 40px
                - height: 40px
                - color: '#44739e'
          - type: custom:button-card
            icon: mdi:message
            color: blue
            tap_action:
              action: call-service
              service: script.1708615761003
            styles:
              card:
                - width: 40px
                - height: 40px
                - color: '#44739e'
          - type: custom:button-card
            icon: mdi:eye
            color: white
            tap_action:
              action: call-service
              service: notify.mobile_app_redmi
              data:
                message: command_screen_on
                data:
                  priority: high
            styles:
              card:
                - width: 40px
                - height: 40px
                - color: '#44739e'
          - type: custom:button-card
            icon: mdi:google-assistant
            color: white
            tap_action:
              action: call-service
              service: notify.mobile_app_redmi
              data:
                message: command_activity
                data:
                  intent_action: android.intent.action.VOICE_COMMAND
              card:
                - width: 40px
                - height: 40px
                - color: '#44739e'      
    

    La partie qui nous intéresse est celle-ci.

    - type: custom:button-card
            icon: mdi:google-assistant
            color: white
            tap_action:
              action: call-service
              service: notify.mobile_app_redmi
              data:
                message: command_activity
                data:
                  intent_action: android.intent.action.xxx
              card:
                - width: 40px
                - height: 40px
                - color: '#44739e'

    Lorsque je me connecte à certaines applications sur mon téléphone, je dois valider un droit de consentement.

      

    Quelle intent_action dois-je mettre pour valider COMMENCER ?

    • Partager sur Facebook
    • Partager sur Twitter

    Recuprer l'API d'un boutton Android

    × Après avoir cliqué sur "Répondre" vous serez invité à vous connecter pour que votre message soit publié.
    • Editeur
    • Markdown