Skip to content

pyasic

AuradineWebAPI

Bases: BaseWebAPI

Source code in pyasic/web/auradine.py
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
class AuradineWebAPI(BaseWebAPI):
    def __init__(self, ip: str) -> None:
        """Initializes the API client for interacting with Auradine mining devices.

        Args:
            ip (str): IP address of the Auradine miner.
        """
        super().__init__(ip)
        self.username = "admin"
        self.pwd = settings.get("default_auradine_web_password", "admin")
        self.port = 8080
        self.token = None

    async def auth(self) -> str | None:
        """Authenticate and retrieve a web token from the Auradine miner.

        Returns:
            str | None: A token if authentication is successful, None otherwise.
        """
        async with httpx.AsyncClient(transport=settings.transport()) as client:
            try:
                auth = await client.post(
                    f"http://{self.ip}:{self.port}/token",
                    json={
                        "command": "token",
                        "user": self.username,
                        "password": self.pwd,
                    },
                )
            except httpx.HTTPError:
                warnings.warn(f"Could not authenticate web token with miner: {self}")
            else:
                json_auth = auth.json()
                try:
                    self.token = json_auth["Token"][0]["Token"]
                except LookupError:
                    return None
            return self.token

    async def send_command(
        self,
        command: str | bytes,
        ignore_errors: bool = False,
        allow_warning: bool = True,
        privileged: bool = False,
        **parameters: Any,
    ) -> dict:
        """Send a command to the Auradine miner, handling authentication and retries.

        Args:
            command (str | bytes): The specific command to execute.
            ignore_errors (bool): Whether to ignore HTTP errors.
            allow_warning (bool): Whether to proceed with warnings.
            privileged (bool): Whether the command requires privileged access.
            **parameters: Additional parameters for the command.

        Returns:
            dict: The JSON response from the device.
        """
        post = privileged or not parameters == {}
        if not parameters == {}:
            parameters["command"] = command

        if self.token is None:
            await self.auth()
        async with httpx.AsyncClient(transport=settings.transport()) as client:
            for i in range(settings.get("get_data_retries", 1)):
                try:
                    if post:
                        response = await client.post(
                            f"http://{self.ip}:{self.port}/{command}",
                            headers={"Token": self.token},
                            timeout=settings.get("api_function_timeout", 5),
                            json=parameters,
                        )
                    else:
                        response = await client.get(
                            f"http://{self.ip}:{self.port}/{command}",
                            headers={"Token": self.token},
                            timeout=settings.get("api_function_timeout", 5),
                        )
                    json_data = response.json()
                    validation = validate_command_output(json_data)
                    if not validation[0]:
                        if i == settings.get("get_data_retries", 1):
                            raise APIError(validation[1])
                        # refresh the token, retry
                        await self.auth()
                        continue
                    return json_data
                except (httpx.HTTPError, json.JSONDecodeError):
                    pass

    async def multicommand(
        self, *commands: str, ignore_errors: bool = False, allow_warning: bool = True
    ) -> dict:
        """Execute multiple commands simultaneously on the Auradine miner.

        Args:
            *commands (str): Commands to execute.
            ignore_errors (bool): Whether to ignore errors during command execution.
            allow_warning (bool): Whether to proceed despite warnings.

        Returns:
            dict: A dictionary containing responses for all commands executed.
        """
        tasks = {}
        # send all commands individually
        for cmd in commands:
            tasks[cmd] = asyncio.create_task(
                self.send_command(cmd, allow_warning=allow_warning)
            )

        await asyncio.gather(*[tasks[cmd] for cmd in tasks], return_exceptions=True)

        data = {"multicommand": True}
        for cmd in tasks:
            try:
                result = tasks[cmd].result()
                if result is None or result == {}:
                    result = {}
                data[cmd] = result
            except APIError:
                pass

        return data

    async def factory_reset(self) -> dict:
        """Perform a factory reset on the Auradine miner.

        Returns:
            dict: A dictionary indicating the result of the reset operation.
        """
        return await self.send_command("factory-reset", privileged=True)

    async def get_fan(self) -> dict:
        """Retrieve the current fan status from the Auradine miner.

        Returns:
            dict: A dictionary containing the current fan status.
        """
        return await self.send_command("fan")

    async def set_fan(self, fan: int, speed_pct: int) -> dict:
        """Set the speed of a specific fan on the Auradine miner.

        Args:
            fan (int): The index of the fan to control.
            speed_pct (int): The speed percentage to set for the fan.

        Returns:
            dict: A dictionary indicating the result of the operation.
        """
        return await self.send_command("fan", index=fan, percentage=speed_pct)

    async def firmware_upgrade(self, url: str = None, version: str = "latest") -> dict:
        """Upgrade the firmware of the Auradine miner.

        Args:
            url (str, optional): The URL to download the firmware from.
            version (str, optional): The version of the firmware to upgrade to, defaults to 'latest'.

        Returns:
            dict: A dictionary indicating the result of the firmware upgrade.
        """
        if url is not None:
            return await self.send_command("firmware-upgrade", url=url)
        return await self.send_command("firmware-upgrade", version=version)

    async def get_frequency(self) -> dict:
        """Retrieve the current frequency settings of the Auradine miner.

        Returns:
            dict: A dictionary containing the frequency settings.
        """
        return await self.send_command("frequency")

    async def set_frequency(self, board: int, frequency: float) -> dict:
        """Set the frequency for a specific board on the Auradine miner.

        Args:
            board (int): The index of the board to configure.
            frequency (float): The frequency in MHz to set for the board.

        Returns:
            dict: A dictionary indicating the result of setting the frequency.
        """
        return await self.send_command("frequency", board=board, frequency=frequency)

    async def ipreport(self) -> dict:
        """Generate an IP report for the Auradine miner.

        Returns:
            dict: A dictionary containing the IP report details.
        """
        return await self.send_command("ipreport")

    async def get_led(self) -> dict:
        """Retrieve the current LED status from the Auradine miner.

        Returns:
            dict: A dictionary containing the current status of the LED settings.
        """
        return await self.send_command("led")

    async def set_led(self, code: int) -> dict:
        """Set the LED code on the Auradine miner.

        Args:
            code (int): The code that determines the LED behavior.

        Returns:
            dict: A dictionary indicating the result of the operation.
        """
        return await self.send_command("led", code=code)

    async def set_led_custom(self, code: int, led_1: int, led_2: int, msg: str) -> dict:
        """Set custom LED configurations including messages.

        Args:
            code (int): The LED code to set.
            led_1 (int): The first LED indicator number.
            led_2 (int): The second LED indicator number.
            msg (str): The message to display or represent with LEDs.

        Returns:
            dict: A dictionary indicating the result of the custom LED configuration.
        """
        return await self.send_command(
            "led", code=code, led1=led_1, led2=led_2, msg=msg
        )

    async def get_mode(self) -> dict:
        """Retrieve the current operational mode of the Auradine miner.

        Returns:
            dict: A dictionary containing the current mode settings.
        """
        return await self.send_command("mode")

    async def set_mode(self, **kwargs: Any) -> dict:
        """Set the operational mode of the Auradine miner.

        Args:
            **kwargs (Any): Mode settings specified as keyword arguments.

        Returns:
            dict: A dictionary indicating the result of the mode setting operation.
        """
        return await self.send_command("mode", **kwargs)

    async def get_network(self) -> dict:
        """Retrieve the network configuration settings of the Auradine miner.

        Returns:
            dict: A dictionary containing the network configuration details.
        """
        return await self.send_command("network")

    async def set_network(self, **kwargs: Any) -> dict:
        """Set the network configuration of the Auradine miner.

        Args:
            **kwargs (Any): Network settings specified as keyword arguments.

        Returns:
            dict: A dictionary indicating the result of the network configuration.
        """
        return await self.send_command("network", **kwargs)

    async def password(self, password: str) -> dict:
        """Change the password used for accessing the Auradine miner.

        Args:
            password (str): The new password to set.

        Returns:
            dict: A dictionary indicating the result of the password change operation.
        """
        res = await self.send_command(
            "password", user=self.username, old=self.pwd, new=password
        )
        self.pwd = password
        return res

    async def get_psu(self) -> dict:
        """Retrieve the status of the power supply unit (PSU) from the Auradine miner.

        Returns:
            dict: A dictionary containing the PSU status.
        """
        return await self.send_command("psu")

    async def set_psu(self, voltage: float) -> dict:
        """Set the voltage for the power supply unit of the Auradine miner.

        Args:
            voltage (float): The voltage level to set for the PSU.

        Returns:
            dict: A dictionary indicating the result of setting the PSU voltage.
        """
        return await self.send_command("psu", voltage=voltage)

    async def get_register(self) -> dict:
        """Retrieve registration information from the Auradine miner.

        Returns:
            dict: A dictionary containing the registration details.
        """
        return await self.send_command("register")

    async def set_register(self, company: str) -> dict:
        """Set the registration information for the Auradine miner.

        Args:
            company (str): The company name to register the miner under.

        Returns:
            dict: A dictionary indicating the result of the registration operation.
        """
        return await self.send_command("register", parameter=company)

    async def reboot(self) -> dict:
        """Reboot the Auradine miner.

        Returns:
            dict: A dictionary indicating the result of the reboot operation.
        """
        return await self.send_command("restart", privileged=True)

    async def restart_gcminer(self) -> dict:
        """Restart the GCMiner application on the Auradine miner.

        Returns:
            dict: A dictionary indicating the result of the GCMiner restart operation.
        """
        return await self.send_command("restart", parameter="gcminer")

    async def restart_api_server(self) -> dict:
        """Restart the API server on the Auradine miner.

        Returns:
            dict: A dictionary indicating the result of the API server restart operation.
        """
        return await self.send_command("restart", parameter="api-server")

    async def temperature(self) -> dict:
        """Retrieve the current temperature readings from the Auradine miner.

        Returns:
            dict: A dictionary containing temperature data.
        """
        return await self.send_command("temperature")

    async def timedate(self, ntp: str, timezone: str) -> dict:
        """Set the time and date settings for the Auradine miner.

        Args:
            ntp (str): The NTP server to use for time synchronization.
            timezone (str): The timezone setting.

        Returns:
            dict: A dictionary indicating the result of setting the time and date.
        """
        return await self.send_command("timedate", ntp=ntp, timezone=timezone)

    async def get_token(self) -> dict:
        """Retrieve the current authentication token for the Auradine miner.

        Returns:
            dict: A dictionary containing the authentication token.
        """
        return await self.send_command("token", user=self.username, password=self.pwd)

    async def update_pools(self, pools: list[dict]) -> dict:
        """Update the mining pools configuration on the Auradine miner.

        Args:
            pools (list[dict]): A list of dictionaries, each representing a pool configuration.

        Returns:
            dict: A dictionary indicating the result of the update operation.
        """
        return await self.send_command("updatepools", pools=pools)

    async def voltage(self) -> dict:
        """Retrieve the voltage settings of the Auradine miner.

        Returns:
            dict: A dictionary containing the voltage details.
        """
        return await self.send_command("voltage")

    async def get_ztp(self) -> dict:
        """Retrieve the zero-touch provisioning status from the Auradine miner.

        Returns:
            dict: A dictionary containing the ZTP status.
        """
        return await self.send_command("ztp")

    async def set_ztp(self, enable: bool) -> dict:
        """Enable or disable zero-touch provisioning (ZTP) on the Auradine miner.

        Args:
            enable (bool): True to enable ZTP, False to disable.

        Returns:
            dict: A dictionary indicating the result of the ZTP setting operation.
        """
        return await self.send_command("ztp", parameter="on" if enable else "off")

