Package: pyrevive
PyReviveRevive Hardware Restarter API LibraryThis Python package is meant for interfacing with the Revive Hardware Restarter HTTP API.  Revive is a hardware restarter and monitor for cryptocurrency mining rigs.You can find out more and buy onehereIf you find this library helpful, donations are greatly appreciated:Ethereum: 0x7472a4812200fc320793a946f027d559e63b164dEthereum Classic: 0x20282a304c20399b6534cef6196a99978cb89588Bitcoin: 1LvnfMGfz8xTaZgi25DiRFaJoFvpAPncT5Bitcoin Cash: 1Ec3CPq3WPsWT7fQaDGgTYkVPNtMZ3CVaALitecoin: LSZBbS7EsKnjXQ1FKxYuAmR5quzEazXfm1Electroneum: etnk3yDpybAEBqz3nq63qmev4thRi9eFH64CVKzZc2w3A7vehpZkGvd97uSWxtmtAwjTnfKEp9Rup3md7nZyu9Q49VzZQKhxWNInstalling using PIPpip install pyreviveInstalling from sourcegit clone https://github.com/RevolutionRigs/pyrevive.git
cd pyrevive/
pip install .If you do not want to install using pip you may install using setup.pygit clone https://github.com/RevolutionRigs/pyrevive.git
cd pyrevive/
python setup.py installImportingimport pyreviveConnectingThe connect() method takes two arguments: host[:port], authorizationKey
The authorization key can be found on the bottom of your Revive.revive = pyrevive.connect("192.168.1.254", "authorizationKey")VersionGet the current version of PyReviveprint(revive.__version__)PowerPerform power on, off, reset functions on a Revive port (aka rig)Power on rig 1revive.power.on(1)Power off rig 1revive.power.off(1)Power cycle rig 1All cycle/reset/restart methods are aliases of one another and do the same thingrevive.power.cycle(1)
revive.power.reset(1)
revive.power.restart(1)Power on rigs 1-16for rig in range(1, 17):
    revive.power.on(rig)DeviceDevice specific actions and authorizationDevice Authorization checkrevive.device.auth()Get Device IDrevive.device.id()Device Hello message (currently returns device ID)revive.device.hello()RigRig specific methods: get() and update()Rig.GetThe revive.rig.get() method takes an integer (1-16) as the rig/port number or no argument to get information on all port numbers.  Returns a JSON string with the values.  The API is currently broken on Revive and only port 1 is returned, regardless of which port you specify.# Get information about all ports/rigs
res = revive.rig.get()
print(res)

# Get information about port/rig 1
res = revive.rig.get(1)
print(res)Rig.UpdateUpdates the rig (aka port) with the specified information.  It takes a Python dict as an argument.  Possible fields are:port (int, 1-16, required) - physical port which will be updated. We don't have rig id, instead we use this port numbername (char) - name of the rigip (IP address) - IP address of the rig, used when mode is set to watchdogmode (char, manual|watchdog|api)maintenance (boolean) - not used for nowpayload = { "port": 3, "name": "RRMS40U", "ip": "192.168.100.101", "mode": "manual", "maintenance": False }
res = revive.rig.update(payload)
print(res)ConfigRetrieves and sets network and watchdog information on the Revive.Config.NetworkThe revive.config.network object sets the following read-write variables:* revive.config.network.mode
* revive.config.network.ip
* revive.config.network.netmask
* revive.config.network.gateway
* revive.config.network.primaryDNS
* revive.config.network.secondaryDNSViewingYou can view the current settings in two ways.  Using a helper method show():revive.config.network.show()Or each individual setting:print(revive.config.network.mode)
print(revive.config.network.ip)
print(revive.config.network.netmask)
print(revive.config.network.gateway)
print(revive.config.network.primaryDNS)
print(revive.config.network.secondaryDNS)There is also a dictionary on the network object 'settings' that you can view the settings as well:print(revive.config.network.settings)UpdatingThe individual settings are read-write and can be changed and then saved back to the Revive using the save() method:revive.config.network.show()

revive.config.network.ip = "10.1.1.254"
revive.config.network.netmask = "255.255.255.0"
revive.config.network.gateway = "10.1.1.1"
revive.config.network.primaryDNS = "8.8.8.8"
revive.config.network.secondaryDNS = "8.8.4.4"

res = revive.config.network.save()
print(res)

revive.config.network.show()Config.WatchdogThe Revive watchdog feature has 3 settings you can modify.  The revive.config.watchdog object has three read-write variables:* revive.config.watchdog.settings
* revive.config.watchdog.pingInterval
* revive.config.watchdog.firstResetAfter
* revive.config.watchdog.anotherResetEveryViewingYou can view the current settings in two ways.  Using a helper method show():revive.config.watchdog.show()Or you can view the settings individually:print(revive.config.watchdog.settings)
print(revive.config.watchdog.pingInterval)
print(revive.config.watchdog.firstResetAfter)
print(revive.config.watchdog.anotherResetEvery)There is also a dictionary on the watchdog object 'settings' that you can view the settings as well:print(revive.config.watchdog.settings)UpdatingThe individual settings are read-write and can be changed and then saved back to the Revive using the save() method:revive.config.watchdog.show()

revive.config.watchdog.pingInterval = "5"
revive.config.watchdog.firstResetAfter = "90"
revive.config.watchdog.anotherResetEvery = "120"

res = revive.config.watchdog.save()
print(res)

revive.config.watchdog.show()