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

chore-cleanup-translations #242

Merged
merged 1 commit into from
Aug 23, 2023
Merged
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
3 changes: 3 additions & 0 deletions custom_components/opensprinkler/config_flow.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
import logging

import voluptuous as vol
from aiohttp.client_exceptions import InvalidURL
from homeassistant import config_entries
from homeassistant.const import CONF_MAC, CONF_NAME, CONF_PASSWORD, CONF_URL
from homeassistant.helpers.aiohttp_client import async_get_clientsession
Expand Down Expand Up @@ -55,6 +56,8 @@ async def async_step_user(self, user_input=None):
title=name,
data={CONF_URL: url, CONF_PASSWORD: password, CONF_NAME: name},
)
except InvalidURL:
errors["base"] = "invalid_url"
except OpenSprinklerConnectionError:
errors["base"] = "cannot_connect"
except OpenSprinklerAuthError:
Expand Down
75 changes: 65 additions & 10 deletions custom_components/opensprinkler/strings.json
Original file line number Diff line number Diff line change
@@ -1,25 +1,80 @@
{
"title": "Connect to the OpenSprinkler controller",
"title": "OpenSprinkler",
"config": {
"abort": {
"already_configured": "Device is already configured"
},
"error": {
"invalid_url": "URL is malformed (example: http://192.168.0.1)",
"cannot_connect": "Failed to connect",
"invalid_auth": "Invalid authentication",
"mac_address_required": "MAC Address required for firmware below 2.1.9 (4)",
"unknown": "Unexpected error"
},
"step": {
"user": {
"title": "Connect to the OpenSprinkler Controller",
"data": {
"url": "URL",
"password": "Password",
"mac": "MAC Address",
"name": "Device Name"
"name": "Controller Name"
},
"title": "Connect to the OpenSprinkler controller"
}
}
},
"services": {
"run": {
"name": "Run",
"description": "Runs a controller program or station.",
"fields": {
"entity_id": {
"name": "Entity",
"description": "Sensor or switch entity id for programs or stations."
},
"run_seconds": {
"name": "Run seconds",
"description": "Number of seconds to run (optional for stations, defaults to 60 seconds; required for controllers, list of seconds for each station or index and seconds pairs)."
},
"continue_running_stations": {
"name": "Continue running stations",
"description": "Keeps running stations that are not specified running (only used for controllers with index/second pairs, optional, defaults to False)."
}
}
},
"error": {
"cannot_connect": "[%key:common::config_flow::error::cannot_connect%]",
"invalid_auth": "[%key:common::config_flow::error::invalid_auth%]",
"mac_address_required": "MAC Address required for firmware below 2.1.9 (4)",
"unknown": "[%key:common::config_flow::error::unknown%]"
"stop": {
"name": "Stop",
"description": "Stops a station or all station (for controller).",
"fields": {
"entity_id": {
"name": "Entity",
"description": "Sensor or switch entity id for stations or controller."
}
}
},
"abort": {
"already_configured": "[%key:common::config_flow::abort::already_configured_device%]"
"set_water_level": {
"name": "Set water level",
"description": "Set water level percentage.",
"fields": {
"entity_id": {
"name": "Entity",
"description": "The water level entity to change."
},
"water_level": {
"name": "Water level",
"description": "Percentage of water level."
}
}
},
"reboot": {
"name": "Reboot",
"description": "Reboot the controller.",
"fields": {
"entity_id": {
"name": "Entity",
"description": "Switch entity id for controller."
}
}
}
}
}
17 changes: 9 additions & 8 deletions custom_components/opensprinkler/translations/en.json
Original file line number Diff line number Diff line change
@@ -1,21 +1,23 @@
{
"title": "OpenSprinkler",
"config": {
"abort": {
"already_configured": "[%key:common::config_flow::abort::already_configured_device%]"
"already_configured": "Device is already configured"
},
"error": {
"cannot_connect": "[%key:common::config_flow::error::cannot_connect%]",
"invalid_auth": "[%key:common::config_flow::error::invalid_auth%]",
"invalid_url": "URL is malformed (example: http://192.168.0.1)",
"cannot_connect": "Failed to connect",
"invalid_auth": "Invalid authentication",
"mac_address_required": "MAC Address required for firmware below 2.1.9 (4)",
"unknown": "[%key:common::config_flow::error::unknown%]"
"unknown": "Unexpected error"
},
"step": {
"user": {
"data": {
"url": "URL",
"name": "Controller Name",
"password": "Password",
"mac": "MAC Address"
"mac": "MAC Address",
"name": "Controller Name"
},
"title": "Connect to the OpenSprinkler controller"
}
Expand Down Expand Up @@ -74,6 +76,5 @@
}
}
}
},
"title": "OpenSprinkler"
}
}
Loading