Skip to content

Fix command_line binary sensor examples with correct payload values#41820

Merged
c0ffeeca7 merged 2 commits into
currentfrom
copilot/update-binary-sensor-commands
Nov 24, 2025
Merged

Fix command_line binary sensor examples with correct payload values#41820
c0ffeeca7 merged 2 commits into
currentfrom
copilot/update-binary-sensor-commands

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented Nov 17, 2025

Proposed change

The binary sensor examples return "1" or "0" but omit payload_on/payload_off configuration. Since these default to "ON" and "OFF", the examples fail silently.

# Before - broken
command_line:
  - binary_sensor:
      command: "cat /proc/sys/net/ipv4/ip_forward"

# After - working
command_line:
  - binary_sensor:
      command: "cat /proc/sys/net/ipv4/ip_forward"
      payload_on: "1"
      payload_off: "0"

Type of change

  • Adjusted missing or incorrect information in the current documentation (current branch).

Additional information

  • This PR fixes or closes issue: fixes #

Checklist

  • This PR uses the correct branch, based on one of the following:
    • I made a change to the existing documentation and used the current branch.
  • The documentation follows the Home Assistant documentation standards.
Original prompt

This section details on the original issue you should resolve

<issue_title>Binary sensor suggested command</issue_title>
<issue_description>### Feedback

The suggested commands for binary sensor in the template yaml are "cat /proc/sys/net/ipv4/ip_forward" and "echo 1". None of these work, as binary_sensor seems to only accept "ON" & "OFF" (case sensitive). It might be better to update these commands to [[ "$(cat /proc/sys/net/ipv4/ip_forward)" = 1 ]] && echo "ON" || echo "OFF" and "Echo ON", respectively.

URL

https://www.home-assistant.io/integrations/command_line/

Version

2025.11.2

Additional information

No response</issue_description>

<agent_instructions>The reporter is right, these examples:

Binary sensor
To use your Command binary sensor in your installation, add the following to your configuration.yaml file:

Example configuration.yaml entry

command_line:

  • binary_sensor:
    command: "cat /proc/sys/net/ipv4/ip_forward"
  • binary_sensor:
    command: "echo 1"

are not retuning NO or YES (which are the default payloads). These examples thus need to be extended with other payload settings (unlike the reporter suggest, he is suggesting adjusting the command line, which shouldn't be needed)
</agent_instructions>

Comments on the Issue (you are @copilot in this section)


✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.

@home-assistant home-assistant Bot added in-progress This PR/Issue is currently being worked on needs-rebase The PR has been branched of the wrong base branch or targets an incorrect target branch labels Nov 17, 2025
@home-assistant
Copy link
Copy Markdown

It seems that this PR is targeted against an incorrect branch since it has a parent PR on one of our codebases. Documentation that needs to be updated for an upcoming release should target the next branch. Please change the target branch of this PR to next and rebase if needed.

@netlify
Copy link
Copy Markdown

netlify Bot commented Nov 17, 2025

Deploy Preview for home-assistant-docs ready!

Name Link
🔨 Latest commit db9dd96
🔍 Latest deploy log https://app.netlify.com/projects/home-assistant-docs/deploys/691acade1e1de60008183e33
😎 Deploy Preview https://deploy-preview-41820--home-assistant-docs.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

Co-authored-by: frenck <195327+frenck@users.noreply.github.com>
Copilot AI changed the title [WIP] Update suggested commands for binary sensor Fix command_line binary sensor examples with correct payload values Nov 17, 2025
Copilot AI requested a review from frenck November 17, 2025 07:15
@frenck frenck marked this pull request as ready for review November 17, 2025 07:20
Copilot AI review requested due to automatic review settings November 17, 2025 07:20
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 fixes broken binary sensor examples in the command_line integration documentation. The examples were returning "1" or "0" but relied on the default payload_on/payload_off values of "ON"/"OFF", causing them to fail silently.

Key changes:

  • Added explicit payload_on: "1" and payload_off: "0" configuration to both binary sensor examples

@frenck frenck requested a review from c0ffeeca7 November 22, 2025 12:18
@frenck frenck added current This PR goes into the current branch and removed in-progress This PR/Issue is currently being worked on needs-rebase The PR has been branched of the wrong base branch or targets an incorrect target branch labels Nov 22, 2025
Copy link
Copy Markdown
Contributor

@c0ffeeca7 c0ffeeca7 left a comment

Choose a reason for hiding this comment

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

Thank you, @frenck 👍

@c0ffeeca7 c0ffeeca7 merged commit 937e8c3 into current Nov 24, 2025
17 checks passed
@c0ffeeca7 c0ffeeca7 deleted the copilot/update-binary-sensor-commands branch November 24, 2025 07:29
@github-actions github-actions Bot locked and limited conversation to collaborators Nov 25, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

current This PR goes into the current branch

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Binary sensor suggested command

4 participants