__init__(ip)

Initializes the API client for interacting with Auradine mining devices.

Parameters:

Name Type Description Default
ip str

IP address of the Auradine miner.

required
Source code in pyasic/web/auradine.py
def __init__(self, ip: str) -> None:
    """Initializes the API client for interacting with Auradine mining devices.

    Args:
        ip (str): IP address of the Auradine miner.
    """
    super().__init__(ip)
    self.username = "admin"
    self.pwd = settings.get("default_auradine_web_password", "admin")
    self.port = 8080
    self.token = None

auth() async

Authenticate and retrieve a web token from the Auradine miner.

Returns:

Type Description
str | None

str | None: A token if authentication is successful, None otherwise.

Source code in pyasic/web/auradine.py
async def auth(self) -> str | None:
    """Authenticate and retrieve a web token from the Auradine miner.

    Returns:
        str | None: A token if authentication is successful, None otherwise.
    """
    async with httpx.AsyncClient(transport=settings.transport()) as client:
        try:
            auth = await client.post(
                f"http://{self.ip}:{self.port}/token",
                json={
                    "command": "token",
                    "user": self.username,
                    "password": self.pwd,
                },
            )
        except httpx.HTTPError:
            warnings.warn(f"Could not authenticate web token with miner: {self}")
        else:
            json_auth = auth.json()
            try:
                self.token = json_auth["Token"][0]["Token"]
            except LookupError:
                return None
        return self.token

