diff --git a/energy_control b/energy_control index ceae146..39d3baa 100644 --- a/energy_control +++ b/energy_control @@ -1,7 +1,7 @@ local hostname = "pocket_computer" .. os.getComputerID() redstone_toggle_id = 50 -de_store_mon_id = nil +de_store_mon_id = 45 function dump(o) if o == nil then @@ -26,7 +26,7 @@ function poll() rednet.send(redstone_toggle_id, "get_state") end if de_store_mon_id ~= nil then - -- todo + rednet.send(de_store_mon_id, "get_stats") end sleep(1) end @@ -45,7 +45,18 @@ function recv() end end elseif id == de_store_mon_id then - -- todo + if type(data) == 'table' then + if data[1] == 'energyStored' then + de_store_energy_stored = data[2] + end + if data[3] == 'maxEnergyStored' then + de_store_max_energy_stored = data[4] + end + if data[5] == 'transferPerTick' then + de_store_transfer_per_tick = data[6] + end + updated = true + end end if updated == true then @@ -66,6 +77,10 @@ function recv() write('Unknown\n') end term.setBackgroundColor(colors.black) + print('Draconic Storage') + print('Current: ' .. de_store_energy_stored) + print('Max: ' .. de_store_max_energy_stored) + print('Transfer per Tick: ' .. de_store_transfer_per_tick) end end end