Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cannot power on/off Antminer S19k Pro from HA #369

Open
nmnetmedia opened this issue Aug 29, 2024 · 11 comments
Open

Cannot power on/off Antminer S19k Pro from HA #369

nmnetmedia opened this issue Aug 29, 2024 · 11 comments

Comments

@nmnetmedia
Copy link

Version of the custom_component

hass-miner: v1.1.13

Type Miner: Antminer S19k Pro
Firmware Version Miner Tue Apr 9 11:41:24 CST 2024

Configuration

Describe the bug

Cannot powrer on/off miner from HomeAssistant

Debug log

2024-08-29 11:57:29.882 DEBUG (MainThread) [custom_components.miner.coordinator] Found miner: S19K Pro (Stock): 10.12.222.20
2024-08-29 11:57:30.103 DEBUG (MainThread) [custom_components.miner.coordinator] Got data: MinerData(ip='10.12.222.20', datetime='2024-08-29T11:57:29.883099+02:00', timestamp=1724925449, device_info=DeviceInfo(make=<MinerMake.ANTMINER: 'AntMiner'>, model=<AntminerModels.S19KPro: 'S19K Pro'>, firmware=<MinerFirmware.STOCK: 'Stock'>, algo=SHA256Algo), make='AntMiner', model='S19K Pro', firmware='Stock', algo='SHA256', mac='16:77:C1:EB:D9:29', api_ver=None, fw_ver='Tue Apr 9 11:41:24 CST 2024', hostname='Antminer', hashrate=124.2888 TH/s, expected_hashrate=120.0 TH/s, expected_hashboards=3, expected_chips=231, expected_fans=4, percent_expected_chips=100, percent_expected_hashrate=104, percent_expected_wattage=None, temperature_avg=52, env_temp=None, wattage=None, wattage_limit=None, voltage=None, fans=[Fan(speed=4760), Fan(speed=4710), Fan(speed=4330), Fan(speed=4350)], fan_psu=None, hashboards=[HashBoard(slot=0, hashrate=42.397169999999996 TH/s, temp=51.5, chip_temp=56.5, chips=77, expected_chips=77, serial_number='JYZZYRNBDJAAA0JJ2', missing=False, tuned=None, active=None, voltage=None), HashBoard(slot=1, hashrate=40.65994 TH/s, temp=52.0, chip_temp=57.0, chips=77, expected_chips=77, serial_number='JYZZYRNBDJAAA0HM1', missing=False, tuned=None, active=None, voltage=None), HashBoard(slot=2, hashrate=41.23169 TH/s, temp=52.5, chip_temp=57.5, chips=77, expected_chips=77, serial_number='JYZZYRNBDJAAA0N9T', missing=False, tuned=None, active=None, voltage=None)], total_chips=231, nominal=True, config=None, fault_light=None, errors=[], is_mining=True, uptime=None, efficiency=None, pools=[])
2024-08-29 11:57:30.104 DEBUG (MainThread) [custom_components.miner.coordinator] Finished fetching S19Pro data in 0.233 seconds (success: True)
2024-08-29 11:57:34.883 DEBUG (MainThread) [custom_components.miner.switch] S19Pro: Stop mining.
2024-08-29 11:57:39.885 DEBUG (MainThread) [custom_components.miner.coordinator] Found miner: S19K Pro (Stock): 10.12.222.20
2024-08-29 11:57:40.169 DEBUG (MainThread) [custom_components.miner.coordinator] Got data: MinerData(ip='10.12.222.20', datetime='2024-08-29T11:57:39.885542+02:00', timestamp=1724925459, device_info=DeviceInfo(make=<MinerMake.ANTMINER: 'AntMiner'>, model=<AntminerModels.S19KPro: 'S19K Pro'>, firmware=<MinerFirmware.STOCK: 'Stock'>, algo=SHA256Algo), make='AntMiner', model='S19K Pro', firmware='Stock', algo='SHA256', mac='16:77:C1:EB:D9:29', api_ver=None, fw_ver='Tue Apr 9 11:41:24 CST 2024', hostname='Antminer', hashrate=125.45427000000001 TH/s, expected_hashrate=120.0 TH/s, expected_hashboards=3, expected_chips=231, expected_fans=4, percent_expected_chips=100, percent_expected_hashrate=105, percent_expected_wattage=None, temperature_avg=52, env_temp=None, wattage=None, wattage_limit=None, voltage=None, fans=[Fan(speed=4750), Fan(speed=4730), Fan(speed=4360), Fan(speed=4340)], fan_psu=None, hashboards=[HashBoard(slot=0, hashrate=41.6495 TH/s, temp=51.5, chip_temp=56.5, chips=77, expected_chips=77, serial_number='JYZZYRNBDJAAA0JJ2', missing=False, tuned=None, active=None, voltage=None), HashBoard(slot=1, hashrate=42.00134 TH/s, temp=52.0, chip_temp=57.0, chips=77, expected_chips=77, serial_number='JYZZYRNBDJAAA0HM1', missing=False, tuned=None, active=None, voltage=None), HashBoard(slot=2, hashrate=41.80343 TH/s, temp=52.5, chip_temp=57.5, chips=77, expected_chips=77, serial_number='JYZZYRNBDJAAA0N9T', missing=False, tuned=None, active=None, voltage=None)], total_chips=231, nominal=True, config=None, fault_light=None, errors=[], is_mining=True, uptime=None, efficiency=None, pools=[])
2024-08-29 11:57:40.169 DEBUG (MainThread) [custom_components.miner.coordinator] Finished fetching S19Pro data in 0.298 seconds (success: True)