factory_reset() async

Perform a factory reset on the Auradine miner.

Returns:

Name Type Description
dict dict

A dictionary indicating the result of the reset operation.

Source code in pyasic/web/auradine.py
async def factory_reset(self) -> dict:
    """Perform a factory reset on the Auradine miner.

    Returns:
        dict: A dictionary indicating the result of the reset operation.
    """
    return await self.send_command("factory-reset", privileged=True)

firmware_upgrade(url=None, version='latest') async

Upgrade the firmware of the Auradine miner.

Parameters:

Name Type Description Default
url str

The URL to download the firmware from.

None
version str

The version of the firmware to upgrade to, defaults to 'latest'.

'latest'

Returns:

Name Type Description
dict dict

A dictionary indicating the result of the firmware upgrade.

Source code in pyasic/web/auradine.py
async def firmware_upgrade(self, url: str = None, version: str = "latest") -> dict:
    """Upgrade the firmware of the Auradine miner.

    Args:
        url (str, optional): The URL to download the firmware from.
        version (str, optional): The version of the firmware to upgrade to, defaults to 'latest'.

    Returns:
        dict: A dictionary indicating the result of the firmware upgrade.
    """
    if url is not None:
        return await self.send_command("firmware-upgrade", url=url)
    return await self.send_command("firmware-upgrade", version=version)

