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

[SK] Why can't it use the commands "otvor/zatvor" (open/close) in the intent_script (no_intent error)? #2271

Open
dusan-ivanco opened this issue Jul 1, 2024 · 0 comments

Comments

@dusan-ivanco
Copy link

Hi.
For cover controlling, I have created the following setup

custom_sentences:

language: sk

expansion_rules:
  stop: (zastav|zastaviť)
  open: (otvor|otvoriť)
  close: (zatvor|zatvoriť)
  position: (nastav|nastaviť)
  exposure: (odkry|odkryť)

lists:
  cover:
    values:
      - in: žalúzie v dome
        out: ['roleta_obyvacka', 'zaluzia_obyvacka', 'zaluzia_spalna', 'zaluzia_izba_1', 'zaluzia_izba_2_1', 'zaluzia_izba_2_2']

      - in: žalúzie v obývačke
        out: ['roleta_obyvacka', 'zaluzia_obyvacka']
      - in: žalúzie v spálni
        out: ['zaluzia_spalna']
      - in: žalúzie v (prvej|miškovej) izbe
        out: ['zaluzia_izba_1']
      - in: žalúzie v (druhej|dievčenskej) izbe
        out: ['zaluzia_izba_2_1', 'zaluzia_izba_2_2']

      - in: žalúziu dvere v (prvej|miškovej) izbe
        out: ['zaluzia_izba_1']
      - in: žalúziu okno v (druhej|dievčenskej) izbe
        out: ['zaluzia_izba_2_1']
      - in: žalúziu dvere v (druhej|dievčenskej) izbe
        out: ['zaluzia_izba_2_2']

responses:
  intents:
    UserCoverStop:
      response: "Pohyb tienenia je zastavený"

    UserCoverOpen:
      response: "Tienenie sa otvára"

    UserCoverClose:
      response: "Tienenie sa zatvára"

    UserCoverPosition:
      response: "Tienenie sa nastavuje"

    UserCoverExposure:
      response: "Tienenie sa odkrýva"

intents:
  UserCoverStop:
    data:
    - sentences:
      - <stop> {cover}

      slots:
        domain: cover
      response: response

  UserCoverOpen:
    data:
    - sentences:
      - <open> {cover}

      slots:
        domain: cover
      response: response

  UserCoverClose:
    data:
    - sentences:
      - <close> {cover}

      slots:
        domain: cover
      response: response

  UserCoverPosition:
    data:
    - sentences:
      - <position> {cover} na {percentage}(%| percent)

      slots:
        domain: cover
      response: response

  UserCoverExposure:
    data:
    - sentences:
      - <exposure> {cover}

      slots:
        domain: cover
      response: response

intent_script:

UserCoverStop:
  async_action: true
  mode: single
  action:
  - repeat:
      for_each: "{{ cover }}"
      sequence:
      - service: script.turn_on
        target:
          entity_id: script.cover_engine
        data:
          variables:
            entity_id: "cover.{{ repeat.item }}"
            state: stop

UserCoverOpen:
  async_action: true
  mode: single
  action:
  - repeat:
      for_each: "{{ cover }}"
      sequence:
      - service: script.turn_on
        target:
          entity_id: script.cover_engine
        data:
          variables:
            entity_id: "cover.{{ repeat.item }}"
            state: open

UserCoverClose:
  async_action: true
  mode: single
  action:
  - repeat:
      for_each: "{{ cover }}"
      sequence:
      - service: script.turn_on
        target:
          entity_id: script.cover_engine
        data:
          variables:
            entity_id: "cover.{{ repeat.item }}"
            state: close

UserCoverPosition:
  async_action: true
  mode: single
  action:
  - repeat:
      for_each: "{{ cover }}"
      sequence:
      - service: script.turn_on
        target:
          entity_id: script.cover_engine
        data:
          variables:
            entity_id: "cover.{{ repeat.item }}"
            state: position
            position: "{{ percentage }}"

UserCoverExposure:
  async_action: true
  mode: single
  action:
  - repeat:
      for_each: "{{ cover }}"
      sequence:
      - service: script.turn_on
        target:
          entity_id: script.cover_engine
        data:
          variables:
            entity_id: "cover.{{ repeat.item }}"
            state: exposure

script:

cover_engine:
  alias: "- Cover Engine"
  icon: mdi:window-shutter
  max_exceeded: silent
  mode: parallel
  max: 99

  sequence:
  - choose:
    - conditions:
      - condition: template
        value_template: "{{ state == 'stop' }}"
      sequence:
      - service: cover.stop_cover
        target:
          entity_id: "{{ entity_id }}"

    - conditions:
      - condition: template
        value_template: "{{ state == 'open' }}"
      sequence:
      - service: cover.open_cover
        target:
          entity_id: "{{ entity_id }}"

    - conditions:
      - condition: template
        value_template: "{{ state == 'close' }}"
      sequence:
      - service: cover.close_cover
        target:
          entity_id: "{{ entity_id }}"

    - conditions:
      - condition: template
        value_template: "{{ state == 'position' }}"
      sequence:
      - service: cover.set_cover_position
        target:
          entity_id: "{{ entity_id }}"
        data:
          position: "{{ position }}"

    - conditions:
      - condition: template
        value_template: "{{ state == 'exposure' }}"
      sequence:
      - if:
        - condition: template
          value_template: "{{ entity_id | regex_search('^cover\\.zaluzia_.+$') }}"
        then:
        - service: cover.close_cover
          target:
            entity_id: "{{ entity_id }}"

        - wait_template: "{{ (states(entity_id) | lower) not in ['closing', 'opening'] }}"
          continue_on_timeout: true
          timeout: 120

        - service: cover.set_cover_position
          target:
            entity_id: "{{ entity_id }}"
          data:
            position: 3
        else:
        - service: cover.open_cover
          target:
            entity_id: "{{ entity_id }}"

The commands "stop, position and exposure" work fine. However, when using the commands "otvor (open), zatvor (close)" I get a "no_intent" error. But if I change the word "otvor (open), zatvor (close)" to anything else (for example, even "abcxyz"), the command works.

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

1 participant