Schnitzel / hass-miner

Controll your Bitcoin miner from Home Assistant
MIT License
60 stars 19 forks source link

Can't add Whatsminer M50 with latest fw. "Unknown error occurred" #405

Closed grosman357 closed 1 week ago

grosman357 commented 1 month ago

HA Core 2024.9.1 hass-miner v1.1.16rc1

Whatsminer M50_VH84.H616 firmware 20241011.12.Rel.LC

During initial setup, after entering the IP address, an "Unknown error occurred" appears.

This may be due to the fact that in the latest versions of the Whatsminer firmware, the API port has changed from 4028 to 4433. MicroBT has posted a demo Python script (https://aws-microbt-com-bucket.s3.us-west-2.amazonaws.com/1729070366369python-whatsminer-api-3.0.0.zip). The API port there is 4433.

b-rowan commented 1 month ago

They fully replaced the API? There's no way they're actually that stupid. I hope. I'll take a look into it when I have a chance...

grosman357 commented 1 month ago

The API itself looks the same. The only problem is that they changed the port. I have home assistant installed in a docker container and I can't change it in pyasic

b-rowan commented 1 month ago

AFAIU that 4433 api is completely different, but you can try modifying hass-miner on your system if you want. It's in custom_components/miner, and you need to edit the coordinator.py file so that when get_miner is called, if the miner is a Whatsminer, you can set miner.rpc.port to 4433

grosman357 commented 1 month ago

Unfortunately, my programming knowledge is too small to do this.

Also the new version of API has a very interesting function set.miner.power_percent As I understand it allows you to regulate the consumption of the miner without rebooting and this would be useful for automating a home assistant, provided that the miner is used as a heating boiler.

b-rowan commented 3 weeks ago

I don't have a new enough device to test this with yet, I'll have to see what I can find from people I know who can help...

grosman357 commented 1 week ago

fixed. in config_flow.py line 112 changed self._miner.web.pwd to self._miner.api.pwd

b-rowan commented 1 week ago

Fixed in commit a7c76f3552820474d7a017df69580d99f69a1e94, will release a version shortly.

b-rowan commented 1 week ago

Done in v1.1.18

grosman357 commented 1 week ago

self._miner.api.pwd works for me. not self._miner.rpc.pwd

b-rowan commented 1 week ago

self._miner.api.pwd works for me. not self._miner.rpc.pwd

miner.api is just a property mapping to miner.rpc.

See https://github.com/UpstreamData/pyasic/blob/cc97ceee619dc097b13f9448b0f77e3695248bca/pyasic/miners/base.py#L95-L97