Example #1
0
 def test_stop_cover_tilt(self):
     """Test stopping the cover tilt."""
     state = self.hass.states.get(ENTITY_COVER)
     self.assertEqual(50, state.attributes.get('current_tilt_position'))
     cover.close_cover_tilt(self.hass, ENTITY_COVER)
     self.hass.block_till_done()
     future = dt_util.utcnow() + timedelta(seconds=1)
     fire_time_changed(self.hass, future)
     self.hass.block_till_done()
     cover.stop_cover_tilt(self.hass, ENTITY_COVER)
     self.hass.block_till_done()
     fire_time_changed(self.hass, future)
     state = self.hass.states.get(ENTITY_COVER)
     self.assertEqual(40, state.attributes.get('current_tilt_position'))
 def test_stop_cover_tilt(self):
     """Test stopping the cover tilt."""
     state = self.hass.states.get(ENTITY_COVER)
     self.assertEqual(50, state.attributes.get('current_tilt_position'))
     cover.close_cover_tilt(self.hass, ENTITY_COVER)
     self.hass.block_till_done()
     future = dt_util.utcnow() + timedelta(seconds=1)
     fire_time_changed(self.hass, future)
     self.hass.block_till_done()
     cover.stop_cover_tilt(self.hass, ENTITY_COVER)
     self.hass.block_till_done()
     fire_time_changed(self.hass, future)
     state = self.hass.states.get(ENTITY_COVER)
     self.assertEqual(40, state.attributes.get('current_tilt_position'))
    def test_stop_tilts(self):
        """Test stop tilts function."""
        with assert_setup_component(2, DOMAIN):
            assert setup.setup_component(self.hass, DOMAIN, CONFIG)

        cover.open_cover_tilt(self.hass, COVER_GROUP)
        self.hass.block_till_done()
        future = dt_util.utcnow() + timedelta(seconds=1)
        fire_time_changed(self.hass, future)
        self.hass.block_till_done()
        cover.stop_cover_tilt(self.hass, COVER_GROUP)
        self.hass.block_till_done()
        future = dt_util.utcnow() + timedelta(seconds=1)
        fire_time_changed(self.hass, future)
        self.hass.block_till_done()

        state = self.hass.states.get(COVER_GROUP)
        self.assertEqual(state.state, STATE_OPEN)
        self.assertEqual(state.attributes.get(ATTR_CURRENT_TILT_POSITION), 60)

        self.assertEqual(self.hass.states.get(DEMO_COVER_TILT)
                         .attributes.get(ATTR_CURRENT_TILT_POSITION), 60)
Example #4
0
    def test_stop_tilts(self):
        """Test stop tilts function."""
        with assert_setup_component(2, DOMAIN):
            assert setup.setup_component(self.hass, DOMAIN, CONFIG)

        cover.open_cover_tilt(self.hass, COVER_GROUP)
        self.hass.block_till_done()
        future = dt_util.utcnow() + timedelta(seconds=1)
        fire_time_changed(self.hass, future)
        self.hass.block_till_done()
        cover.stop_cover_tilt(self.hass, COVER_GROUP)
        self.hass.block_till_done()
        future = dt_util.utcnow() + timedelta(seconds=1)
        fire_time_changed(self.hass, future)
        self.hass.block_till_done()

        state = self.hass.states.get(COVER_GROUP)
        self.assertEqual(state.state, STATE_OPEN)
        self.assertEqual(state.attributes.get(ATTR_CURRENT_TILT_POSITION), 60)

        self.assertEqual(
            self.hass.states.get(DEMO_COVER_TILT).attributes.get(
                ATTR_CURRENT_TILT_POSITION), 60)