improved bosminer get config again, created set_config_format
This commit is contained in:
5
main.py
5
main.py
@@ -6,8 +6,9 @@ import asyncio
|
|||||||
async def main():
|
async def main():
|
||||||
miner_network = MinerNetwork('192.168.1.1')
|
miner_network = MinerNetwork('192.168.1.1')
|
||||||
data = await miner_network.scan_network_for_miners()
|
data = await miner_network.scan_network_for_miners()
|
||||||
config = await asyncio.gather(*[miner.get_config() for miner in data if isinstance(miner, BOSminer)])
|
await data[0].get_config()
|
||||||
print(config)
|
config = await data[0].set_config_format()
|
||||||
|
print(config['format'])
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
asyncio.get_event_loop().run_until_complete(main())
|
asyncio.get_event_loop().run_until_complete(main())
|
||||||
|
|||||||
@@ -2,6 +2,7 @@ from miners import BaseMiner
|
|||||||
from API.bosminer import BOSMinerAPI
|
from API.bosminer import BOSMinerAPI
|
||||||
import asyncssh
|
import asyncssh
|
||||||
import toml
|
import toml
|
||||||
|
import time
|
||||||
|
|
||||||
|
|
||||||
class BOSminer(BaseMiner):
|
class BOSminer(BaseMiner):
|
||||||
@@ -62,3 +63,8 @@ class BOSminer(BaseMiner):
|
|||||||
toml_data = toml.loads(await file.read())
|
toml_data = toml.loads(await file.read())
|
||||||
self.config = toml_data
|
self.config = toml_data
|
||||||
return toml_data
|
return toml_data
|
||||||
|
|
||||||
|
async def set_config_format(self):
|
||||||
|
self.config['format']['generator'] = 'upstream_data_configurator'
|
||||||
|
self.config['format']['timestamp'] = int(time.time())
|
||||||
|
return self.config
|
||||||
|
|||||||
Reference in New Issue
Block a user