Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Changed default status from unavailable to none. #279

Closed
wants to merge 4 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 6 additions & 4 deletions LOCALIZATION.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,9 @@ Help us translate the integration to your own language using the following steps
2. Go to the directory [`custom_components/google_home/translations`](/custom_components/google_home/translations).
3. Create a new `.json` file with the name of your desired language in the [BCP47](https://www.rfc-editor.org/info/bcp47) format.
4. Fill-in the translation file following the example of `en.json`.
5. Add your language to the [Localization](https://github.com/leikoilja/ha-google-home#localization) section in the README.
6. Commit your modifications.
7. Open a PR.
8. Enjoy.
5. Create a new `.json` file with the name of your desired language in the [BCP47](https://www.rfc-editor.org/info/bcp47) format prefixed by `sensor.`. For example: `sensor.en.json` for English (`en`).
6. Fill-in the translation file following the example of `sensor.en.json`.
7. Add your language to the [Localization](https://github.com/leikoilja/ha-google-home#localization) section in the README.
8. Commit your modifications.
9. Open a PR.
10. Enjoy.
2 changes: 2 additions & 0 deletions custom_components/google_home/const.py
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,8 @@
LABEL_DEVICE: Final[str] = "device"
LABEL_DO_NOT_DISTURB: Final[str] = "Do Not Disturb"

STATE_NONE = "none"

# DEVICE PORT
PORT: Final[int] = 8443

Expand Down
7 changes: 4 additions & 3 deletions custom_components/google_home/sensor.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
import voluptuous as vol

from homeassistant.config_entries import ConfigEntry
from homeassistant.const import DEVICE_CLASS_TIMESTAMP, STATE_UNAVAILABLE
from homeassistant.const import DEVICE_CLASS_TIMESTAMP
from homeassistant.core import HomeAssistant
from homeassistant.helpers import config_validation as cv, entity_platform
from homeassistant.helpers.entity import Entity
Expand All @@ -29,6 +29,7 @@
SERVICE_DELETE_ALARM,
SERVICE_DELETE_TIMER,
SERVICE_REBOOT,
STATE_NONE,
)
from .entity import GoogleHomeBaseEntity
from .models import GoogleHomeAlarmStatus, GoogleHomeDevice, GoogleHomeTimerStatus
Expand Down Expand Up @@ -181,7 +182,7 @@ def state(self) -> str | None:
return (
next_alarm.local_time_iso
if next_alarm and next_alarm.status != GoogleHomeAlarmStatus.INACTIVE
else STATE_UNAVAILABLE
else STATE_NONE
)

@property
Expand Down Expand Up @@ -269,7 +270,7 @@ def state(self) -> str | None:
return (
timer.local_time_iso
if timer and timer.local_time_iso
else STATE_UNAVAILABLE
else STATE_NONE
)

@property
Expand Down
7 changes: 7 additions & 0 deletions custom_components/google_home/translations/sensor.en.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"state": {
"timestamp": {
"none": "None"
}
}
}