brianberg / ha-nicehash

NiceHash Home Assistant Integration
MIT License
22 stars 12 forks source link

Integration only returns one rig #16

Open WarrenSchultz opened 3 years ago

WarrenSchultz commented 3 years ago

I have multiple nicehash rigs running, however it only shows sensors for one. I just did a quick test on https://www.nicehash.com/docs/rest for rig details, and it does work if I put in the rig ID for one of the others.

plapin751 commented 2 years ago

@WarrenSchultz did you get this working with more than one rig?

WarrenSchultz commented 2 years ago

Unfortunately, no. And the integration itself seems to be erratic in connecting. Some days it works great, others, not so much. Don't know if that's HA, the integration, or NH's API. :)

pascalberski commented 2 years ago

I have the same issue but I discovered the bug: Unfortunately, the IDs of the graphics cards in different rigs always start at 0. If you now have several rigs, multiple attempts are made to create a device with ID = 0. This leads to an error.

2021-12-27 00:12:31 DEBUG (MainThread) [custom_components.nicehash.sensor] Found 3 device sensor(s) for Rig1 (0-rigID)
2021-12-27 00:12:31 DEBUG (MainThread) [custom_components.nicehash.sensor] Creating AMD Ryzen 7 5800X 8-Core Processor (32) sensors
2021-12-27 00:12:31 DEBUG (MainThread) [custom_components.nicehash.sensor] Creating GeForce RTX 3070 (0) sensors
2021-12-27 00:12:31 DEBUG (MainThread) [custom_components.nicehash.sensor] Creating GeForce RTX 3070 (1) sensors
2021-12-27 00:12:31 DEBUG (MainThread) [custom_components.nicehash.sensor] Found 1 device sensor(s) for Rig2 (0-rigID)
2021-12-27 00:12:31 DEBUG (MainThread) [custom_components.nicehash.sensor] Creating GeForce RTX 3080 (0) sensors

You can see that the one 3070 has the ID 0 and the 3080 has the ID 0 too.