get_fan() async

Retrieve the current fan status from the Auradine miner.

Returns:

Name Type Description
dict dict

A dictionary containing the current fan status.

Source code in pyasic/web/auradine.py
async def get_fan(self) -> dict:
    """Retrieve the current fan status from the Auradine miner.

    Returns:
        dict: A dictionary containing the current fan status.
    """
    return await self.send_command("fan")

get_frequency() async

Retrieve the current frequency settings of the Auradine miner.

Returns:

Name Type Description
dict dict

A dictionary containing the frequency settings.

Source code in pyasic/web/auradine.py
async def get_frequency(self) -> dict:
    """Retrieve the current frequency settings of the Auradine miner.

    Returns:
        dict: A dictionary containing the frequency settings.
    """
    return await self.send_command("frequency")

get_led() async

Retrieve the current LED status from the Auradine miner.

Returns:

Name Type Description
dict dict

A dictionary containing the current status of the LED settings.

Source code in pyasic/web/auradine.py
async def get_led(self) -> dict:
    """Retrieve the current LED status from the Auradine miner.

    Returns:
        dict: A dictionary containing the current status of the LED settings.
    """
    return await self.send_command("led")

get_mode() async

Retrieve the current operational mode of the Auradine miner.

Returns:

Name Type Description
dict dict

A dictionary containing the current mode settings.

Source code in pyasic/web/auradine.py
async def get_mode(self) -> dict:
    """Retrieve the current operational mode of the Auradine miner.

    Returns:
        dict: A dictionary containing the current mode settings.
    """
    return await self.send_command("mode")

