Skip to content

Add onStats message#922

Merged
edenhaus merged 14 commits into
DeebotUniverse:devfrom
gpongelli:deebot-t9-mqtt-stats
May 3, 2025
Merged

Add onStats message#922
edenhaus merged 14 commits into
DeebotUniverse:devfrom
gpongelli:deebot-t9-mqtt-stats

Conversation

@gpongelli

Copy link
Copy Markdown
Contributor

changes to handle onStats mqtt message
[deebot_client.mqtt_client] Got message: topic=iot/atr/onStats/f266fb63-5747-4cca-b8fb-3c1ceda9bd3f/659yh8/r7j2/j, payload=b'{"header":{"pri":1,"tzm":480,"ts":"1745398159530","ver":"0.0.1","fwVer":"1.4.9","hwVer":"0.1.1"},"body":{"data":{"area":27,"time":2459,"cid":"105534963","start":"1745395672","type":"auto","enablePowerMop":1,"powerMopType":2,"aiopen":1,"aitypes":[9],"avoidCount":1}}}'

please let me know how can I test the changes on my deebot T9 AIVI, thanks.

closes #592

@edenhaus edenhaus left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Please add tests

Comment thread deebot_client/commands/json/stats.py Outdated
class GetOnStats(OnStats, JsonCommandWithMessageHandling):
"""Get onStats command."""

NAME = "getOnStats"

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Are you sure this is a valid command? Did you test your code?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I didn’t test this code, I’ve no idea on how to test it on my T9.
Is there a way to gather the command list directly from the device ?

anyway, I added it to have a command into device’s capability, otherwise I’ve no idea on how to “link” mqtt data to the device’s class, can you point me on how to do that?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Is there a way to gather the command list directly from the device ?

Unfortunately not. We can only use trial and error.
You can checkout the example of the readme and test if you get an answer from your bot to test the command

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I've removed this command, because those stats come from mqtt topic "iot/atr/onStats/" and I've seen device subscribes to topics; let me know if commands are needed to handle mqtt messages.

Comment thread deebot_client/commands/json/stats.py Outdated
Comment thread deebot_client/messages/json/__init__.py
Comment thread deebot_client/messages/json/__init__.py Outdated
gpongelli and others added 6 commits April 27, 2025 08:44
Co-authored-by: Robert Resch <robert@resch.dev>
Co-authored-by: Robert Resch <robert@resch.dev>
test data comes from logs on gh issue; other fields are filtered out
for now to not change StatsEvent dataclass.
@gpongelli

Copy link
Copy Markdown
Contributor Author

Please add tests

added test_onStats ; let me know if commands is needed to handle mqtt data, thanks.

@edenhaus

Copy link
Copy Markdown
Member

pre-commit.ci autofix

@codecov

codecov Bot commented Apr 28, 2025

Copy link
Copy Markdown

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 93.07%. Comparing base (64fb815) to head (0e882ca).
Report is 5 commits behind head on dev.

✅ All tests successful. No failed tests found.

Additional details and impacted files
@@            Coverage Diff             @@
##              dev     #922      +/-   ##
==========================================
+ Coverage   93.03%   93.07%   +0.03%     
==========================================
  Files         126      127       +1     
  Lines        4899     4927      +28     
  Branches      318      320       +2     
==========================================
+ Hits         4558     4586      +28     
  Misses        282      282              
  Partials       59       59              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@codspeed-hq

codspeed-hq Bot commented Apr 28, 2025

Copy link
Copy Markdown

CodSpeed Performance Report

Merging #922 will not alter performance

Comparing gpongelli:deebot-t9-mqtt-stats (0e882ca) with dev (a7e5dc4)

Summary

✅ 6 untouched benchmarks

@gpongelli

Copy link
Copy Markdown
Contributor Author

pre-commit.ci autofix

@edenhaus edenhaus changed the title Deebot t9 mqtt stats Add OnStats message May 3, 2025
@edenhaus edenhaus changed the title Add OnStats message Add onStats message May 3, 2025

@edenhaus edenhaus left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Thanks @gpongelli 👍

I reverted the capabilities file changes as if they are still needed should go into a new PR

@edenhaus edenhaus enabled auto-merge (squash) May 3, 2025 17:32
@edenhaus edenhaus merged commit 61360ac into DeebotUniverse:dev May 3, 2025
27 checks passed
@edenhaus edenhaus added the pr: new-feature PR, which adds a new feature label May 4, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

pr: new-feature PR, which adds a new feature

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Deebot T9 seems not update area sensors

2 participants