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

[EN] Make shade queries more flexible for more generic requests #2221

Merged
merged 3 commits into from
Jun 17, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions intents.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,9 @@ HassGetState:
area:
description: "Name of an area"
required: false
floor:
description: "Name of a floor"
required: false
domain:
description: "Domain of devices/entities in an area"
required: false
Expand Down
14 changes: 9 additions & 5 deletions sentences/en/cover_HassGetState.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,33 +3,37 @@ intents:
HassGetState:
data:
- sentences:
- "is <name> {cover_states:state} [in <area>]"
- "is <name> {cover_states:state} [[(in|on) ](<area>|<floor>)]"
response: one_yesno
requires_context:
domain: cover
slots:
domain: cover

- sentences:
- "(is|are) any {cover_classes:device_class} {cover_states:state} [in <area>]"
- "(is|are) any {cover_classes:device_class} {cover_states:state} [[(in|on) ](<area>|<floor>)]"
- "(is|are) any (<area>|<floor>) {cover_classes:device_class} {cover_states:state}"
Comment on lines +14 to +15
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The new sentences greatly improve the flexibility of queries. However, both lines exceed the recommended 80 characters, affecting readability.

- "(is|are) any {cover_classes:device_class} {cover_states:state} [[(in|on) ](<area>|<floor>)]"
- "(is|are) any (<area>|<floor>) {cover_classes:device_class} {cover_states:state}"
+ "(is|are) any {cover_classes:device_class} {cover_states:state} [[(in|on) ](<area>|<floor>)]"  # Consider splitting this into multiple lines
+ "(is|are) any (<area>|<floor>) {cover_classes:device_class} {cover_states:state}"  # Consider splitting this into multiple lines

Committable suggestion was skipped due to low confidence.

Tools
yamllint

[error] 14-14: line too long (105 > 80 characters) (line-length)


[error] 15-15: line too long (93 > 80 characters) (line-length)

response: any
slots:
domain: cover

- sentences:
- "are all [the] {cover_classes:device_class} {cover_states:state} [in <area>]"
- "are all [the] {cover_classes:device_class} {cover_states:state} [[(in|on) ](<area>|<floor>)]"
- "are all [the] (<area>|<floor>) {cover_classes:device_class} {cover_states:state}"
Comment on lines +21 to +22
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These sentences also exceed the 80 character limit. Splitting these into multiple lines could enhance readability and maintainability.

- "are all [the] {cover_classes:device_class} {cover_states:state} [[(in|on) ](<area>|<floor>)]"
- "are all [the] (<area>|<floor>) {cover_classes:device_class} {cover_states:state}"
+ "are all [the] {cover_classes:device_class} {cover_states:state} [[(in|on) ](<area>|<floor>)]"  # Consider splitting this into multiple lines
+ "are all [the] (<area>|<floor>) {cover_classes:device_class} {cover_states:state}"  # Consider splitting this into multiple lines

Committable suggestion was skipped due to low confidence.

Tools
yamllint

[error] 21-21: line too long (106 > 80 characters) (line-length)


[error] 22-22: line too long (94 > 80 characters) (line-length)

response: all
slots:
domain: cover

- sentences:
- "(which|what) {cover_classes:device_class} (is|are) {cover_states:state} [in <area>]"
- "(which|what) {cover_classes:device_class} (is|are) {cover_states:state} [[(in|on) ](<area>|<floor>)]"
- "(which|what) (<area>|<floor>) {cover_classes:device_class} (is|are) {cover_states:state}"
Comment on lines +28 to +29
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The sentences effectively enhance query flexibility but exceed the recommended line length, potentially impacting readability.

- "(which|what) {cover_classes:device_class} (is|are) {cover_states:state} [[(in|on) ](<area>|<floor>)]"
- "(which|what) (<area>|<floor>) {cover_classes:device_class} (is|are) {cover_states:state}"
+ "(which|what) {cover_classes:device_class} (is|are) {cover_states:state} [[(in|on) ](<area>|<floor>)]"  # Consider splitting this into multiple lines
+ "(which|what) (<area>|<floor>) {cover_classes:device_class} (is|are) {cover_states:state}"  # Consider splitting this into multiple lines