get_network() async

Retrieve the network configuration settings of the Auradine miner.

Returns:

Name Type Description
dict dict

A dictionary containing the network configuration details.

Source code in pyasic/web/auradine.py
async def get_network(self) -> dict:
    """Retrieve the network configuration settings of the Auradine miner.

    Returns:
        dict: A dictionary containing the network configuration details.
    """
    return await self.send_command("network")

get_psu() async

Retrieve the status of the power supply unit (PSU) from the Auradine miner.

Returns:

Name Type Description
dict dict

A dictionary containing the PSU status.

Source code in pyasic/web/auradine.py
async def get_psu(self) -> dict:
    """Retrieve the status of the power supply unit (PSU) from the Auradine miner.

    Returns:
        dict: A dictionary containing the PSU status.
    """
    return await self.send_command("psu")

get_register() async

Retrieve registration information from the Auradine miner.

Returns:

Name Type Description
dict dict

A dictionary containing the registration details.

Source code in pyasic/web/auradine.py
async def get_register(self) -> dict:
    """Retrieve registration information from the Auradine miner.

    Returns:
        dict: A dictionary containing the registration details.
    """
    return await self.send_command("register")

get_token() async

Retrieve the current authentication token for the Auradine miner.

Returns:

Name Type Description
dict dict

A dictionary containing the authentication token.

Source code in pyasic/web/auradine.py
async def get_token(self) -> dict:
    """Retrieve the current authentication token for the Auradine miner.

    Returns:
        dict: A dictionary containing the authentication token.
    """
    return await self.send_command("token", user=self.username, password=self.pwd)

get_ztp() async

Retrieve the zero-touch provisioning status from the Auradine miner.

Returns:

Name Type Description
dict dict

A dictionary containing the ZTP status.

Source code in pyasic/web/auradine.py
async def get_ztp(self) -> dict:
    """Retrieve the zero-touch provisioning status from the Auradine miner.

    Returns:
        dict: A dictionary containing the ZTP status.
    """
    return await self.send_command("ztp")

ipreport() async

Generate an IP report for the Auradine miner.

Returns:

Name Type Description
dict dict

A dictionary containing the IP report details.

Source code in pyasic/web/auradine.py
async def ipreport(self) -> dict:
    """Generate an IP report for the Auradine miner.

    Returns:
        dict: A dictionary containing the IP report details.
    """
    return await self.send_command("ipreport")

multicommand(*commands, ignore_errors=False, allow_warning=True) async

Execute multiple commands simultaneously on the Auradine miner.

Parameters:

Name Type Description Default
*commands str

Commands to execute.

()
ignore_errors bool

Whether to ignore errors during command execution.

False
allow_warning bool

Whether to proceed despite warnings.

True

Returns:

Name Type Description
dict dict

A dictionary containing responses for all commands executed.

Source code in pyasic/web/auradine.py
async def multicommand(
    self, *commands: str, ignore_errors: bool = False, allow_warning: bool = True
) -> dict:
    """Execute multiple commands simultaneously on the Auradine miner.

    Args:
        *commands (str): Commands to execute.
        ignore_errors (bool): Whether to ignore errors during command execution.
        allow_warning (bool): Whether to proceed despite warnings.

    Returns:
        dict: A dictionary containing responses for all commands executed.
    """
    tasks = {}
    # send all commands individually
    for cmd in commands:
        tasks[cmd] = asyncio.create_task(
            self.send_command(cmd, allow_warning=allow_warning)
        )

    await asyncio.gather(*[tasks[cmd] for cmd in tasks], return_exceptions=True)

    data = {"multicommand": True}
    for cmd in tasks:
        try:
            result = tasks[cmd].result()
            if result is None or result == {}:
                result = {}
            data[cmd] = result
        except APIError:
            pass

    return data

password(password) async

Change the password used for accessing the Auradine miner.

Parameters:

Name Type Description Default
password str

The new password to set.

required

Returns:

Name Type Description
dict dict

