Skip to content

Reset sensor data to None on communication failures#2

Closed
Copilot wants to merge 5 commits into
copilot/add-lywsd03mmc-data-to-plotlyfrom
copilot/reset-sensor-data-on-failure
Closed

Reset sensor data to None on communication failures#2
Copilot wants to merge 5 commits into
copilot/add-lywsd03mmc-data-to-plotlyfrom
copilot/reset-sensor-data-on-failure

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented Feb 16, 2026

Task: Reset sensor data to None on communication failure

  • Understand the current code structure and identify exception handlers in _read_sensor method
  • Resolve merge conflict by rebasing onto updated base branch (plugin renamed to octoprint_plotly_graph_lywsd03mmc)
  • Add _reset_sensor_data() helper method to centralize reset logic
  • Add explicit reset of sensor data in connection failure exception handler
  • Add explicit reset of sensor data in data read exception handler
  • Add explicit reset of sensor data in ImportError exception handler
  • Verify syntax is correct
  • Run code review and security checks

Summary

Successfully resolved the merge conflict. The base branch renamed the plugin from octoprint_lywsd03mmc to octoprint_plotly_graph_lywsd03mmc. All sensor data reset changes have been reapplied to the renamed directory structure.

Changes Made

  1. Added _reset_sensor_data() helper method - Centralized the logic for resetting sensor data to None
  2. Connection failure handling - Calls _reset_sensor_data() when sensor connection fails
  3. Data read failure handling - Calls _reset_sensor_data() when reading sensor data fails
  4. Import error handling - Calls _reset_sensor_data() when the lywsd03mmc library is not installed
Original prompt

octoprint_lywsd03mmc/init.py 内のセンサーデータ取得処理(_read_sensorメソッド)で通信やデータ取得の失敗時(例外キャッチ時)に、self._temperature, self._humidity, self._battery を明示的に None にリセットしてください。これにより、取得失敗時に前回値を保持せず、表示部で異常を明確に示せるようになります。

This pull request was created from Copilot chat.


💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

Copilot AI and others added 2 commits February 16, 2026 23:44
Co-authored-by: yutaka551 <1833002+yutaka551@users.noreply.github.com>
Co-authored-by: yutaka551 <1833002+yutaka551@users.noreply.github.com>
Copilot AI changed the title [WIP] Reset sensor data to None on failure in _read_sensor method Reset sensor data to None on communication failures Feb 16, 2026
Copilot AI requested a review from yutaka551 February 16, 2026 23:46
@yutaka551 yutaka551 marked this pull request as ready for review February 17, 2026 15:49
Copilot AI review requested due to automatic review settings February 17, 2026 15:49
@yutaka551
Copy link
Copy Markdown
Owner

@copilot コンフリクト直して

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR improves error handling in the LYWSD03MMC sensor plugin by ensuring sensor data is explicitly reset to None when any communication or data acquisition failure occurs, preventing stale values from being displayed as current data.

Changes:

  • Added _reset_sensor_data() helper method to centralize the logic for resetting sensor values to None
  • Updated all exception handlers in _read_sensor() to call the reset method, ensuring failures clear stale data

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Copy link
Copy Markdown
Contributor Author

Copilot AI commented Feb 17, 2026

@copilot コンフリクト直して

コンフリクトを解決しました。ベースブランチ (copilot/add-lywsd03mmc-data-to-plotly) のプラグイン名変更 (octoprint_lywsd03mmc → octoprint_plotly_graph_lywsd03mmc) に対してリベースを完了しました。

変更内容:

  • _reset_sensor_data() ヘルパーメソッドとセンサーデータのリセット処理が新しいディレクトリ構造に正しく適用されています
  • コミット: f44aa7b

ただし、履歴が分岐しているため、force pushが必要です。手動でforce pushしていただくか、もしくはこちらで再度pushを試みることができます。

Warning

Firewall rules blocked me from connecting to one or more addresses (expand for details)

I tried to connect to the following addresses, but was blocked by firewall rules:

  • https://api.github.com/graphql
    • Triggering command: /usr/bin/gh gh pr view copilot/reset-sensor-data-on-failure --json number,title,state,baseRefName (http block)

If you need me to access, download, or install something from one of these locations, you can either:

@yutaka551
Copy link
Copy Markdown
Owner

@copilot あなたがforce pushして。

Copilot AI and others added 2 commits February 17, 2026 15:57
…ctions

- Changed plugin_identifier from "lywsd03mmc" to "plotly_graph_lywsd03mmc" for clearer purpose indication
- Changed plugin_package from "octoprint_lywsd03mmc" to "octoprint_plotly_graph_lywsd03mmc"
- Renamed package folder accordingly
- Updated all template data-bind references to use new plugin identifier
- Renamed template file to match new identifier
- Updated MANIFEST.in with new package name
- Updated __init__.py plugin name and update information key
- Added explicit PlotlyTempGraph installation instructions to README.md

Co-authored-by: yutaka551 <1833002+yutaka551@users.noreply.github.com>
Copilot AI requested a review from yutaka551 February 17, 2026 15:59
@yutaka551 yutaka551 closed this Feb 17, 2026
@yutaka551 yutaka551 deleted the copilot/reset-sensor-data-on-failure branch February 17, 2026 16:00
Copilot stopped work on behalf of yutaka551 due to an error February 17, 2026 16:00
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