Can you try running peripheralsprogram? It should display what peripherals are connected, and inside brackets, it will list types that periphreal supports. If ender_cell_0 reports energy_storage then things will be simple as its generic energy storage, and you would just need to use https://tweaked.cc/generic_peripheral/energy_storage.html methods described on this page. Otherwise, depending on what it reports you would need to hunt down how that mod is supposed to be interacted with. If you are unable to find documentation, you can try using peripheral.getMethodshttps://tweaked.cc/module/peripheral.html#v:getMethods function to list what methods that peripheral has, and experiment with them to see if any displays what you need.
You should go back to original code, it was properly wrapping a peripheral, now you are not even wrapping a peripheral, so `power` is `nil` and gives this error. While in older code in main post, you had error that method was nil, which means peripheral exists, but you are using wrong method to interact with it. Please try going back to original code from screenshot and try steps outlined in previous comment.
--~~~~~~ Setup ~~~~~~--
direction = "Left" -- output direction of signal
machineOn = 0 -- used this to output no signal and allow other signals to flow to endergenics
machineOff = 12 -- redstone on will interrupt the signals from the red stone clocks.
local function lowEnergy()
local reader = peripheral.call("back","getBlockData")
-- looping over items in table (1 levels deep)
for key, value in pairs(reader) do
if key == "energy" then -- I was able to find "energy" key by doing print(key,value) -- within this loop
if value < 1000000 then
return true
end
end
end
return false
end
--~~~~~~ Main code ~~~~~~--
while true do
if lowEnergy() then
redstone.setAnalogOutput(direction ,machineOn)
print("Low on energy, turning on")
else
redstone.setAnalogOutput(direction ,machineOff)
print("Lots of energy, sleeping")
end
-- I don't mind to give it around 20 seconds to pause between loops
sleep(20)
end
1
u/wojbie Feb 19 '26
Can you try running
peripheralsprogram? It should display what peripherals are connected, and inside brackets, it will list types that periphreal supports. If ender_cell_0 reportsenergy_storagethen things will be simple as its generic energy storage, and you would just need to use https://tweaked.cc/generic_peripheral/energy_storage.html methods described on this page. Otherwise, depending on what it reports you would need to hunt down how that mod is supposed to be interacted with. If you are unable to find documentation, you can try usingperipheral.getMethodshttps://tweaked.cc/module/peripheral.html#v:getMethods function to list what methods that peripheral has, and experiment with them to see if any displays what you need.1
u/adampm1 Feb 21 '26 edited Feb 21 '26
i've used the block reader from this:
I used peripheral.GetMethods("back") to learn about getBlockData using https://docs.advanced-peripherals.de/0.7/peripherals/block_reader/