A dictionary indicating the result of the password change operation.

Source code in pyasic/web/auradine.py
async def password(self, password: str) -> dict:
    """Change the password used for accessing the Auradine miner.

    Args:
        password (str): The new password to set.

    Returns:
        dict: A dictionary indicating the result of the password change operation.
    """
    res = await self.send_command(
        "password", user=self.username, old=self.pwd, new=password
    )
    self.pwd = password
    return res

reboot() async

Reboot the Auradine miner.

Returns:

Name Type Description
dict dict

A dictionary indicating the result of the reboot operation.

Source code in pyasic/web/auradine.py
async def reboot(self) -> dict:
    """Reboot the Auradine miner.

    Returns:
        dict: A dictionary indicating the result of the reboot operation.
    """
    return await self.send_command("restart", privileged=True)

restart_api_server() async

Restart the API server on the Auradine miner.

Returns:

Name Type Description
dict dict

A dictionary indicating the result of the API server restart operation.

Source code in pyasic/web/auradine.py
async def restart_api_server(self) -> dict:
    """Restart the API server on the Auradine miner.

    Returns:
        dict: A dictionary indicating the result of the API server restart operation.
    """
    return await self.send_command("restart", parameter="api-server")

restart_gcminer() async

Restart the GCMiner application on the Auradine miner.

Returns:

Name Type Description
dict dict

A dictionary indicating the result of the GCMiner restart operation.

Source code in pyasic/web/auradine.py
async def restart_gcminer(self) -> dict:
    """Restart the GCMiner application on the Auradine miner.

    Returns:
        dict: A dictionary indicating the result of the GCMiner restart operation.
    """
    return await self.send_command("restart", parameter="gcminer")

send_command(command, ignore_errors=False, allow_warning=True, privileged=False, **parameters) async

Send a command to the Auradine miner, handling authentication and retries.

Parameters:

Name Type Description Default
command str | bytes

The specific command to execute.

required
ignore_errors bool

Whether to ignore HTTP errors.

False
allow_warning bool

Whether to proceed with warnings.

True
privileged bool

Whether the command requires privileged access.

False
**parameters Any

Additional parameters for the command.

{}

Returns:

Name Type Description
dict dict

The JSON response from the device.

Source code in pyasic/web/auradine.py
async def send_command(
    self,
    command: str | bytes,
    ignore_errors: bool = False,
    allow_warning: bool = True,
    privileged: bool = False,
    **parameters: Any,
) -> dict:
    """Send a command to the Auradine miner, handling authentication and retries.

    Args:
        command (str | bytes): The specific command to execute.
        ignore_errors (bool): Whether to ignore HTTP errors.
        allow_warning (bool): Whether to proceed with warnings.
        privileged (bool): Whether the command requires privileged access.
        **parameters: Additional parameters for the command.

    Returns:
        dict: The JSON response from the device.
    """
    post = privileged or not parameters == {}
    if not parameters == {}:
        parameters["command"] = command

    if self.token is None:
        await self.auth()
    async with httpx.AsyncClient(transport=settings.transport()) as client:
        for i in range(settings.get("get_data_retries", 1)):
            try:
                if post:
                    response = await client.post(
                        f"http://{self.ip}:{self.port}/{command}",
                        headers={"Token": self.token},
                        timeout=settings.get("api_function_timeout", 5),
                        json=parameters,
                    )
                else:
                    response = await client.get(
                        f"http://{self.ip}:{self.port}/{command}",
                        headers={"Token": self.token},
                        timeout=settings.get("api_function_timeout", 5),
                    )
                json_data = response.json()
                validation = validate_command_output(json_data)
                if not validation[0]:
                    if i == settings.get("get_data_retries", 1):
                        raise APIError(validation[1])
                    # refresh the token, retry
                    await self.auth()
                    continue
                return json_data
            except (httpx.HTTPError, json.JSONDecodeError):
                pass

set_fan(fan, speed_pct) async

Set the speed of a specific fan on the Auradine miner.

Parameters:

Name Type Description Default
fan int

