Skip to content

Commit

Permalink
migrate netro watering services to support translations and translate…
Browse files Browse the repository at this point in the history
… to french and spanish
  • Loading branch information
kcofoni committed Aug 6, 2023
1 parent 00653aa commit ae36738
Show file tree
Hide file tree
Showing 8 changed files with 710 additions and 323 deletions.
13 changes: 4 additions & 9 deletions custom_components/netro_watering/manifest.json
Original file line number Diff line number Diff line change
@@ -1,20 +1,15 @@
{
"domain": "netro_watering",
"name": "Netro Watering",
"codeowners": [
"@kcofoni"
],
"codeowners": ["@kcofoni"],
"config_flow": true,
"dependencies": [],
"documentation": "https://github.com/kcofoni/ha-netro-watering",
"homekit": {},
"iot_class": "cloud_polling",
"issue_tracker": "https://github.com/kcofoni/ha-netro-watering/issues",
"requirements": [
"requests==2.31.0",
"validators==0.20.0"
],
"requirements": ["requests==2.31.0", "validators==0.20.0"],
"ssdp": [],
"version": "1.1.3",
"version": "1.1.4",
"zeroconf": []
}
}
1 change: 1 addition & 0 deletions custom_components/netro_watering/netrofunction.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@
NETRO_ERROR_CODE_PARAMETER_ERROR = 6


# ruff: noqa
def set_netro_base_url(url: str):
"""Change the Netro Public API url."""
global netro_base_url # pylint: disable=global-statement
Expand Down
50 changes: 0 additions & 50 deletions custom_components/netro_watering/services.yaml
Original file line number Diff line number Diff line change
@@ -1,34 +1,22 @@
refresh_data:
name: Refresh data
description: Refresh data of Netro devices (controller, zone, sensors)
fields:
config_entry_id:
name: Config entry
description: The configuration entry whose devices to be refreshed are referring to
required: true
selector:
config_entry:
integration: netro_watering
report_weather:
name: Report weather
description: This is for reporting weather data, overriding system default weather data
fields:
config_entry_id:
name: Config entry
description: The configuration entry whose weather data should be reported
required: true
selector:
config_entry:
integration: netro_watering
date:
name: Date
description: Weather date, can not be earlier than yesterday
required: true
selector:
date:
condition:
name: Condition
description: Weather condition
required: false
selector:
select:
Expand All @@ -39,8 +27,6 @@ report_weather:
- snow
- wind
rain:
name: Rain
description: Rain fall amount (floating value in mm)
required: false
selector:
number:
Expand All @@ -50,17 +36,13 @@ report_weather:
mode: box
unit_of_measurement: "mm"
rain_prob:
name: Rain probability
description: Rainfall probability, in the range of [0,100]
required: false
selector:
number:
min: 0
max: 100
unit_of_measurement: "%"
temp:
name: Temperature
description: Average temperature, Celsius temperature
required: false
selector:
number:
Expand All @@ -69,8 +51,6 @@ report_weather:
step: 0.1
unit_of_measurement: "°C"
t_min:
name: Minimum temperature
description: Minimum temperature, Celsius temperature
required: false
selector:
number:
Expand All @@ -79,8 +59,6 @@ report_weather:
step: 0.1
unit_of_measurement: "°C"
t_max:
name: Maximum temperature
description: Maximum temperature, Celsius temperature
required: false
selector:
number:
Expand All @@ -89,8 +67,6 @@ report_weather:
step: 0.1
unit_of_measurement: "°C"
t_dew:
name: Dew temperature
description: Dew point temperature, Celsius temperature
required: false
selector:
number:
Expand All @@ -99,8 +75,6 @@ report_weather:
step: 0.1
unit_of_measurement: "°C"
wind_speed:
name: Wind speed
description: Wind speed, unit of m/s
required: false
selector:
number:
Expand All @@ -109,17 +83,13 @@ report_weather:
step: 0.01
unit_of_measurement: "m/s"
humidity:
name: Humidity
description: Humidity, in the range of [0,100]
required: false
selector:
number:
min: 0
max: 100
unit_of_measurement: "%"
pressure:
name: Pressure
description: Air pressure, in the unit of hpa
required: false
selector:
number:
Expand All @@ -129,38 +99,28 @@ report_weather:
unit_of_measurement: "hpa"
mode: box
set_moisture:
name: Set moisture
description: Set moisture value to a given zone, a way to provide Netro with the value of an external sensor
fields:
zone_id:
name: Zone
description: The zone whose moisture should be set
required: true
selector:
device:
integration: netro_watering
filter:
model: Virtual zone
moisture:
name: Moisture
description: The humidity value to be set to the zone (in %)
required: true
selector:
number:
min: 0
max: 100
unit_of_measurement: "%"
start_watering:
name: Start watering
description: Start watering for a specified duration, delay before start, or start time and date
target:
entity:
integration: netro_watering
domain: switch
fields:
duration:
name: Duration
description: Duration of activation of this sprinkler
required: true
default: 30
selector:
Expand All @@ -169,37 +129,27 @@ start_watering:
max: 90
unit_of_measurement: "minutes"
delay:
name: Delay
description: Waiting time before starting watering
required: false
selector:
number:
min: 0
max: 90
unit_of_measurement: "minutes"
start_time:
name: Start time
description: Watering start date and time
required: false
selector:
datetime:
stop_watering:
name: Stop watering
description: Stop watering all zones at once or a specific zone
target:
entity:
integration: netro_watering
domain: switch
enable:
name: Enable
description: Enable the selected controller
target:
entity:
integration: netro_watering
domain: switch
disable:
name: Disable
description: Disable the selected controller
target:
entity:
integration: netro_watering
Expand Down
110 changes: 110 additions & 0 deletions custom_components/netro_watering/strings.json
Original file line number Diff line number Diff line change
Expand Up @@ -130,5 +130,115 @@
}
}
}
},
"services": {
"refresh_data": {
"name": "Refresh data",
"description": "Refresh data of Netro devices (controller, zone, sensors)",
"fields": {
"config_entry_id": {
"name": "Config entry",
"description": "The configuration entry whose devices to be refreshed are referring to"
}
}
},
"report_weather": {
"name": "Report weather",
"description": "This is for reporting weather data, overriding system default weather data",
"fields": {
"config_entry_id": {
"name": "Config entry",
"description": "The configuration entry whose weather data should be reported"
},
"date": {
"name": "Date",
"description": "Weather date, can not be earlier than yesterday"
},
"condition": {
"name": "Condition",
"description": "Weather condition"
},
"rain": {
"name": "Rain",
"description": "Rain fall amount (floating value in mm)"
},
"rain_prob": {
"name": "Rain probability",
"description": "Rainfall probability, in the range of [0,100]"
},
"temp": {
"name": "Temperature",
"description": "Average temperature, Celsius temperature"
},
"t_min": {
"name": "Minimum temperature",
"description": "Minimum temperature, Celsius temperature"
},
"t_max": {
"name": "Maximum temperature",
"description": "Maximum temperature, Celsius temperature"
},
"t_dew": {
"name": "Dew temperature",
"description": "Dew point temperature, Celsius temperature"
},
"wind_speed": {
"name": "Wind speed",
"description": "Wind speed, unit of m/s"
},
"humidity": {
"name": "Humidity",
"description": "Humidity, in the range of [0,100]"
},
"pressure": {
"name": "Pressure",
"description": "Air pressure, in the unit of hpa"
}
}
},
"set_moisture": {
"name": "Set moisture",
"description": "Set moisture value to a given zone, a way to provide Netro with the value of an external sensor",
"fields": {
"zone_id": {
"name": "Zone",
"description": "The zone whose moisture should be set"
},
"moisture": {
"name": "Moisture",
"description": "The humidity value to be set to the zone (in %)"
}
}
},
"start_watering": {
"name": "Start watering",
"description": "Start watering for a specified duration, delay before start, or start time and date",
"fields": {
"duration": {
"name": "Duration",
"description": "Duration of activation of this sprinkler"
},
"delay": {
"name": "Delay",
"description": "Waiting time before starting watering"
},
"start_time": {
"name": "Start time",
"description": "Watering start date and time"
}
}
},
"stop_watering": {
"name": "Stop watering",
"description": "Stop watering all zones at once or a specific zone"
},
"enable": {
"name": "Enable",
"description": "Enable the selected controller"
},
"disable": {
"name": "Disable",
"description": "Disable the selected controller"
}
}
}
1 change: 1 addition & 0 deletions custom_components/netro_watering/switch.py
Original file line number Diff line number Diff line change
Expand Up @@ -243,6 +243,7 @@ def is_on(self) -> bool:
return self.coordinator.enabled


# ruff: noqa
class ZoneWateringSwitch(
CoordinatorEntity[NetroControllerUpdateCoordinator], SwitchEntity
):
Expand Down
Loading

0 comments on commit ae36738

Please sign in to comment.