hass-miner icon indicating copy to clipboard operation
hass-miner copied to clipboard

Failed to set wattage for and S9

Open w035h opened this issue 2 years ago • 11 comments

First of all thanks for this cool add-on! I have a small issue when setting the powerlimit using the slider of a S9 miner in Home assistant it returns "Failed to set wattage". I have added part of the log that indicates the issue using x's to remove my actual data.

Hope this helps.

Cheers

Version of the custom_component

  • S9 (BOS+) Firmware: 22.08.1
  • Hass miner 1.1.2
  • Core 2024.2.0
  • Supervisor 2024.01.1
  • Operating System 11.5
  • Frontend 20240207.0

Debug log

2024-02-08 13:48:45.645 WARNING (MainThread) [xxx] S9 (BOS+): x.x.x.x - Failed to set power limit: 'NoneType' object has no attribute 'as_bosminer' 2024-02-08 13:48:45.646 ERROR (MainThread) [homeassistant.components.websocket_api.http.connection] [547319965120] Failed to set wattage. Traceback (most recent call last): File "/usr/src/homeassistant/homeassistant/components/websocket_api/commands.py", line 240, in handle_call_service response = await hass.services.async_call( ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/src/homeassistant/homeassistant/core.py", line 2279, in async_call response_data = await coro ^^^^^^^^^^ File "/usr/src/homeassistant/homeassistant/core.py", line 2316, in _execute_service return await target(service_call) ^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/src/homeassistant/homeassistant/helpers/service.py", line 892, in entity_service_call single_response = await _handle_entity_call( ^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/src/homeassistant/homeassistant/helpers/service.py", line 962, in _handle_entity_call result = await task ^^^^^^^^^^ File "/usr/src/homeassistant/homeassistant/components/number/init.py", line 111, in async_set_value await entity.async_set_native_value(native_value) File "/config/custom_components/miner/number.py", line 117, in async_set_native_value raise pyasic.APIError("Failed to set wattage.") pyasic.errors.APIError: Failed to set wattage.

w035h avatar Feb 08 '24 13:02 w035h

Seems like hass-miner is having trouble getting the config file off your miner, this usually indicates a SSH connection issue. Any chance you changed the password on your miner before?

b-rowan avatar Feb 08 '24 15:02 b-rowan

I did but I provided it when setting up Hass Miner.

w035h avatar Feb 08 '24 15:02 w035h

Ah yeah, that makes sense. You will have to remove that miner and set it up again, there have been some changes to configuration values in the most recent versions to support separate ssh, web, and rpc passwords. The ssh and web password should be the same in this case.

UpstreamData avatar Feb 08 '24 15:02 UpstreamData

I did, I removed it and set it up as a new miner. Even removed and reinstalled Hassminer 1.1.2

w035h avatar Feb 08 '24 15:02 w035h

And you set both the SSH password and web password? It's possible that the configuration wasn't removed before and its using the same configuration if you set both of those, but that would be quite a large issue.

UpstreamData avatar Feb 08 '24 15:02 UpstreamData

I did. Is there a location in the HA shell where I can check this? Is it possible to reset the passwords?

w035h avatar Feb 08 '24 15:02 w035h

I'm honestly not sure, maybe this is a start? https://www.home-assistant.io/getting-started/configuration/

I don't have access to my hass dev instance right now, but I also believe there might be something in the developer menu to check out the config, it should have these keys -

"ssh_password"
"ssh_username"
"web_password"
"web_username"

UpstreamData avatar Feb 08 '24 16:02 UpstreamData

Hi @UpstreamData, any hints as to where to look would be welcome. Can't find anything in the yaml files regarding the keys? should it be in "custom_components/miner/const.py" Are they hardcoded there?

w035h avatar Feb 13 '24 13:02 w035h

I can't find it anywhere on the system, it's likely stored in a database or something. You may just have to uninstall it again, then make sure to delete the folder it was in via SSH (/homeassistant/custom_components/miner), then you can attempt a re-install and see if that solves it.

b-rowan avatar Feb 13 '24 14:02 b-rowan

Thanks @b-rowan, I'll try that.

w035h avatar Feb 13 '24 15:02 w035h

Same here with v1.1.6rc4 and Home Assistant 2024.4.3

Controlling the active state works fine, but setting the wattage/power usage does not. I also checked if enabled Autotuning or Dynamic Performance Scaling have an impact here, but controlling that value via Home Assistant doesn't work regardless.

dennisreimann avatar Apr 16 '24 10:04 dennisreimann

I have the same issue, all works fine beside the Power setting. I even have a fresh setup (HA new installed 2024.4.3, just weeks ago) newly configured Hass Miner wqith actuall PW. So no old setup in back.

robert1martin avatar May 02 '24 06:05 robert1martin

I have the same issue, all works fine beside the Power setting. I even have a fresh setup (HA new installed 2024.4.3, just weeks ago) newly configured Hass Miner wqith actuall PW. So no old setup in back.

What version of hass-miner? I was having some issues with older BOS+ configuration for a bit, I just moved to the most recent config version for them so that should fix that issue if youre on 1.1.8.

Only other thing I could think of is if the SSH password isn't working for some reason. If you try to ssh root@{ip address of miner} in a terminal and use the password you provided to hass-miner in the SSH password field as the password, does it let you in?

b-rowan avatar May 02 '24 14:05 b-rowan

I've just updated everything to latest, here's what's NOT working for me:

  • Miner: 2022-09-27-0-26ba61b9-22.08.1-plus, latest Braiins OS+
  • Home Assistant: Core 2024.5.0, Supervisor 2024.04.4, Operating System 12.2
  • hass-miner v1.1.8

SSH username/password are correct and e.g. setting Active/Inactive via the Home Assistant integration works just fine.

dennisreimann avatar May 03 '24 05:05 dennisreimann

What version of hass-miner? I was having some issues with older BOS+ configuration for a bit, I just moved to the most recent config version for them so that should fix that issue if youre on 1.1.8.

Miner: v22.08.1, latest Braiins OS+ Home Assistant: Core 2024.4.4, Frontend 20240404.2 hass-miner v1.1.8

Only other thing I could think of is if the SSH password isn't working for some reason. If you try to ssh root@{ip address of miner} in a terminal and use the password you provided to hass-miner in the SSH password field as the password, does it let you in?

Also this works fine, SSH acces works

robert1martin avatar May 03 '24 06:05 robert1martin

Issue identified, the hint with manual SSH config was the issue! on first connect in the console I got following question: image

now the set power limit works from HA :) --> maybe you can catch this single setup

robert1martin avatar May 03 '24 06:05 robert1martin

@b-rowan Which HA user is running the commands? As root I tried manually connecting to the miner, which also brought up the authenticity check. I approved it and even created an SSH key, which I then uploaded to the miner — so for root the password shouldn't even be required anymore. Yet it still doesn't work for me.

Here's the exception from the hass-miner debug log:

2024-05-03 10:15:23.068 WARNING (MainThread) [root] S9 (BOS+): XXX.XXX.XXX.XXX - Failed to set power limit: 'NoneType' object has no attribute 'as_bosminer'
2024-05-03 10:15:23.071 ERROR (MainThread) [homeassistant.components.websocket_api.http.connection] [140710751034816] Unexpected exception
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/components/websocket_api/commands.py", line 239, in handle_call_service
    response = await hass.services.async_call(
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/core.py", line 2738, in async_call
    response_data = await coro
                    ^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/core.py", line 2779, in _execute_service
    return await target(service_call)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/helpers/service.py", line 975, in entity_service_call
    single_response = await _handle_entity_call(
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/helpers/service.py", line 1047, in _handle_entity_call
    result = await task
             ^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/components/number/__init__.py", line 116, in async_set_value
    await entity.async_set_native_value(native_value)
  File "/config/custom_components/miner/number.py", line 117, in async_set_native_value
    raise pyasic.APIError("Failed to set wattage.")
pyasic.errors.APIError: Failed to set wattage.
2024-05-03 10:15:59.461 DEBUG (MainThread) [custom_components.miner.coordinator] Found miner :S9 (BOS+): XXX.XXX.XXX.XXX

dennisreimann avatar May 03 '24 08:05 dennisreimann

Which HA user is running the commands?

Good question. In any case, it seems like I might need to set a different flag with asyncssh than what I was setting to accept host keys always.

b-rowan avatar May 03 '24 13:05 b-rowan

Can you guys test with v1.1.9rc1? I changed the way writing the config is handled, so I want to see if that was the issue, or if its actually fully ssh related.

b-rowan avatar May 03 '24 14:05 b-rowan

Nothing changed for me, the error message in the log is still the same. I also tried removing and re-adding the device after upgrading to v1.1.9rc1 — nevertheless, thanks for your support and the quick replies, hope we get this sorted!

dennisreimann avatar May 03 '24 16:05 dennisreimann

Aight, I'll whip up a full test setup here then. Thanks for checking.

b-rowan avatar May 03 '24 16:05 b-rowan

I think I found it, seems like the config wasn't being loaded properly when temperature settings were not set, leading to temperature settings to be None internally, which wasn't able to be parsed to be sent back to the machine. Can you try with 1.1.9rc2?

b-rowan avatar May 03 '24 17:05 b-rowan

There seems to be a dependency problem now:

[homeassistant.util.package] Unable to install package pyasic==0.55.2: ERROR: Could not find a version that satisfies the requirement pyasic==0.55.2

Most recent which can be found is pyasic .55.1

dennisreimann avatar May 03 '24 18:05 dennisreimann

Release tag didn't push, it should be up there now.

b-rowan avatar May 03 '24 18:05 b-rowan

Here we go, that fixed it! Thanks for the fast replies! :)

dennisreimann avatar May 03 '24 18:05 dennisreimann

Everything is working now? If so, ill push a proper release and close this issue.

b-rowan avatar May 03 '24 18:05 b-rowan

Yes, for me the latest rc release fixed the issue.

dennisreimann avatar May 03 '24 18:05 dennisreimann

Fixed for me to on the 1.1.9 release 👍

w035h avatar May 03 '24 23:05 w035h