The index of the fan to control.

required
speed_pct int

The speed percentage to set for the fan.

required

Returns:

Name Type Description
dict dict

A dictionary indicating the result of the operation.

Source code in pyasic/web/auradine.py
async def set_fan(self, fan: int, speed_pct: int) -> dict:
    """Set the speed of a specific fan on the Auradine miner.

    Args:
        fan (int): The index of the fan to control.
        speed_pct (int): The speed percentage to set for the fan.

    Returns:
        dict: A dictionary indicating the result of the operation.
    """
    return await self.send_command("fan", index=fan, percentage=speed_pct)

set_frequency(board, frequency) async

Set the frequency for a specific board on the Auradine miner.

Parameters:

Name Type Description Default
board int

The index of the board to configure.

required
frequency float

The frequency in MHz to set for the board.

required

Returns:

Name Type Description
dict dict

A dictionary indicating the result of setting the frequency.

Source code in pyasic/web/auradine.py
async def set_frequency(self, board: int, frequency: float) -> dict:
    """Set the frequency for a specific board on the Auradine miner.

    Args:
        board (int): The index of the board to configure.
        frequency (float): The frequency in MHz to set for the board.

    Returns:
        dict: A dictionary indicating the result of setting the frequency.
    """
    return await self.send_command("frequency", board=board, frequency=frequency)

set_led(code) async

Set the LED code on the Auradine miner.

Parameters:

Name Type Description Default
code int

The code that determines the LED behavior.

required

Returns:

Name Type Description
dict dict

A dictionary indicating the result of the operation.

Source code in pyasic/web/auradine.py
async def set_led(self, code: int) -> dict:
    """Set the LED code on the Auradine miner.

    Args:
        code (int): The code that determines the LED behavior.

    Returns:
        dict: A dictionary indicating the result of the operation.
    """
    return await self.send_command("led", code=code)

set_led_custom(code, led_1, led_2, msg) async

Set custom LED configurations including messages.

Parameters:

Name Type Description Default
code int

The LED code to set.

required
led_1 int

The first LED indicator number.

required
led_2 int

The second LED indicator number.

required
msg str

The message to display or represent with LEDs.

required

Returns:

Name Type Description
dict dict

A dictionary indicating the result of the custom LED configuration.

Source code in pyasic/web/auradine.py
async def set_led_custom(self, code: int, led_1: int, led_2: int, msg: str) -> dict:
    """Set custom LED configurations including messages.

    Args:
        code (int): The LED code to set.
        led_1 (int): The first LED indicator number.
        led_2 (int): The second LED indicator number.
        msg (str): The message to display or represent with LEDs.

    Returns:
        dict: A dictionary indicating the result of the custom LED configuration.
    """
    return await self.send_command(
        "led", code=code, led1=led_1, led2=led_2, msg=msg
    )

set_mode(**kwargs) async

Set the operational mode of the Auradine miner.

Parameters:

Name Type Description Default
**kwargs Any

Mode settings specified as keyword arguments.

{}

Returns:

Name Type Description
dict dict

A dictionary indicating the result of the mode setting operation.

Source code in pyasic/web/auradine.py
async def set_mode(self, **kwargs: Any) -> dict:
    """Set the operational mode of the Auradine miner.

    Args:
        **kwargs (Any): Mode settings specified as keyword arguments.

    Returns:
        dict: A dictionary indicating the result of the mode setting operation.
    """
    return await self.send_command("mode", **kwargs)

set_network(**kwargs) async

Set the network configuration of the Auradine miner.

Parameters:

Name Type Description Default
**kwargs Any

Network settings specified as keyword arguments.

{}

Returns:

Name Type Description
dict dict

A dictionary indicating the result of the network configuration.

Source code in pyasic/web/auradine.py
async def set_network(self, **kwargs: Any) -> dict:
    """Set the network configuration of the Auradine miner.

    Args:
        **kwargs (Any): Network settings specified as keyword arguments.

    Returns:
        dict: A dictionary indicating the result of the network configuration.
    """
    return await self.send_command("network", **kwargs)

