-
Notifications
You must be signed in to change notification settings - Fork 7
CC: Tweaked Integration
Relentless edited this page Jan 8, 2022
·
2 revisions
Energy Meter features a CC: Tweaked integration since version 1.16-1.5.0. We expose several functions and events you can interact with.
You can access each Energy Meter by using a peripheral wrapper.
local em = peripheral.wrap("bottom") -- assumes the Energy Meter is below the computer
getInterval()
getTransferRate()
getThreshold()
getNumberMode()
getMode()
getAccuracy()
getStatus()
getSideConfig(direction) -- valid directions: "NORTH", "EAST", "SOUTH", "WEST", "UP", "DOWN"
getFullSideConfig()
hasInput()
hasOutput()
hasMaxOutputs()
"em_data_changed" -- any Energy Meter data changed (side configuration, mode, status, transfer rate, ...)
"em_removed" -- the Energy Meter was removed
When grabbing the data from the em_data_changed
event, it has the following fields:
side_config,
transfer_rate,
number_mode,
status,
mode,
accuracy,
interval,
threshold
local em = peripheral.wrap("bottom") -- access the Energy Meter below the computer
print(em.hasInput()) -- call a function from the Energy Meter
-- listen to events
while true do
local event, data = os.pullEvent()
if event == "em_data_changed" then
if data.side_config then
print(data.side_config)
end
end
if event == "em_removed" then
print("Energy Meter was removed!")
end
end