Fix encoding for MQTT camera (#20932)

This commit is contained in:
emontnemery 2019-02-10 12:35:54 +01:00 committed by Fabian Affolter
parent 5def64156f
commit 5f7f7777a0
2 changed files with 4 additions and 3 deletions

View file

@ -110,7 +110,8 @@ class MqttCamera(MqttDiscoveryUpdate, Camera):
self.hass, self._sub_state,
{'state_topic': {'topic': self._config.get(CONF_TOPIC),
'msg_callback': message_received,
'qos': self._qos}})
'qos': self._qos,
'encoding': None}})
async def async_will_remove_from_hass(self):
"""Unsubscribe when removed."""

View file

@ -168,7 +168,7 @@ async def test_entity_id_update(hass, mqtt_mock):
state = hass.states.get('camera.beer')
assert state is not None
assert mock_mqtt.async_subscribe.call_count == 1
mock_mqtt.async_subscribe.assert_any_call('test-topic', ANY, 0, 'utf-8')
mock_mqtt.async_subscribe.assert_any_call('test-topic', ANY, 0, None)
mock_mqtt.async_subscribe.reset_mock()
registry.async_update_entity('camera.beer', new_entity_id='camera.milk')
@ -181,4 +181,4 @@ async def test_entity_id_update(hass, mqtt_mock):
state = hass.states.get('camera.milk')
assert state is not None
assert mock_mqtt.async_subscribe.call_count == 1
mock_mqtt.async_subscribe.assert_any_call('test-topic', ANY, 0, 'utf-8')
mock_mqtt.async_subscribe.assert_any_call('test-topic', ANY, 0, None)