set_psu(voltage) async

Set the voltage for the power supply unit of the Auradine miner.

Parameters:

Name Type Description Default
voltage float

The voltage level to set for the PSU.

required

Returns:

Name Type Description
dict dict

A dictionary indicating the result of setting the PSU voltage.

Source code in pyasic/web/auradine.py
async def set_psu(self, voltage: float) -> dict:
    """Set the voltage for the power supply unit of the Auradine miner.

    Args:
        voltage (float): The voltage level to set for the PSU.

    Returns:
        dict: A dictionary indicating the result of setting the PSU voltage.
    """
    return await self.send_command("psu", voltage=voltage)

set_register(company) async

Set the registration information for the Auradine miner.

Parameters:

Name Type Description Default
company str

The company name to register the miner under.

required

Returns:

Name Type Description
dict dict

A dictionary indicating the result of the registration operation.

Source code in pyasic/web/auradine.py
async def set_register(self, company: str) -> dict:
    """Set the registration information for the Auradine miner.

    Args:
        company (str): The company name to register the miner under.

    Returns:
        dict: A dictionary indicating the result of the registration operation.
    """
    return await self.send_command("register", parameter=company)

set_ztp(enable) async

Enable or disable zero-touch provisioning (ZTP) on the Auradine miner.

Parameters:

Name Type Description Default
enable bool

True to enable ZTP, False to disable.

required

Returns:

Name Type Description
dict dict

A dictionary indicating the result of the ZTP setting operation.

Source code in pyasic/web/auradine.py
async def set_ztp(self, enable: bool) -> dict:
    """Enable or disable zero-touch provisioning (ZTP) on the Auradine miner.

    Args:
        enable (bool): True to enable ZTP, False to disable.

    Returns:
        dict: A dictionary indicating the result of the ZTP setting operation.
    """
    return await self.send_command("ztp", parameter="on" if enable else "off")

temperature() async

Retrieve the current temperature readings from the Auradine miner.

Returns:

Name Type Description
dict dict

A dictionary containing temperature data.

Source code in pyasic/web/auradine.py
async def temperature(self) -> dict:
    """Retrieve the current temperature readings from the Auradine miner.

    Returns:
        dict: A dictionary containing temperature data.
    """
    return await self.send_command("temperature")

timedate(ntp, timezone) async

Set the time and date settings for the Auradine miner.

Parameters:

Name Type Description Default
ntp str

The NTP server to use for time synchronization.

required
timezone str

The timezone setting.

required

Returns:

Name Type Description
dict dict

A dictionary indicating the result of setting the time and date.

Source code in pyasic/web/auradine.py
async def timedate(self, ntp: str, timezone: str) -> dict:
    """Set the time and date settings for the Auradine miner.

    Args:
        ntp (str): The NTP server to use for time synchronization.
        timezone (str): The timezone setting.

    Returns:
        dict: A dictionary indicating the result of setting the time and date.
    """
    return await self.send_command("timedate", ntp=ntp, timezone=timezone)

update_pools(pools) async

Update the mining pools configuration on the Auradine miner.

Parameters:

Name Type Description Default
pools list[dict]

A list of dictionaries, each representing a pool configuration.

required

Returns:

Name Type Description
dict dict

A dictionary indicating the result of the update operation.

Source code in pyasic/web/auradine.py
async def update_pools(self, pools: list[dict]) -> dict:
    """Update the mining pools configuration on the Auradine miner.

    Args:
        pools (list[dict]): A list of dictionaries, each representing a pool configuration.

    Returns:
        dict: A dictionary indicating the result of the update operation.
    """
    return await self.send_command("updatepools", pools=pools)

voltage() async

Retrieve the voltage settings of the Auradine miner.

Returns:

Name Type Description
dict dict

A dictionary containing the voltage details.

Source code in pyasic/web/auradine.py
async def voltage(self) -> dict:
    """Retrieve the voltage settings of the Auradine miner.

    Returns:
        dict: A dictionary containing the voltage details.
    """
    return await self.send_command("voltage")