|  Developer
Updated on May 6, 2022

WaterValve module API ( require “water_valve” )

Edit
  • Subscribe a script for WaterValve events. After subscribing the script will be launched for each event happens on a WaterValve addon and information about this event will be passed as a parameter.
Edit

  • params: script name (string).
  • return: none.
Edit
				
					local water_valve = require "water_valve"

water_valve.subscribe( "HUB:water_valve/scripts/events_handling" )				
			
Edit
  • Unsubscribe a script from WaterValve events.
Edit

  • params: script name (string).
  • return: none.
Edit
				
					local water_valve = require "water_valve"

water_valve.unsubscribe( "HUB:water_valve/scripts/events_handling" )				
			
Edit
  • Request updating of all water valve values
Edit

  • params: none
  • return: none
Edit
				
					local water_valve = require "water_valve"

water_valve.request_all_values()				
			
Edit
  • Set valve value ( is valve opened )
Edit

  • params: value (bool).
  • return: none.
Edit
				
					local water_valve = require "water_valve"

water_valve.set_water_switch_value(true)				
			
Edit
  • Gets count of water leak sensors on device
Edit

  • params: none.
  • return: int.
Edit
				
					local water_valve = require "water_valve"

local count = water_valve.get_water_leak_sensors_count()				
			
Edit
  • Identifies, if valve control should be inverted on UI.
Edit

  • params: none.
  • return: bool.
Edit
				
					local water_valve = require "water_valve"

    local invert = water_valve.should_invert_control()