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

Use descriptors for default status command cli output #1684

Merged
merged 10 commits into from
Jan 26, 2023

Conversation

rytilahti
Copy link
Owner

This PR moves to use the descriptors to construct cli output format string, making it unnecessary to manually define it for status() commands:

  • Settings are prefixed with [RW] for visibility
  • None values are skipped, but logged
  • Units are shown where available

Example output from roborock:

❯ miiocli roborockvacuum --ip $MIROBO_IP --token $MIROBO_TOKEN status
Running command status
State code: 8
State: Charging
Error code: 0
Error string: No error
Battery: 100 %
Current clean duration: 0:20:11 s
Current clean area: 18.725 m²
Error: False
Main brush used: 9 days, 15:40:14 s
Main brush left: 2 days, 20:19:46 s
Side brush used: 12:18:13 s
Side brush left: 7 days, 19:41:47 s
Filter used: 11:38:16 s
Filter left: 5 days, 18:21:44 s
Sensor dirty used: 11:38:16 s
Sensor dirty left: 18:21:44 s
Total clean duration: 9 days, 15:08:57 s
Total clean area: 12041.43 m²
Total clean count: 697
Do not disturb: True
Do not disturb start: 22:00:00
Do not disturb end: 08:00:00
[RW] Fanspeed: 60 %

and from viomi:

❯ miiocli viomivacuum --model viomi.vacuum.v8 status
Running command status
Vacuum state: VacuumState.Docked
Device state: ViomiVacuumState.Docked
Mop attached: False
Error code: 2105
Battery: 100 %
Bin type: ViomiBinType.Vacuum
Cleaning time: 0:00:00 s
Cleaning area: 0 m²
Has map: True
New map scanned: False
Is charging: True
Order time?: 0
Start time: 0
Zone data: 0
Mop used: 1 day, 5:00:00 s
Mop left: 6 days, 7:00:00 s
Do not disturb: True
Do not disturb start: 23:00:00
Do not disturb end: 09:00:00
[RW] Vacuum along edges: ViomiEdgeState.Off
[RW] Fan speed: ViomiVacuumSpeed.Standard
[RW] Water grade: ViomiWaterGrade.Low
[RW] Remember map: True
[RW] Cleaning mode: ViomiMode.Vacuum
[RW] Power: False
[RW] LED state: False
[RW] Repeat cleaning active: False
[RW] Sound volume: 1

@codecov-commenter
Copy link

codecov-commenter commented Jan 26, 2023

Codecov Report

Merging #1684 (4aa4347) into master (21aef76) will decrease coverage by 0.01%.
The diff coverage is 46.15%.

📣 This organization is not using Codecov’s GitHub App Integration. We recommend you install it so Codecov can continue to function properly for your repositories. Learn more

@@            Coverage Diff             @@
##           master    #1684      +/-   ##
==========================================
- Coverage   80.04%   80.04%   -0.01%     
==========================================
  Files         161      161              
  Lines       16140    16163      +23     
  Branches     3638     3645       +7     
==========================================
+ Hits        12920    12937      +17     
- Misses       2958     2963       +5     
- Partials      262      263       +1     
Impacted Files Coverage Δ
miio/click_common.py 53.11% <0.00%> (-0.52%) ⬇️
miio/integrations/genericmiot/genericmiot.py 25.71% <13.04%> (+0.35%) ⬆️
miio/devicestatus.py 91.58% <80.00%> (-2.67%) ⬇️
miio/integrations/fan/zhimi/fan.py 93.08% <100.00%> (ø)
...iio/integrations/humidifier/zhimi/airhumidifier.py 90.14% <100.00%> (ø)
miio/integrations/vacuum/mijia/pro2vacuum.py 98.14% <100.00%> (ø)
miio/integrations/vacuum/viomi/viomivacuum.py 59.36% <100.00%> (ø)

📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more

@rytilahti rytilahti merged commit 3e283af into master Jan 26, 2023
@rytilahti rytilahti deleted the feat/status_from_descriptors branch January 26, 2023 08:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants