Migrate Z-Wave services to support translations (#96361)

* Migrate Z-Wave services to support translations

* Apply suggestions from code review

Co-authored-by: c0ffeeca7 <38767475+c0ffeeca7@users.noreply.github.com>

* Apply suggestions from code review

Co-authored-by: c0ffeeca7 <38767475+c0ffeeca7@users.noreply.github.com>

---------

Co-authored-by: c0ffeeca7 <38767475+c0ffeeca7@users.noreply.github.com>
Co-authored-by: Martin Hjelmare <marhje52@gmail.com>
This commit is contained in:
Franck Nijhof 2023-07-13 09:49:05 +02:00 committed by GitHub
parent bc9b763688
commit d025b97bb9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 188 additions and 84 deletions

View File

@ -1,105 +1,77 @@
# Describes the format for available Z-Wave services
clear_lock_usercode:
name: Clear a usercode from a lock
description: Clear a usercode from a lock
target:
entity:
domain: lock
integration: zwave_js
fields:
code_slot:
name: Code slot
description: Code slot to clear code from
required: true
example: 1
selector:
text:
set_lock_usercode:
name: Set a usercode on a lock
description: Set a usercode on a lock
target:
entity:
domain: lock
integration: zwave_js
fields:
code_slot:
name: Code slot
description: Code slot to set the code.
required: true
example: 1
selector:
text:
usercode:
name: Code
description: Code to set.
required: true
example: 1234
selector:
text:
set_config_parameter:
name: Set a Z-Wave device configuration parameter
description: Allow for changing configuration parameters of your Z-Wave devices.
target:
entity:
integration: zwave_js
fields:
endpoint:
name: Endpoint
description: The configuration parameter's endpoint.
example: 1
default: 0
required: false
selector:
text:
parameter:
name: Parameter
description: The (name or id of the) configuration parameter you want to configure.
example: Minimum brightness level
required: true
selector:
text:
bitmask:
name: Bitmask
description: Target a specific bitmask (see the documentation for more information).
advanced: true
selector:
text:
value:
name: Value
description: The new value to set for this configuration parameter.
example: 5
required: true
selector:
text:
bulk_set_partial_config_parameters:
name: Bulk set partial configuration parameters for a Z-Wave device (Advanced).
description: Allow for bulk setting partial parameters. Useful when multiple partial parameters have to be set at the same time.
target:
entity:
integration: zwave_js
fields:
endpoint:
name: Endpoint
description: The configuration parameter's endpoint.
example: 1
default: 0
required: false
selector:
text:
parameter:
name: Parameter
description: The id of the configuration parameter you want to configure.
example: 9
required: true
selector:
text:
value:
name: Value
description: The new value(s) to set for this configuration parameter. Can either be a raw integer value to represent the bulk change or a mapping where the key is the bitmask (either in hex or integer form) and the value is the new value you want to set for that partial parameter.
example: |
"0x1": 1
"0x10": 1
@ -110,12 +82,8 @@ bulk_set_partial_config_parameters:
object:
refresh_value:
name: Refresh value(s) of a Z-Wave entity
description: Force update value(s) for a Z-Wave entity
fields:
entity_id:
name: Entities
description: Entities to refresh values for.
required: true
example: |
- sensor.family_room_motion
@ -125,184 +93,132 @@ refresh_value:
integration: zwave_js
multiple: true
refresh_all_values:
name: Refresh all values?
description: Whether to refresh all values (true) or just the primary value (false)
default: false
selector:
boolean:
set_value:
name: Set a value on a Z-Wave device (Advanced)
description: Allow for changing any value that Z-Wave JS recognizes on a Z-Wave device. This service has minimal validation so only use this service if you know what you are doing.
target:
entity:
integration: zwave_js
fields:
command_class:
name: Command Class
description: The ID of the command class for the value.
example: 117
required: true
selector:
text:
endpoint:
name: Endpoint
description: The endpoint for the value.
example: 1
required: false
selector:
text:
property:
name: Property
description: The ID of the property for the value.
example: currentValue
required: true
selector:
text:
property_key:
name: Property Key
description: The ID of the property key for the value
example: 1
required: false
selector:
text:
value:
name: Value
description: The new value to set.
example: "ffbb99"
required: true
selector:
object:
options:
name: Options
description: Set value options map. Refer to the Z-Wave JS documentation for more information on what options can be set.
required: false
selector:
object:
wait_for_result:
name: Wait for result?
description: Whether or not to wait for a response from the node. If not included in the payload, the integration will decide whether to wait or not. If set to `true`, note that the service call can take a while if setting a value on an asleep battery device.
required: false
selector:
boolean:
multicast_set_value:
name: Set a value on multiple Z-Wave devices via multicast (Advanced)
description: Allow for changing any value that Z-Wave JS recognizes on multiple Z-Wave devices using multicast, so all devices receive the message simultaneously. This service has minimal validation so only use this service if you know what you are doing.
target:
entity:
integration: zwave_js
fields:
broadcast:
name: Broadcast?
description: Whether command should be broadcast to all devices on the network.
example: true
required: false
selector:
boolean:
command_class:
name: Command Class
description: The ID of the command class for the value.
example: 117
required: true
selector:
text:
endpoint:
name: Endpoint
description: The endpoint for the value.
example: 1
required: false
selector:
text:
property:
name: Property
description: The ID of the property for the value.
example: currentValue
required: true
selector:
text:
property_key:
name: Property Key
description: The ID of the property key for the value
example: 1
required: false
selector:
text:
options:
name: Options
description: Set value options map. Refer to the Z-Wave JS documentation for more information on what options can be set.
required: false
selector:
object:
value:
name: Value
description: The new value to set.
example: "ffbb99"
required: true
selector:
object:
ping:
name: Ping a node
description: Forces Z-Wave JS to try to reach a node. This can be used to update the status of the node in Z-Wave JS when you think it doesn't accurately reflect reality, e.g. reviving a failed/dead node or marking the node as asleep.
target:
entity:
integration: zwave_js
reset_meter:
name: Reset meter(s) on a node
description: Resets the meter(s) on a node.
target:
entity:
domain: sensor
integration: zwave_js
fields:
meter_type:
name: Meter Type
description: The type of meter to reset. Not all meters support the ability to pick a meter type to reset.
example: 1
required: false
selector:
text:
value:
name: Target Value
description: The value that meter(s) should be reset to. Not all meters support the ability to be reset to a specific value.
example: 5
required: false
selector:
text:
invoke_cc_api:
name: Invoke a Command Class API on a node (Advanced)
description: Allows for calling a Command Class API on a node. Some Command Classes can't be fully controlled via the `set_value` service and require direct calls to the Command Class API.
target:
entity:
integration: zwave_js
fields:
command_class:
name: Command Class
description: The ID of the command class that you want to issue a command to.
example: 132
required: true
selector:
text:
endpoint:
name: Endpoint
description: The endpoint to call the API on. If an endpoint is specified, that endpoint will be targeted for all nodes associated with the target areas, devices, and/or entities. If an endpoint is not specified, the root endpoint (0) will be targeted for nodes associated with target areas and devices, and the endpoint for the primary value of each entity will be targeted.
example: 1
required: false
selector:
text:
method_name:
name: Method Name
description: The name of the API method to call. Refer to the Z-Wave JS Command Class API documentation (https://zwave-js.github.io/node-zwave-js/#/api/CCs/index) for available methods.
example: setInterval
required: true
selector:
text:
parameters:
name: Parameters
description: A list of parameters to pass to the API method. Refer to the Z-Wave JS Command Class API documentation (https://zwave-js.github.io/node-zwave-js/#/api/CCs/index) for parameters.
example: "[1, 1]"
required: true
selector:

View File

@ -151,5 +151,193 @@
"title": "Newer version of Z-Wave JS Server needed",
"description": "The version of Z-Wave JS Server you are currently running is too old for this version of Home Assistant. Please update the Z-Wave JS Server to the latest version to fix this issue."
}
},
"services": {
"clear_lock_usercode": {
"name": "Clear lock user code",
"description": "Clears a user code from a lock.",
"fields": {
"code_slot": {
"name": "Code slot",
"description": "Code slot to clear code from."
}
}
},
"set_lock_usercode": {
"name": "Set lock user code",
"description": "Sets a user code on a lock.",
"fields": {
"code_slot": {
"name": "[%key:component::zwave_js::services::clear_lock_usercode::fields::code_slot::name%]",
"description": "Code slot to set the code."
},
"usercode": {
"name": "Code",
"description": "Lock code to set."
}
}
},
"set_config_parameter": {
"name": "Set device configuration parameter",
"description": "Changes the configuration parameters of your Z-Wave devices.",
"fields": {
"endpoint": {
"name": "Endpoint",
"description": "The configuration parameter's endpoint."
},
"parameter": {
"name": "Parameter",
"description": "The name (or ID) of the configuration parameter you want to configure."
},
"bitmask": {
"name": "Bitmask",
"description": "Target a specific bitmask (see the documentation for more information)."
},
"value": {
"name": "Value",
"description": "The new value to set for this configuration parameter."
}
}
},
"bulk_set_partial_config_parameters": {
"name": "Bulk set partial configuration parameters (advanced).",
"description": "Allows for bulk setting partial parameters. Useful when multiple partial parameters have to be set at the same time.",
"fields": {
"endpoint": {
"name": "[%key:component::zwave_js::services::set_config_parameter::fields::endpoint::name%]",
"description": "[%key:component::zwave_js::services::set_config_parameter::fields::endpoint::description%]"
},
"parameter": {
"name": "[%key:component::zwave_js::services::set_config_parameter::fields::parameter::name%]",
"description": "[%key:component::zwave_js::services::set_config_parameter::fields::parameter::description%]"
},
"value": {
"name": "[%key:component::zwave_js::services::set_config_parameter::fields::value::name%]",
"description": "The new value(s) to set for this configuration parameter. Can either be a raw integer value to represent the bulk change or a mapping where the key is the bitmask (either in hex or integer form) and the value is the new value you want to set for that partial parameter."
}
}
},
"refresh_value": {
"name": "Refresh values",
"description": "Force updates the values of a Z-Wave entity.",
"fields": {
"entity_id": {
"name": "Entities",
"description": "Entities to refresh."
},
"refresh_all_values": {
"name": "Refresh all values?",
"description": "Whether to refresh all values (true) or just the primary value (false)."
}
}
},
"set_value": {
"name": "Set a value (advanced)",
"description": "Changes any value that Z-Wave JS recognizes on a Z-Wave device. This service has minimal validation so only use this service if you know what you are doing.",
"fields": {
"command_class": {
"name": "Command class",
"description": "The ID of the command class for the value."
},
"endpoint": {
"name": "[%key:component::zwave_js::services::set_config_parameter::fields::endpoint::name%]",
"description": "The endpoint for the value."
},
"property": {
"name": "Property",
"description": "The ID of the property for the value."
},
"property_key": {
"name": "Property key",
"description": "The ID of the property key for the value."
},
"value": {
"name": "[%key:component::zwave_js::services::set_config_parameter::fields::value::name%]",
"description": "The new value to set."
},
"options": {
"name": "Options",
"description": "Set value options map. Refer to the Z-Wave JS documentation for more information on what options can be set."
},
"wait_for_result": {
"name": "Wait for result?",
"description": "Whether or not to wait for a response from the node. If not included in the payload, the integration will decide whether to wait or not. If set to `true`, note that the service call can take a while if setting a value on an asleep battery device."
}
}
},
"multicast_set_value": {
"name": "Set a value on multiple devices via multicast (advanced)",
"description": "Changes any value that Z-Wave JS recognizes on multiple Z-Wave devices using multicast, so all devices receive the message simultaneously. This service has minimal validation so only use this service if you know what you are doing.",
"fields": {
"broadcast": {
"name": "Broadcast?",
"description": "Whether command should be broadcast to all devices on the network."
},
"command_class": {
"name": "[%key:component::zwave_js::services::set_value::fields::command_class::name%]",
"description": "[%key:component::zwave_js::services::set_value::fields::command_class::description%]"
},
"endpoint": {
"name": "[%key:component::zwave_js::services::set_config_parameter::fields::endpoint::name%]",
"description": "[%key:component::zwave_js::services::set_value::fields::endpoint::description%]"
},
"property": {
"name": "[%key:component::zwave_js::services::set_value::fields::property::name%]",
"description": "[%key:component::zwave_js::services::set_value::fields::property::description%]"
},
"property_key": {
"name": "[%key:component::zwave_js::services::set_value::fields::property_key::name%]",
"description": "[%key:component::zwave_js::services::set_value::fields::property_key::description%]"
},
"options": {
"name": "[%key:component::zwave_js::services::set_value::fields::options::name%]",
"description": "[%key:component::zwave_js::services::set_value::fields::options::description%]"
},
"value": {
"name": "[%key:component::zwave_js::services::set_config_parameter::fields::value::name%]",
"description": "[%key:component::zwave_js::services::set_value::fields::value::description%]"
}
}
},
"ping": {
"name": "Ping a node",
"description": "Forces Z-Wave JS to try to reach a node. This can be used to update the status of the node in Z-Wave JS when you think it doesn't accurately reflect reality, e.g. reviving a failed/dead node or marking the node as asleep."
},
"reset_meter": {
"name": "Reset meters on a node",
"description": "Resets the meters on a node.",
"fields": {
"meter_type": {
"name": "Meter type",
"description": "The type of meter to reset. Not all meters support the ability to pick a meter type to reset."
},
"value": {
"name": "Target value",
"description": "The value that meters should be reset to. Not all meters support the ability to be reset to a specific value."
}
}
},
"invoke_cc_api": {
"name": "Invoke a Command Class API on a node (advanced)",
"description": "Calls a Command Class API on a node. Some Command Classes can't be fully controlled via the `set_value` service and require direct calls to the Command Class API.",
"fields": {
"command_class": {
"name": "[%key:component::zwave_js::services::set_value::fields::command_class::name%]",
"description": "The ID of the command class that you want to issue a command to."
},
"endpoint": {
"name": "[%key:component::zwave_js::services::set_config_parameter::fields::endpoint::name%]",
"description": "The endpoint to call the API on. If an endpoint is specified, that endpoint will be targeted for all nodes associated with the target areas, devices, and/or entities. If an endpoint is not specified, the root endpoint (0) will be targeted for nodes associated with target areas and devices, and the endpoint for the primary value of each entity will be targeted."
},
"method_name": {
"name": "Method name",
"description": "The name of the API method to call. Refer to the Z-Wave JS Command Class API documentation (https://zwave-js.github.io/node-zwave-js/#/api/CCs/index) for available methods."
},
"parameters": {
"name": "Parameters",
"description": "A list of parameters to pass to the API method. Refer to the Z-Wave JS Command Class API documentation (https://zwave-js.github.io/node-zwave-js/#/api/CCs/index) for parameters."
}
}
}
}
}