'Test state, bri, color, effect, color temp, white val change.'

def test_state_brightness_color_effect_temp_white_change_via_topic(self):

    with assert_setup_component(1, light.DOMAIN):
        assert setup_component(self.hass, light.DOMAIN, {light.DOMAIN: {'platform': 'mqtt_template', 'name': 'test', 'effect_list': ['rainbow', 'colorloop'], 'state_topic': 'test_light_rgb', 'command_topic': 'test_light_rgb/set', 'command_on_template': 'on,{{    brightness|d    }},{{    color_temp|d    }},{{    white_value|d    }},{{    red|d    }}-{{    green|d    }}-{{    blue|d    }},{{    effect|d    }}', 'command_off_template': 'off', 'state_template': '{{    value.split(",")[0]    }}', 'brightness_template': '{{    value.split(",")[1]    }}', 'color_temp_template': '{{    value.split(",")[2]    }}', 'white_value_template': '{{    value.split(",")[3]    }}', 'red_template': '{{    value.split(",")[4].split("-")[0]    }}', 'green_template': '{{    value.split(",")[4].split("-")[1]    }}', 'blue_template': '{{    value.split(",")[4].split("-")[2]    }}', 'effect_template': '{{    value.split(",")[5]    }}'}})
    state = self.hass.states.get('light.test')
    self.assertEqual(STATE_OFF, state.state)
    self.assertIsNone(state.attributes.get('rgb_color'))
    self.assertIsNone(state.attributes.get('brightness'))
    self.assertIsNone(state.attributes.get('effect'))
    self.assertIsNone(state.attributes.get('color_temp'))
    self.assertIsNone(state.attributes.get('white_value'))
    self.assertFalse(state.attributes.get(ATTR_ASSUMED_STATE))
    fire_mqtt_message(self.hass, 'test_light_rgb', 'on,255,145,123,255-255-255,')
    self.hass.block_till_done()
    state = self.hass.states.get('light.test')
    self.assertEqual(STATE_ON, state.state)
    self.assertEqual([255, 255, 255], state.attributes.get('rgb_color'))
    self.assertEqual(255, state.attributes.get('brightness'))
    self.assertEqual(145, state.attributes.get('color_temp'))
    self.assertEqual(123, state.attributes.get('white_value'))
    self.assertIsNone(state.attributes.get('effect'))
    fire_mqtt_message(self.hass, 'test_light_rgb', 'off')
    self.hass.block_till_done()
    state = self.hass.states.get('light.test')
    self.assertEqual(STATE_OFF, state.state)
    fire_mqtt_message(self.hass, 'test_light_rgb', 'on,100')
    self.hass.block_till_done()
    light_state = self.hass.states.get('light.test')
    self.hass.block_till_done()
    self.assertEqual(100, light_state.attributes['brightness'])
    fire_mqtt_message(self.hass, 'test_light_rgb', 'on,,195')
    self.hass.block_till_done()
    light_state = self.hass.states.get('light.test')
    self.hass.block_till_done()
    self.assertEqual(195, light_state.attributes['color_temp'])
    fire_mqtt_message(self.hass, 'test_light_rgb', 'on,,,,41-42-43')
    self.hass.block_till_done()
    light_state = self.hass.states.get('light.test')
    self.assertEqual([41, 42, 43], light_state.attributes.get('rgb_color'))
    fire_mqtt_message(self.hass, 'test_light_rgb', 'on,,,134')
    self.hass.block_till_done()
    light_state = self.hass.states.get('light.test')
    self.hass.block_till_done()
    self.assertEqual(134, light_state.attributes['white_value'])
    fire_mqtt_message(self.hass, 'test_light_rgb', 'on,,,,41-42-43,rainbow')
    self.hass.block_till_done()
    light_state = self.hass.states.get('light.test')
    self.assertEqual('rainbow', light_state.attributes.get('effect'))