@b-rowan
Copy link
Collaborator

b-rowan commented Sep 12, 2024

Should be fixed with the latest version I think, try it out.

@nmnetmedia
Copy link
Author

Thanks for the reply!
I've updated to 1.1.14 however HA cannot communicate with miner anymore, I'm getting following error:

Logger: homeassistant.setup
Source: setup.py:269
First occurred: 9:17:30 AM (1 occurrences)
Last logged: 9:17:30 AM

Setup failed for custom integration 'miner': Requirements for miner not found: ['pyasic==0.60.5'].

Any tips?
Thank you for the help

@b-rowan
Copy link
Collaborator

b-rowan commented Sep 13, 2024

Yeah, apparently my pyasic version didn't release, it should be fixed now.

@nmnetmedia
Copy link
Author

Error is gone now! Thank you.

But still can't turn it on/off

My miner has 3 modes

  • sleep
  • normal
  • High Energy Mode

image

it's running in "High Energy Mode" , when I deactivate the swich in HA, it reboots and start mining in "Normal mode"
but doesn't shut down.

image

@b-rowan
Copy link
Collaborator

b-rowan commented Sep 17, 2024

Error is gone now! Thank you.

But still can't turn it on/off

My miner has 3 modes

  • sleep

  • normal

  • High Energy Mode

image

it's running in "High Energy Mode" , when I deactivate the swich in HA, it reboots and start mining in "Normal mode"

but doesn't shut down.

image

This is a bit more of a complicated issue than just "failing to turn off", and I would prefer to move it to a separate issue. I will however, attempt to explain it.

pyasic (the miner control backend used) does not persist initial state when updating a config, nor does hass-miner. This means that when you put the miner into sleep mode, it doesn't know what state to revert it to. The default functions for "on" and "off" for antminers on stock are "normal" and "sleep" respectively, meaning it will always revert to "normal" mode by default.

If you were to use aftermarket firmware (BOS+ works the best with this integration, and they have a contiguous tuner mechanism), you can set the power limit there and it will persist through on/off cycles, because there is a seperate "pause" and "resume" command for the firmware, which does not change the configuration.

@b-rowan
Copy link
Collaborator

b-rowan commented Nov 22, 2024

I added a select switch (which I can't test) for power mode in 1.1.19rc2, try that and see if it works for you. The config flow you will want is that when you shut the miner down you will use the switch, but when turning it on you will want to use the selector and put it into the right mode.

@b-rowan
Copy link
Collaborator

b-rowan commented Nov 22, 2024

Even better, I tried a proper fix for this (where the switch entity stores the last mining mode state, since I'm now pulling config) in v1.1.19rc3. It is likely even less stable than rc2, but worth a shot if you want to try it.

@nmnetmedia
Copy link
Author

Wow, I truly appreciate your help. Honestly, I thought you might have forgotten about me a long time ago. Hats off to you—this is what I call first-class support! I can’t test it right away since Bitcoin is on its way to $100k, so I’m keeping the miner running 24/7 for now. :) But I’ll make sure to test this as soon as possible and share my feedback with you. Once again, thank you so much!

@b-rowan
Copy link
Collaborator

b-rowan commented Nov 22, 2024

Wow, I truly appreciate your help. Honestly, I thought you might have forgotten about me a long time ago. Hats off to you—this is what I call first-class support! I can’t test it right away since Bitcoin is on its way to $100k, so I’m keeping the miner running 24/7 for now. :) But I’ll make sure to test this as soon as possible and share my feedback with you. Once again, thank you so much!

No problem man, I just get busy sometimes and don't have time to sit down and work on this stuff. Hopefully this works for you.

You are welcome to update and just see if the selector even shows up for you, like I said, it might not be very stable...

@nmnetmedia
Copy link
Author

Quick update: The miner is at a remote location where they just replaced the firewall, and I currently don’t have a VPN connection. I’m hesitant to turn it off because I’m afraid it might switch to ‘normal’ mode, and I won’t be able to access it. However, I don’t see any additional switch in Home Assistant at the moment.
Screenshot 2024-11-22 at 22 44 31

Thanks for the help!

@b-rowan
Copy link
Collaborator

b-rowan commented Nov 22, 2024

Ah, yeah that's not supposed to be the case. Looks like I'm going to have to do some more looking...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants