From 7714160f4cc751326e9f50da6afc730829270854 Mon Sep 17 00:00:00 2001 From: Marius <33354141+Mariusthvdb@users.noreply.github.com> Date: Fri, 28 Feb 2020 12:34:39 +0100 Subject: [PATCH] Change github sensor state to short commit sha (#31581) * change state to latest_release_url to have a meaningful frontend representation. self._github_data.latest_commit_sha is still available in the attributes, so no info is lost * template state to show only the tag and not the full url to the tag * add guard to update(self) for state * add empty line 150 black... * Update sensor.py * add SHA if no release url * Correct sha to 7 digits * take out fallback on state --- homeassistant/components/github/sensor.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/homeassistant/components/github/sensor.py b/homeassistant/components/github/sensor.py index c77cf7930b8..406876de807 100644 --- a/homeassistant/components/github/sensor.py +++ b/homeassistant/components/github/sensor.py @@ -132,12 +132,12 @@ class GitHubSensor(Entity): self._github_data.update() self._name = self._github_data.name - self._state = self._github_data.latest_commit_sha self._repository_path = self._github_data.repository_path self._available = self._github_data.available self._latest_commit_message = self._github_data.latest_commit_message self._latest_commit_sha = self._github_data.latest_commit_sha self._latest_release_url = self._github_data.latest_release_url + self._state = self._github_data.latest_commit_sha[0:8] self._open_issue_count = self._github_data.open_issue_count self._latest_open_issue_url = self._github_data.latest_open_issue_url self._pull_request_count = self._github_data.pull_request_count