Skip to content
This repository has been archived by the owner on Apr 3, 2024. It is now read-only.

Commit

Permalink
Add work mode select (#449)
Browse files Browse the repository at this point in the history
  • Loading branch information
edenhaus authored Oct 26, 2023
1 parent 8f8f931 commit 7904f2f
Show file tree
Hide file tree
Showing 6 changed files with 92 additions and 2 deletions.
44 changes: 44 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -52,3 +52,47 @@ jobs:
run: mypy custom_components/
- name: Pylint review
run: pylint custom_components/

create_zip_file:
name: Create zip file for testing
permissions:
# Required to upload/save artifact, otherwise you'll get
# "Error: Resource not accessible by integration"
contents: write
# Required to post comment, otherwise you'll get
# "Error: Resource not accessible by integration"
pull-requests: write
needs:
- code-quality
runs-on: ubuntu-latest
if: github.event_name == 'pull_request'
steps:
- name: 📥 Checkout the repository
uses: actions/checkout@v4

- name: 📦 Create zip file for the integration
run: |
cd "${{ github.workspace }}/custom_components/deebot"
zip deebot.zip -r ./
mv deebot.zip "${{ github.workspace }}/"
- name: 📤 Create comment with the artifiactory
uses: gavv/pull-request-artifacts@v2
with:
# Commit hash that triggered PR
commit: ${{ github.event.pull_request.head.sha }}

# Token for current repo (used to post PR comment)
repo-token: ${{ secrets.GITHUB_TOKEN }}

artifacts-branch: artifacts
inter-link: false

comment-title: |
🤖 Pull request artifactsy
For testing please download the zip file below and extract it in `[config folder]/custom_components/deebot`.
# Whitespace-separated list of files to upload
artifacts: |
deebot.zip
2 changes: 1 addition & 1 deletion custom_components/deebot/manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
"deebot_client"
],
"requirements": [
"git+https://github.com/DeebotUniverse/client.py@dev#deebot-client==4.0.0b0",
"git+https://github.com/DeebotUniverse/client.py@dev#deebot-client==4.0.0dev1",
"numpy>=1.23.2"
],
"version": "v0.0.0"
Expand Down
10 changes: 10 additions & 0 deletions custom_components/deebot/select.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,16 @@ class DeebotSelectEntityDescription(
icon="mdi:water",
entity_category=EntityCategory.CONFIG,
),
DeebotSelectEntityDescription(
capability_fn=lambda caps: caps.clean.work_mode,
current_option_fn=lambda e: e.mode.display_name,
options_fn=lambda cap: [mode.display_name for mode in cap.types],
key="work_mode",
translation_key="work_mode",
entity_registry_enabled_default=False,
icon="mdi:cog",
entity_category=EntityCategory.CONFIG,
),
)


Expand Down
9 changes: 9 additions & 0 deletions custom_components/deebot/translations/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,15 @@
"medium": "medium",
"ultrahigh": "ultrahigh"
}
},
"work_mode": {
"name": "Work mode",
"state": {
"mop": "Mop",
"mop_after_vacuum": "Mop after vacuum",
"vacuum": "Vacuum",
"vacuum_and_mop": "Vacuum & mop"
}
}
},
"sensor": {
Expand Down
2 changes: 1 addition & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# if code from specific branch is needed
git+https://github.com/DeebotUniverse/client.py@dev#deebot-client==4.0.0b0
git+https://github.com/DeebotUniverse/client.py@dev#deebot-client==4.0.0dev1
#deebot-client==3.0.2

homeassistant>=2023.8.0b0
Expand Down
27 changes: 27 additions & 0 deletions translations.schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -213,6 +213,33 @@
}
},
"type": "object"
},
"work_mode": {
"additionalProperties": false,
"properties": {
"name": {
"type": "string"
},
"state": {
"additionalProperties": false,
"properties": {
"mop": {
"type": "string"
},
"mop_after_vacuum": {
"type": "string"
},
"vacuum": {
"type": "string"
},
"vacuum_and_mop": {
"type": "string"
}
},
"type": "object"
}
},
"type": "object"
}
},
"type": "object"
Expand Down

0 comments on commit 7904f2f

Please sign in to comment.