@@ -1834,3 +1834,38 @@ async def test_checks_count(fixture, expected, request):
18341834 await charger .update ()
18351835 status = charger .checks_count
18361836 assert status == expected
1837+
1838+
1839+ async def test_led_brightness (test_charger_new , test_charger_v2 , caplog ):
1840+ """Test led_brightness reply."""
1841+ await test_charger_new .update ()
1842+ status = test_charger_new .led_brightness
1843+ assert status == 125
1844+
1845+ await test_charger_v2 .update ()
1846+ with pytest .raises (UnsupportedFeature ):
1847+ with caplog .at_level (logging .DEBUG ):
1848+ status = await test_charger_v2 .led_brightness
1849+ assert "Feature not supported for older firmware." in caplog .text
1850+
1851+
1852+ async def test_set_led_brightness (
1853+ test_charger_new , test_charger_v2 , mock_aioclient , caplog
1854+ ):
1855+ """Test set_led_brightness reply."""
1856+ await test_charger_new .update ()
1857+ value = '{"msg": "OK"}'
1858+ mock_aioclient .post (
1859+ TEST_URL_CONFIG ,
1860+ status = 200 ,
1861+ body = value ,
1862+ )
1863+ with caplog .at_level (logging .DEBUG ):
1864+ await test_charger_new .set_led_brightness (255 )
1865+ assert "Setting LED brightness to 255" in caplog .text
1866+
1867+ await test_charger_v2 .update ()
1868+ with pytest .raises (UnsupportedFeature ):
1869+ with caplog .at_level (logging .DEBUG ):
1870+ await test_charger_v2 .set_led_brightness (255 )
1871+ assert "Feature not supported for older firmware." in caplog .text
0 commit comments