Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion homeassistant/components/fritzbox/manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"domain": "fritzbox",
"name": "AVM FRITZ!SmartHome",
"documentation": "https://www.home-assistant.io/integrations/fritzbox",
"requirements": ["pyfritzhome==0.6.5"],
"requirements": ["pyfritzhome==0.6.7"],
"ssdp": [
{
"st": "urn:schemas-upnp-org:device:fritzbox:1"
Expand Down
10 changes: 4 additions & 6 deletions homeassistant/components/fritzbox/sensor.py
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ class FritzSensorEntityDescription(
device_class=SensorDeviceClass.POWER,
state_class=SensorStateClass.MEASUREMENT,
suitable=lambda device: device.has_powermeter, # type: ignore[no-any-return]
native_value=lambda device: device.power / 1000 if device.power else 0.0,
native_value=lambda device: round((device.power or 0.0) / 1000, 3),
),
FritzSensorEntityDescription(
key="voltage",
Expand All @@ -96,9 +96,7 @@ class FritzSensorEntityDescription(
device_class=SensorDeviceClass.VOLTAGE,
state_class=SensorStateClass.MEASUREMENT,
suitable=lambda device: device.has_powermeter, # type: ignore[no-any-return]
native_value=lambda device: device.voltage
if getattr(device, "voltage", None)
else 0.0,
native_value=lambda device: round((device.voltage or 0.0) / 1000, 2),
),
FritzSensorEntityDescription(
key="electric_current",
Expand All @@ -107,7 +105,7 @@ class FritzSensorEntityDescription(
device_class=SensorDeviceClass.CURRENT,
state_class=SensorStateClass.MEASUREMENT,
suitable=lambda device: device.has_powermeter, # type: ignore[no-any-return]
native_value=lambda device: device.power / device.voltage / 1000
native_value=lambda device: round(device.power / device.voltage, 3)
Comment thread
frenck marked this conversation as resolved.
if device.power and getattr(device, "voltage", None)
else 0.0,
),
Expand All @@ -118,7 +116,7 @@ class FritzSensorEntityDescription(
device_class=SensorDeviceClass.ENERGY,
state_class=SensorStateClass.TOTAL_INCREASING,
suitable=lambda device: device.has_powermeter, # type: ignore[no-any-return]
native_value=lambda device: device.energy / 1000 if device.energy else 0.0,
native_value=lambda device: (device.energy or 0.0) / 1000,
),
# Thermostat Sensors
FritzSensorEntityDescription(
Expand Down
2 changes: 1 addition & 1 deletion requirements_all.txt
Original file line number Diff line number Diff line change
Expand Up @@ -1563,7 +1563,7 @@ pyforked-daapd==0.1.11
pyfreedompro==1.1.0

# homeassistant.components.fritzbox
pyfritzhome==0.6.5
pyfritzhome==0.6.7

# homeassistant.components.fronius
pyfronius==0.7.1
Expand Down
2 changes: 1 addition & 1 deletion requirements_test_all.txt
Original file line number Diff line number Diff line change
Expand Up @@ -1091,7 +1091,7 @@ pyforked-daapd==0.1.11
pyfreedompro==1.1.0

# homeassistant.components.fritzbox
pyfritzhome==0.6.5
pyfritzhome==0.6.7

# homeassistant.components.fronius
pyfronius==0.7.1
Expand Down
2 changes: 1 addition & 1 deletion tests/components/fritzbox/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ class FritzDeviceSwitchMock(FritzDeviceBaseMock):
battery_level = None
device_lock = "fake_locked_device"
energy = 1234
voltage = 230
voltage = 230000
fw_version = "1.2.3"
has_alarm = False
has_powermeter = True
Expand Down
4 changes: 2 additions & 2 deletions tests/components/fritzbox/test_switch.py
Original file line number Diff line number Diff line change
Expand Up @@ -77,14 +77,14 @@ async def test_setup(hass: HomeAssistant, fritz: Mock):
],
[
f"{SENSOR_DOMAIN}.{CONF_FAKE_NAME}_voltage",
"230",
"230.0",
f"{CONF_FAKE_NAME} Voltage",
ELECTRIC_POTENTIAL_VOLT,
SensorStateClass.MEASUREMENT,
],
[
f"{SENSOR_DOMAIN}.{CONF_FAKE_NAME}_electric_current",
"0.0246869565217391",
"0.025",
f"{CONF_FAKE_NAME} Electric Current",
ELECTRIC_CURRENT_AMPERE,
SensorStateClass.MEASUREMENT,
Expand Down