Committable suggestion was skipped due to low confidence.

Tools
yamllint

[error] 28-28: line too long (114 > 80 characters) (line-length)


[error] 29-29: line too long (102 > 80 characters) (line-length)

response: which
slots:
domain: cover

- sentences:
- "how many {cover_classes:device_class} (is|are) {cover_states:state} [in <area>]"
- "how many {cover_classes:device_class} (is|are) {cover_states:state} [[(in|on) ](<area>|<floor>)]"
- "how many (<area>|<floor>) {cover_classes:device_class} (is|are) {cover_states:state}"
Comment on lines +35 to +36
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These sentences are too long per the linter's recommendations. Consider revising them to improve readability and maintain the width standard.

- "how many {cover_classes:device_class} (is|are) {cover_states:state} [[(in|on) ](<area>|<floor>)]"
- "how many (<area>|<floor>) {cover_classes:device_class} (is|are) {cover_states:state}"
+ "how many {cover_classes:device_class} (is|are) {cover_states:state} [[(in|on) ](<area>|<floor>)]"  # Consider splitting this into multiple lines
+ "how many (<area>|<floor>) {cover_classes:device_class} (is|are) {cover_states:state}"  # Consider splitting this into multiple lines

Committable suggestion was skipped due to low confidence.

Tools
yamllint

[error] 35-35: line too long (110 > 80 characters) (line-length)


[error] 36-36: line too long (98 > 80 characters) (line-length)

response: how_many
slots:
domain: cover
17 changes: 17 additions & 0 deletions tests/en/_fixtures.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,15 @@
language: "en"
areas:
- name: "Guest Room"
id: "guest_room_id"
# prepositional floor
floor: "Upstairs"

- name: "Outside"
# prepositional area
id: "outside_id"
floor: "Ground Floor"

- name: "Kitchen"
id: "kitchen_id"
floor: "First Floor"
Expand Down Expand Up @@ -66,6 +76,13 @@ entities:
attributes:
device_class: curtain

- name: "Shade Left"
id: "cover.shade_left"
area: "guest_room_id"
state: "open"
attributes:
device_class: shade

- name: "Curtain Right"
id: "cover.curtain_right"
area: "living_room_id"
Expand Down
57 changes: 57 additions & 0 deletions tests/en/cover_HassGetState.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ tests:

- sentences:
- "are any curtains open in the living room?"
- "are any living room curtains open?"
intent:
name: HassGetState
slots:
Expand All @@ -21,8 +22,31 @@ tests:
state: "open"
response: "Yes, Curtain Left"

- sentences:
- "are any shades open upstairs?"
intent:
name: HassGetState
slots:
domain: cover
floor: "Upstairs"
device_class: shade
state: "open"
response: "Yes, Shade Left"

- sentences:
- "are any shades open outside?"
intent:
name: HassGetState
slots:
domain: cover
area: "Outside"
device_class: shade
state: "open"
response: "No"

- sentences:
- "are all curtains open in the living room?"
- "are all living room curtains open?"
intent:
name: HassGetState
slots:
Expand All @@ -32,6 +56,17 @@ tests:
state: "open"
response: "No, Curtain Right is not open"

- sentences:
- "are all curtains open on the first floor?"
intent:
name: HassGetState
slots:
domain: cover
floor: "First Floor"
device_class: curtain
state: "open"
response: "No, Bedroom Curtain and Curtain Right are not open"

- sentences:
- "which curtains are closed?"
intent:
Expand All @@ -42,6 +77,17 @@ tests:
state: "closed"
response: "Bedroom Curtain and Curtain Right"

- sentences:
- "which bedroom curtains are closed?"
intent:
name: HassGetState
slots:
domain: cover
area: "Bedroom"
device_class: curtain
state: "closed"
response: "Bedroom Curtain"

- sentences:
- "how many curtains are closed?"
intent:
Expand All @@ -51,3 +97,14 @@ tests:
device_class: curtain
state: "closed"
response: "2"

- sentences:
- "how many bedroom curtains are closed?"
intent:
name: HassGetState
slots:
domain: cover
device_class: curtain
area: "Bedroom"
state: "closed"
response: "1"