|  Developer
Updated on November 23, 2021

PlugHub module API ( require “plughub” )

Edit
  • Subscribe a script for PlugHub events. After subscribing the script will be launched for each event happens on a PlugHub addon and information about this event will be passed as a parameter.
Edit
Edit
  • params: script name (string).
Edit
  • return: none.
Edit
				
					 local plughub = require "plughub"

    plughub.subscribe( "HUB:plughub/scripts/events_handling" )				
			
Edit
  • Unsubscribe a script from PlugHub events.
Edit
Edit
  • params: script name (string).
Edit
  • return: none.
Edit
				
					local plughub = require "plughub"

    plughub.unsubscribe( "HUB:plughub/scripts/events_handling" )				
			
Edit
  • Request updating of all plughub values
Edit
Edit
  • params: none
Edit
  • return: none
Edit
				
					local plughub = require "plughub"

    plughub.request_all_values()				
			
Edit
  • Reset consumed energy meter to default (sets value to 0.0)
Edit
Edit
  • params: none.
Edit
  • return: none.
Edit
				
					local plughub = require "plughub"

    plughub.reset_consumed_energy_meter()				
			
Edit
  • Set switch value
Edit
Edit
  • params: value (bool).
Edit
  • return: none.
Edit
				
					local plughub = require "plughub"

    plughub.set_switch_value(true)