@@ -119,6 +119,34 @@ def test_mode_discovery_includes_limit_battery_charge_mode(self):
119119class TestDiscoveryMessages :
120120 """Discovery should expose key externally visible runtime state."""
121121
122+ def test_discovery_includes_limit_battery_charge_rate_number (self ):
123+ api = MagicMock (spec = MqttApi )
124+ api .base_topic = 'batcontrol'
125+ api .publish_mqtt_discovery_message = MagicMock ()
126+ api .send_mqtt_discovery_for_mode = MagicMock ()
127+ api .send_mqtt_discovery_messages = (
128+ MqttApi .send_mqtt_discovery_messages .__get__ (api , MqttApi )
129+ )
130+
131+ api .send_mqtt_discovery_messages ()
132+
133+ assert any (
134+ call .args [:3 ] == (
135+ 'Limit Battery Charge Rate' ,
136+ 'batcontrol_limit_battery_charge_rate' ,
137+ 'number' ,
138+ )
139+ and call .args [3 ] == 'power'
140+ and call .args [4 ] == 'W'
141+ and call .args [5 ] == 'batcontrol/limit_battery_charge_rate'
142+ and call .args [6 ] == 'batcontrol/limit_battery_charge_rate/set'
143+ and call .kwargs ['entity_category' ] == 'config'
144+ and call .kwargs ['min_value' ] == - 1
145+ and call .kwargs ['max_value' ] == 10000
146+ and call .kwargs ['initial_value' ] == - 1
147+ for call in api .publish_mqtt_discovery_message .call_args_list
148+ )
149+
122150 def test_discovery_includes_api_override_active_binary_sensor (self ):
123151 api = MagicMock (spec = MqttApi )
124152 api .base_topic = 'batcontrol'
0 commit comments