Skip to content

Water Valve

José Antonio Jiménez Campos edited this page May 19, 2023 · 38 revisions

A HomeKit water valve.

Type Service Type
20 Water Value

The following configuration is available for thermostats:

Section Key Description
Actions "0", "1", etc. The actions performed by the service
Inching Time "i" Time period before returning service to previous state
Binary Inputs "b" GPIOs that invoke specific actions
State & Status Inputs "f[n]" & "g[n]" Inputs that manage service state
ICMP Ping Inputs "q[n]" & "p[n]" Ping inputs that manage service state
Service Notifications "m" Notifications to send to another service
Initial Lock State "ks" Lock state at boot
Initial State "s" State a switch service enters on boot
Valve Type "w" Type of valve
Maximum Use Time "d" Maximum time valve can be on
Actions on Boot "xa" Enable / Disable execution of service actions on boot
Historical Data Characteristics

Example

{
  "c": {
    "io": [ [[12,13],2], [[0],6] ],
    "l": 13, "b": [ [ 0, 5 ] ]
  },
  "a": [{
    "t": 20,
    "0": { "r": [ [ 12 ] ] },
    "1": { "r": [ [ 12, 1 ] ] },
    "b": [ [ 0 ] ],
    "s": 0,
    "w": 1,
    "d": 600
  }]
}

The above example defines a Sonoff SV controlling a Water Valve. The valve switch is controlled using GPIO 12 and the valve can be manually turned on and off using a single press button connected to GPIO 0 ("b": [ [ 0 ] ]). The valve is of type "Sprinkler" ("w": 1) and the maximum use time has been set to 10 minutes ("d": 600). The initial state on power up is set to "Off" ("s": 0).

Actions

Key Action Description
"0" OFF (default)
"1" ON

A water valve has two actions. The Digital Outputs "r": [{}] for each should be configured to attain the desired state.

Valve Type

Valve Type defined by the "w" key contained within the service object.

Type Key Description
0 Water Valve (default)
1 Irrigation (Sprinkler)
2 Shower
3 Tap / Faucet

Set the valve type to indicate what type of water device is attached e.g. "w":1 indicates a sprinkler is attached.

Maximum Use Time

Maximum use time is defined by the "d" key contained within the service object.

Key State Description
"d" 0 Timer disabled
3600 Timer set to 1 hour (default)
1 to Time in seconds to set the use time

This option limits the maximum amount of time that the water valve can be in the ON state. The default is to limit the valve on time to 3,600 seconds (1 hour), but this time period can be disabled, lengthened or shortened.

When the timer is enabled then the valve will be turned OFF after the maximum use time has elapsed.

Service Notifications

The list of Service Notifications "m" values supported by a water valve are:

Value Notification
0 Valve OFF (default)
1 Valve ON
-1 Reset timer
-N < -1 Set time to N - 2. If timer is working and new value is lower than current countdown, it will be reset.

See the general Service Notifications section for details of how to configure these notifications.

Binary Inputs

Binary Inputs "b" are supported by this service.

See Binary Inputs for details on how to define this mandatory option.

State and Status Inputs

State inputs "f[n]" & Status Inputs "g[n]" are supported by this service. The supported list is:

Key Action
"f0" Set service state and perform action "0" (Off)
"f1" Set service state and perform action "1" (On)
"g0" Set service state to Off
"g1" Set service state to On

Refer to State Inputs for more detail and examples.

ICMP Ping Inputs

ICMP Ping inputs "p[n]" and "q[n]" are supported by this service. The supported list is:

Key Action
"p0" Set service state and perform action "0" (Off)
"p1" Set service state and perform action "1" (On)
"q0" Set service state to Off
"q1" Set service state to On

Refer to ICMP Ping Inputs for more detail.

Initial Lock State

The Initial Lock State about Service and Physical controls.

Key Value Notification
"ks" 0 All locked
1 Service unlocked. Physical controls locked
2 Service locked. Physical controls unlocked
3 All unlocked (default)

Initial State

The Initial State key is supported by this service. Refer to Initial State for details of the available values.

Historical Data Characteristics

Characteristic Description
0 On / Off
2 Set duration
3 * Remaining duration
Clone this wiki locally