Skip to content

Conversation

@elgris
Copy link

@elgris elgris commented Dec 31, 2025

This series of changes adds some control over datetime settings on the SwitchBot Meter Pro CO2 Monitor and aims to support HomeAssistant (see this request to allow syncing the device's time from HA).

This functionality was reverse-engineered, I don't have any access to the Switchbot documentation.

The change can contribute to #430, as it focuses on datetime exclusively and provides more precise control over that.

@elgris elgris force-pushed the co2_meter_time_control branch 3 times, most recently from 951ce6e to 6045f29 Compare December 31, 2025 20:52
@codecov
Copy link

codecov bot commented Dec 31, 2025

Codecov Report

❌ Patch coverage is 98.14815% with 1 line in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
switchbot/devices/meter_pro.py 98.11% 1 Missing ⚠️
Files with missing lines Coverage Δ
switchbot/__init__.py 100.00% <100.00%> (ø)
switchbot/devices/meter_pro.py 98.11% <98.11%> (ø)

... and 1 file with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@elgris elgris force-pushed the co2_meter_time_control branch 3 times, most recently from 92bd5b7 to d459632 Compare December 31, 2025 21:30
@elgris elgris force-pushed the co2_meter_time_control branch from 32b013e to 0b4a4c3 Compare December 31, 2025 23:56
pre-commit-ci bot and others added 6 commits December 31, 2025 23:57
First, the comment is device-specific. Other devices might implement it differently. Second, top-level comment breaks CI checks.
…replaced byte value comparison with a bit op for consistency with the rest of the codebase.
@elgris
Copy link
Author

elgris commented Jan 1, 2026

Note: this change provides necessary tools for #416.

elgris and others added 2 commits January 4, 2026 19:29
Also replaces a comparison with "80" byte with a bit op for consistency with the rest of the codebase.
@zerzhang
Copy link
Collaborator

zerzhang commented Jan 6, 2026

Rename the file Meter to Meterpro to avoid confusion., The current protocol only applies to MeterPro series devices and does not support Meter type devices.

@elgris
Copy link
Author

elgris commented Jan 6, 2026

Rename the file Meter to Meterpro to avoid confusion., The current protocol only applies to MeterPro series devices and does not support Meter type devices.

But that would make it inconsistent with the advertisement parsers: switchbot/adv_parser/meter.py handles the Pro series too (see process_wosensorth_c). Is that OK?

@zerzhang
Copy link
Collaborator

zerzhang commented Jan 7, 2026

The advertisements for these devices are the same in the first part, but the device setup instructions are quite different.
You only need to rename the file you have currently modified.

To avoid clashing with meter devices, device instructions are different between regular meter vs pro devices.
@elgris
Copy link
Author

elgris commented Jan 7, 2026

The advertisements for these devices are the same in the first part, but the device setup instructions are quite different. You only need to rename the file you have currently modified.

Ack, thanks for explaining! Restored meter.py and moved the pro-related code to meter_pro.py, also renamed the test file.

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

Successfully merging this pull request may close these issues.

3 participants