Skip to content

Commit

Permalink
Add IP to connection info.
Browse files Browse the repository at this point in the history
  • Loading branch information
b-rowan committed Jun 21, 2024
1 parent 69d068c commit c7d38b8
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
4 changes: 2 additions & 2 deletions custom_components/miner/coordinator.py
Original file line number Diff line number Diff line change
Expand Up @@ -114,8 +114,8 @@ async def _async_update_data(self):
"is_mining": miner_data.is_mining,
"fw_ver": miner_data.fw_ver,
"miner_sensors": {
"hashrate": round(float(miner_data.hashrate or 0), 2),
"ideal_hashrate": round(float(miner_data.expected_hashrate or 0), 2),
"hashrate": hashrate,
"ideal_hashrate": expected_hashrate,
"temperature": miner_data.temperature_avg,
"power_limit": miner_data.wattage_limit,
"miner_consumption": miner_data.wattage,
Expand Down
5 changes: 4 additions & 1 deletion custom_components/miner/number.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
from homeassistant.config_entries import ConfigEntry
from homeassistant.core import callback
from homeassistant.core import HomeAssistant
from homeassistant.helpers import entity
from homeassistant.helpers import entity, device_registry
from homeassistant.helpers.entity_platform import AddEntitiesCallback
from homeassistant.helpers.update_coordinator import CoordinatorEntity

Expand Down Expand Up @@ -55,10 +55,13 @@ def device_info(self) -> entity.DeviceInfo:
"""Return device info."""
return entity.DeviceInfo(
identifiers={(DOMAIN, self.coordinator.data["mac"])},
connections={("ip", self.coordinator.data["ip"]), (device_registry.CONNECTION_NETWORK_MAC, self.coordinator.data["mac"])},
configuration_url=f"http://{self.coordinator.data['ip']}",
manufacturer=self.coordinator.data["make"],
model=self.coordinator.data["model"],
sw_version=self.coordinator.data["fw_ver"],
name=f"{self.coordinator.entry.title}",

)

@property
Expand Down

0 comments on commit c7d38b8

Please sign in to comment.